aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-05-04 13:56:28 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-05-04 13:56:28 -0400
commite2cc3f98fb3ca771d9bd108ae9c37c19bea8025b (patch)
treee45f71a17c410e456c56de52f94f5c7f95152ad7 /runtime/indent
parent490804ed33a5da70ba14bc54bceea5decb62874a (diff)
parent6a32852137a3d54131534fe628230eca5311d3fc (diff)
downloadrneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.tar.gz
rneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.tar.bz2
rneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.zip
Merge pull request #4704 from KillTheMule/vim-runtime-patches-all
vim-patch:{a0f849e, d7464be, b4ff518, e392eb4, d042dc8, 2c5e8e8, 256972a, cc7ff3f}
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/fortran.vim27
-rw-r--r--runtime/indent/hog.vim77
-rw-r--r--runtime/indent/sh.vim4
-rw-r--r--runtime/indent/yaml.vim4
4 files changed, 100 insertions, 12 deletions
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index 2c83f26b58..d492889fc7 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,9 +1,9 @@
" Vim indent file
-" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77)
-" Version: 0.41
-" Last Change: 2015 Jan. 15
+" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
+" Version: 0.42
+" Last Change: 2015 Nov. 30
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
-" Usage: Do :help fortran-indent from Vim
+" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
" Useful suggestions were made by: Albert Oliver Serra.
@@ -27,7 +27,10 @@ if exists("b:fortran_indent_more") || exists("g:fortran_indent_more")
endif
" Determine whether this is a fixed or free format source file
-" if this hasn't been done yet
+" if this hasn't been done yet using the priority:
+" buffer-local value
+" > global value
+" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers
if !exists("b:fortran_fixed_source")
if exists("fortran_free_source")
" User guarantees free source form
@@ -35,13 +38,19 @@ if !exists("b:fortran_fixed_source")
elseif exists("fortran_fixed_source")
" User guarantees fixed source form
let b:fortran_fixed_source = 1
+ elseif expand("%:e") ==? "f\<90\|95\|03\|08\>"
+ " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers
+ let b:fortran_fixed_source = 0
+ elseif expand("%:e") ==? "f\|f77\|for"
+ " Fixed-form file extension defaults
+ let b:fortran_fixed_source = 1
else
- " f90 and f95 allow both fixed and free source form
- " assume fixed source form unless signs of free source form
+ " Modern fortran still allows both fixed and free source form
+ " Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
- " Detection becomes more accurate and more time-consuming if more lines
+ " Detection becomes more accurate and time-consuming if more lines
" are checked. Increase the limit below if you keep lots of comments at
- " the very top of each file and you have a fast computer
+ " the very top of each file and you have a fast computer.
let s:lmax = 500
if ( s:lmax > line("$") )
let s:lmax = line("$")
diff --git a/runtime/indent/hog.vim b/runtime/indent/hog.vim
new file mode 100644
index 0000000000..02ac7d4d1b
--- /dev/null
+++ b/runtime/indent/hog.vim
@@ -0,0 +1,77 @@
+" Vim indent file
+" Language: hog (Snort.conf)
+" Maintainer: Victor Roemer, <vroemer@badsec.org>
+" Last Change: Mar 7, 2013
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+let b:undo_indent = 'setlocal smartindent< indentexpr< indentkeys<'
+
+setlocal nosmartindent
+setlocal indentexpr=GetHogIndent()
+setlocal indentkeys+=!^F,o,O,0#
+
+" Only define the function once.
+if exists("*GetHogIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let s:syn_blocks = '\<SnortRuleTypeBody\>'
+
+function s:IsInBlock(lnum)
+ return synIDattr(synID(a:lnum, 1, 1), 'name') =~ s:syn_blocks
+endfunction
+
+function GetHogIndent()
+ let prevlnum = prevnonblank(v:lnum-1)
+
+ " Comment blocks have identical indent
+ if getline(v:lnum) =~ '^\s*#' && getline(prevlnum) =~ '^\s*#'
+ return indent(prevlnum)
+ endif
+
+ " Ignore comment lines when calculating indent
+ while getline(prevlnum) =~ '^\s*#'
+ let prevlnum = prevnonblank(prevlnum-1)
+ if !prevlnum
+ return previndent
+ endif
+ endwhile
+
+ " Continuation of a line that wasn't indented
+ let prevline = getline(prevlnum)
+ if prevline =~ '^\k\+.*\\\s*$'
+ return &sw
+ endif
+
+ " Continuation of a line that was indented
+ if prevline =~ '\k\+.*\\\s*$'
+ return indent(prevlnum)
+ endif
+
+ " Indent the next line if previous line contained a start of a block
+ " definition ('{' or '(').
+ if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$'
+ return &sw
+ endif
+
+ " Match inside of a block
+ if s:IsInBlock(v:lnum)
+ if prevline =~ "^\k\+.*$"
+ return &sw
+ else
+ return indent(prevlnum)
+ endif
+ endif
+
+ return 0
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index b2f35b23a7..5bd8c77fab 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -3,7 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2015-07-28
+" Latest Revision: 2015-12-15
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
@@ -12,6 +12,8 @@ if exists("b:did_indent")
endif
let b:did_indent = 1
+let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
+
setlocal indentexpr=GetShIndent()
setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;&
setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 95a53b1386..aa4906ce0a 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: YAML
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
-" Last Change: 2015 Sep 25
+" Last Change: 2015 Nov 01
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -14,7 +14,7 @@ set cpo&vim
let b:did_indent = 1
setlocal indentexpr=GetYAMLIndent(v:lnum)
-setlocal indentkeys=!^F,o,O,0#,0},0],<:>,-
+setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0-
setlocal nosmartindent
let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'