mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
vim-patch:3ec574f2b549
Update runtime files.
Includes changing &sw to shiftwidth() for all indent scripts.
3ec574f2b5
This commit is contained in:
@ -5157,7 +5157,10 @@ line({expr}) The result is a Number, which is the line number of the file
|
|||||||
< *last-position-jump*
|
< *last-position-jump*
|
||||||
This autocommand jumps to the last known position in a file
|
This autocommand jumps to the last known position in a file
|
||||||
just after opening it, if the '" mark is set: >
|
just after opening it, if the '" mark is set: >
|
||||||
:au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
:au BufReadPost *
|
||||||
|
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
||||||
|
\ | exe "normal! g`\""
|
||||||
|
\ | endif
|
||||||
|
|
||||||
line2byte({lnum}) *line2byte()*
|
line2byte({lnum}) *line2byte()*
|
||||||
Return the byte count from the start of the buffer for line
|
Return the byte count from the start of the buffer for line
|
||||||
|
@ -1058,12 +1058,16 @@ x A single character, with no special meaning, matches itself
|
|||||||
":s/[/x/" searches for "[/x" and replaces it with nothing. It does
|
":s/[/x/" searches for "[/x" and replaces it with nothing. It does
|
||||||
not search for "[" and replaces it with "x"!
|
not search for "[" and replaces it with "x"!
|
||||||
|
|
||||||
|
*E944* *E945*
|
||||||
If the sequence begins with "^", it matches any single character NOT
|
If the sequence begins with "^", it matches any single character NOT
|
||||||
in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
|
in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
|
||||||
- If two characters in the sequence are separated by '-', this is
|
- If two characters in the sequence are separated by '-', this is
|
||||||
shorthand for the full list of ASCII characters between them. E.g.,
|
shorthand for the full list of ASCII characters between them. E.g.,
|
||||||
"[0-9]" matches any decimal digit. Non-ASCII characters can be
|
"[0-9]" matches any decimal digit. If the starting character exceeds
|
||||||
used, but the character values must not be more than 256 apart.
|
the ending character, e.g. [c-a], E944 occurs. Non-ASCII characters
|
||||||
|
can be used, but the character values must not be more than 256 apart
|
||||||
|
in the old regexp engine. For example, searching by [\u3000-\u4000]
|
||||||
|
after setting re=1 emits a E945 error. Prepending \%#=2 will fix it.
|
||||||
- A character class expression is evaluated to the set of characters
|
- A character class expression is evaluated to the set of characters
|
||||||
belonging to that character class. The following character classes
|
belonging to that character class. The following character classes
|
||||||
are supported:
|
are supported:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim support file to detect file types
|
" Vim support file to detect file types
|
||||||
"
|
"
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2017 May 27
|
" Last Change: 2017 Jun 12
|
||||||
|
|
||||||
" Listen very carefully, I will say this only once
|
" Listen very carefully, I will say this only once
|
||||||
if exists("did_load_filetypes")
|
if exists("did_load_filetypes")
|
||||||
@ -2229,6 +2229,8 @@ func! s:FTtex()
|
|||||||
let format = tolower(matchstr(firstline, '\a\+'))
|
let format = tolower(matchstr(firstline, '\a\+'))
|
||||||
let format = substitute(format, 'pdf', '', '')
|
let format = substitute(format, 'pdf', '', '')
|
||||||
if format == 'tex'
|
if format == 'tex'
|
||||||
|
let format = 'latex'
|
||||||
|
elseif format == 'plaintex'
|
||||||
let format = 'plain'
|
let format = 'plain'
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
@ -87,7 +87,7 @@ function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at)
|
|||||||
endwhile
|
endwhile
|
||||||
endwhile
|
endwhile
|
||||||
" Fallback - just move back one
|
" Fallback - just move back one
|
||||||
return a:prev_indent - &sw
|
return a:prev_indent - shiftwidth()
|
||||||
endfunction MainBlockIndent
|
endfunction MainBlockIndent
|
||||||
|
|
||||||
" Section: s:EndBlockIndent {{{1
|
" Section: s:EndBlockIndent {{{1
|
||||||
@ -131,7 +131,7 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend )
|
|||||||
endwhile
|
endwhile
|
||||||
endwhile
|
endwhile
|
||||||
" Fallback - just move back one
|
" Fallback - just move back one
|
||||||
return a:prev_indent - &sw
|
return a:prev_indent - shiftwidth()
|
||||||
endfunction EndBlockIndent
|
endfunction EndBlockIndent
|
||||||
|
|
||||||
" Section: s:StatementIndent {{{1
|
" Section: s:StatementIndent {{{1
|
||||||
@ -213,15 +213,15 @@ function GetAdaIndent()
|
|||||||
endif
|
endif
|
||||||
" Move indent in
|
" Move indent in
|
||||||
if ! false_match
|
if ! false_match
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(case\|exception\)\>'
|
elseif line =~ '^\s*\(case\|exception\)\>'
|
||||||
" Move indent in twice (next 'when' will move back)
|
" Move indent in twice (next 'when' will move back)
|
||||||
let ind = ind + 2 * &sw
|
let ind = ind + 2 * shiftwidth()
|
||||||
elseif line =~ '^\s*end\s*record\>'
|
elseif line =~ '^\s*end\s*record\>'
|
||||||
" Move indent back to tallying 'type' preceding the 'record'.
|
" Move indent back to tallying 'type' preceeding the 'record'.
|
||||||
" Allow indent to be equal to 'end record's.
|
" Allow indent to be equal to 'end record's.
|
||||||
let ind = s:MainBlockIndent( ind+&sw, lnum, 'type\>', '' )
|
let ind = s:MainBlockIndent( ind+shiftwidth(), lnum, 'type\>', '' )
|
||||||
elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$'
|
elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$'
|
||||||
" Revert to indent of line that started this parenthesis pair
|
" Revert to indent of line that started this parenthesis pair
|
||||||
exe lnum
|
exe lnum
|
||||||
@ -235,10 +235,10 @@ function GetAdaIndent()
|
|||||||
exe v:lnum
|
exe v:lnum
|
||||||
elseif line =~ '[.=(]\s*$'
|
elseif line =~ '[.=(]\s*$'
|
||||||
" A statement continuation - move in one
|
" A statement continuation - move in one
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
elseif line =~ '^\s*new\>'
|
elseif line =~ '^\s*new\>'
|
||||||
" Multiple line generic instantiation ('package blah is\nnew thingy')
|
" Multiple line generic instantiation ('package blah is\nnew thingy')
|
||||||
let ind = s:StatementIndent( ind - &sw, lnum )
|
let ind = s:StatementIndent( ind - shiftwidth(), lnum )
|
||||||
elseif line =~ ';\s*$'
|
elseif line =~ ';\s*$'
|
||||||
" Statement end (but not 'end' ) - try to find current statement-start indent
|
" Statement end (but not 'end' ) - try to find current statement-start indent
|
||||||
let ind = s:StatementIndent( ind, lnum )
|
let ind = s:StatementIndent( ind, lnum )
|
||||||
@ -256,17 +256,17 @@ function GetAdaIndent()
|
|||||||
elseif continuation && line =~ '^\s*('
|
elseif continuation && line =~ '^\s*('
|
||||||
" Don't do this if we've already indented due to the previous line
|
" Don't do this if we've already indented due to the previous line
|
||||||
if ind == initind
|
if ind == initind
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(begin\|is\)\>'
|
elseif line =~ '^\s*\(begin\|is\)\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
|
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
|
||||||
elseif line =~ '^\s*record\>'
|
elseif line =~ '^\s*record\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + &sw
|
let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + shiftwidth()
|
||||||
elseif line =~ '^\s*\(else\|elsif\)\>'
|
elseif line =~ '^\s*\(else\|elsif\)\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' )
|
let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' )
|
||||||
elseif line =~ '^\s*when\>'
|
elseif line =~ '^\s*when\>'
|
||||||
" Align 'when' one /in/ from matching block start
|
" Align 'when' one /in/ from matching block start
|
||||||
let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + &sw
|
let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + shiftwidth()
|
||||||
elseif line =~ '^\s*end\>\s*\<if\>'
|
elseif line =~ '^\s*end\>\s*\<if\>'
|
||||||
" End of if statements
|
" End of if statements
|
||||||
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
|
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
|
||||||
|
@ -60,7 +60,7 @@ function! GetAwkIndent()
|
|||||||
" 'pattern { action }' (simple check match on /{/ increases the indent then)
|
" 'pattern { action }' (simple check match on /{/ increases the indent then)
|
||||||
|
|
||||||
if s:Get_brace_balance( prev_data, '{', '}' ) > 0
|
if s:Get_brace_balance( prev_data, '{', '}' ) > 0
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let brace_balance = s:Get_brace_balance( prev_data, '(', ')' )
|
let brace_balance = s:Get_brace_balance( prev_data, '(', ')' )
|
||||||
@ -99,7 +99,7 @@ function! GetAwkIndent()
|
|||||||
return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum))
|
return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum))
|
||||||
else
|
else
|
||||||
" if/for/while without '{'
|
" if/for/while without '{'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -140,7 +140,7 @@ function! GetAwkIndent()
|
|||||||
|
|
||||||
" Decrease indent if this line contains a '}'.
|
" Decrease indent if this line contains a '}'.
|
||||||
if getline(v:lnum) =~ '^\s*}'
|
if getline(v:lnum) =~ '^\s*}'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -69,7 +69,7 @@ function! GetBstIndent(lnum) abort
|
|||||||
endif
|
endif
|
||||||
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
|
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
|
||||||
let ind = indent(lnum)
|
let ind = indent(lnum)
|
||||||
let ind = ind + &sw * s:count(line,'{')
|
let ind = ind + shiftwidth() * s:count(line,'{')
|
||||||
let ind = ind - &sw * s:count(fakeline,'}')
|
let ind = ind - shiftwidth() * s:count(fakeline,'}')
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Bazel (http://bazel.io)
|
" Language: Bazel (http://bazel.io)
|
||||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
|
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
|
||||||
" Last Change: 2015 Aug 11
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
@ -41,11 +41,8 @@ function GetBzlIndent(lnum) abort
|
|||||||
if exists('g:pyindent_open_paren')
|
if exists('g:pyindent_open_paren')
|
||||||
let l:pyindent_open_paren = g:pyindent_open_paren
|
let l:pyindent_open_paren = g:pyindent_open_paren
|
||||||
endif
|
endif
|
||||||
" Vim 7.3.693 and later defines a shiftwidth() function to get the effective
|
let g:pyindent_nested_paren = 'shiftwidth() * 2'
|
||||||
" shiftwidth value. Fall back to &shiftwidth if the function doesn't exist.
|
let g:pyindent_open_paren = 'shiftwidth() * 2'
|
||||||
let l:sw_expr = exists('*shiftwidth') ? 'shiftwidth()' : '&shiftwidth'
|
|
||||||
let g:pyindent_nested_paren = l:sw_expr . ' * 2'
|
|
||||||
let g:pyindent_open_paren = l:sw_expr . ' * 2'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:indent = -1
|
let l:indent = -1
|
||||||
|
@ -47,7 +47,7 @@ fun! CdlGetIndent(lnum)
|
|||||||
let thisline = getline(a:lnum)
|
let thisline = getline(a:lnum)
|
||||||
if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0
|
if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0
|
||||||
" it's an attributes line
|
" it's an attributes line
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0
|
elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0
|
||||||
" it's a header or '{' or '}' or a comment
|
" it's a header or '{' or '}' or a comment
|
||||||
return 0
|
return 0
|
||||||
@ -71,13 +71,13 @@ fun! CdlGetIndent(lnum)
|
|||||||
let c = line[inicio-1]
|
let c = line[inicio-1]
|
||||||
" ')' and '=' don't change indent and are useless to set 'f'
|
" ')' and '=' don't change indent and are useless to set 'f'
|
||||||
if c == '{'
|
if c == '{'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif c != ')' && c != '='
|
elseif c != ')' && c != '='
|
||||||
let f = 1 " all but 'elseif' are followed by a formula
|
let f = 1 " all but 'elseif' are followed by a formula
|
||||||
if c ==? 'n' || c ==? 'e' " 'then', 'else'
|
if c ==? 'n' || c ==? 'e' " 'then', 'else'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional
|
elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
let f = 0
|
let f = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -98,16 +98,16 @@ fun! CdlGetIndent(lnum)
|
|||||||
let ind = 0
|
let ind = 0
|
||||||
let f = 1
|
let f = 1
|
||||||
elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif'
|
elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif c == '(' || c ==? 'f' " '(' or 'if'
|
elseif c == '(' || c ==? 'f' " '(' or 'if'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
else " c == '='
|
else " c == '='
|
||||||
" if it is an asignment increase indent
|
" if it is an asignment increase indent
|
||||||
if f == -1 " we don't know yet, find out
|
if f == -1 " we don't know yet, find out
|
||||||
let f = CdlAsignment(lnum, strpart(line, 0, inicio))
|
let f = CdlAsignment(lnum, strpart(line, 0, inicio))
|
||||||
end
|
end
|
||||||
if f == 1 " formula increase it
|
if f == 1 " formula increase it
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
endw
|
endw
|
||||||
@ -115,13 +115,13 @@ fun! CdlGetIndent(lnum)
|
|||||||
" CURRENT LINE, if it starts with a closing element, decrease indent
|
" CURRENT LINE, if it starts with a closing element, decrease indent
|
||||||
" or if it starts with '=' (asignment), increase indent
|
" or if it starts with '=' (asignment), increase indent
|
||||||
if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0
|
if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif match(thisline, '^\s*=') >= 0
|
elseif match(thisline, '^\s*=') >= 0
|
||||||
if f == -1 " we don't know yet if is an asignment, find out
|
if f == -1 " we don't know yet if is an asignment, find out
|
||||||
let f = CdlAsignment(lnum, "")
|
let f = CdlAsignment(lnum, "")
|
||||||
end
|
end
|
||||||
if f == 1 " formula increase it
|
if f == 1 " formula increase it
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,19 +31,19 @@ function! GetChaiScriptIndent()
|
|||||||
let flag = 0
|
let flag = 0
|
||||||
let prevline = getline(lnum)
|
let prevline = getline(lnum)
|
||||||
if prevline =~ '^.*{.*'
|
if prevline =~ '^.*{.*'
|
||||||
let ind = ind + &shiftwidth
|
let ind = ind + shiftwidth()
|
||||||
let flag = 1
|
let flag = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' after lines containing a { followed by a }
|
" Subtract a 'shiftwidth' after lines containing a { followed by a }
|
||||||
" to keep it balanced
|
" to keep it balanced
|
||||||
if flag == 1 && prevline =~ '.*{.*}.*'
|
if flag == 1 && prevline =~ '.*{.*}.*'
|
||||||
let ind = ind - &shiftwidth
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' on lines ending with }
|
" Subtract a 'shiftwidth' on lines ending with }
|
||||||
if getline(v:lnum) =~ '^\s*\%(}\)'
|
if getline(v:lnum) =~ '^\s*\%(}\)'
|
||||||
let ind = ind - &shiftwidth
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -261,7 +261,7 @@ if exists("*searchpairpos")
|
|||||||
call cursor(paren)
|
call cursor(paren)
|
||||||
|
|
||||||
if s:is_method_special_case(paren)
|
if s:is_method_special_case(paren)
|
||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_reader_conditional_special_case(paren)
|
if s:is_reader_conditional_special_case(paren)
|
||||||
@ -299,19 +299,19 @@ if exists("*searchpairpos")
|
|||||||
let ww = s:strip_namespace_and_macro_chars(w)
|
let ww = s:strip_namespace_and_macro_chars(w)
|
||||||
|
|
||||||
if &lispwords =~# '\V\<' . ww . '\>'
|
if &lispwords =~# '\V\<' . ww . '\>'
|
||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:clojure_fuzzy_indent
|
if g:clojure_fuzzy_indent
|
||||||
\ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
|
\ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
|
||||||
\ && s:match_one(g:clojure_fuzzy_indent_patterns, ww)
|
\ && s:match_one(g:clojure_fuzzy_indent_patterns, ww)
|
||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call search('\v\_s', 'cW')
|
call search('\v\_s', 'cW')
|
||||||
call search('\v\S', 'W')
|
call search('\v\S', 'W')
|
||||||
if paren[0] < line(".")
|
if paren[0] < line(".")
|
||||||
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
|
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : shiftwidth() - 1)]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call search('\v\S', 'bW')
|
call search('\v\S', 'bW')
|
||||||
|
@ -68,19 +68,19 @@ fun! CMakeGetIndent(lnum)
|
|||||||
let ind = ind
|
let ind = ind
|
||||||
else
|
else
|
||||||
if previous_line =~? cmake_indent_begin_regex
|
if previous_line =~? cmake_indent_begin_regex
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
if previous_line =~? cmake_indent_open_regex
|
if previous_line =~? cmake_indent_open_regex
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract
|
" Subtract
|
||||||
if this_line =~? cmake_indent_end_regex
|
if this_line =~? cmake_indent_end_regex
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
if previous_line =~? cmake_indent_close_regex
|
if previous_line =~? cmake_indent_close_regex
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -52,11 +52,11 @@ function! s:optionalblock(lnum,ind,blocks,clauses)
|
|||||||
if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin
|
if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin
|
||||||
let ind = indent(lastclause)
|
let ind = indent(lastclause)
|
||||||
elseif lastclause > 0
|
elseif lastclause > 0
|
||||||
let ind = indent(lastclause) + &sw
|
let ind = indent(lastclause) + shiftwidth()
|
||||||
"let ind = ind + &sw
|
"let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~? clauses && cline !~? end
|
elseif line =~? clauses && cline !~? end
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
@ -98,8 +98,8 @@ function! GetCobolIndent(lnum) abort
|
|||||||
let num = matchstr(line,'^\s*\zs\d\+\>')
|
let num = matchstr(line,'^\s*\zs\d\+\>')
|
||||||
if 0+cnum == num
|
if 0+cnum == num
|
||||||
return lindent
|
return lindent
|
||||||
elseif 0+cnum > num && default < lindent + &sw
|
elseif 0+cnum > num && default < lindent + shiftwidth()
|
||||||
let default = lindent + &sw
|
let default = lindent + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif lindent < bshft && lindent >= ashft
|
elseif lindent < bshft && lindent >= ashft
|
||||||
break
|
break
|
||||||
@ -135,13 +135,13 @@ function! GetCobolIndent(lnum) abort
|
|||||||
if line =~? '^PERFORM\>'
|
if line =~? '^PERFORM\>'
|
||||||
let perfline = substitute(line, '\c^PERFORM\s*', "", "")
|
let perfline = substitute(line, '\c^PERFORM\s*', "", "")
|
||||||
if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$'
|
if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
|
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
|
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR')
|
let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR')
|
||||||
let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION')
|
let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION')
|
||||||
@ -157,10 +157,10 @@ function! GetCobolIndent(lnum) abort
|
|||||||
"&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>'
|
"&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>'
|
||||||
let ind = indent(lastclause)
|
let ind = indent(lastclause)
|
||||||
elseif lastclause > 0
|
elseif lastclause > 0
|
||||||
let ind = indent(lastclause) + &sw
|
let ind = indent(lastclause) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~? '^WHEN\>'
|
elseif line =~? '^WHEN\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
"I'm not sure why I had this
|
"I'm not sure why I had this
|
||||||
"if line =~? '^ELSE\>-\@!' && line !~? '\.$'
|
"if line =~? '^ELSE\>-\@!' && line !~? '\.$'
|
||||||
@ -168,7 +168,7 @@ function! GetCobolIndent(lnum) abort
|
|||||||
"endif
|
"endif
|
||||||
if cline =~? '^\(END\)\>-\@!'
|
if cline =~? '^\(END\)\>-\@!'
|
||||||
" On lines with just END, 'guess' a simple shift left
|
" On lines with just END, 'guess' a simple shift left
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!'
|
elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!'
|
||||||
call cursor(a:lnum,indent(a:lnum))
|
call cursor(a:lnum,indent(a:lnum))
|
||||||
let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip)
|
let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip)
|
||||||
@ -209,7 +209,7 @@ function! GetCobolIndent(lnum) abort
|
|||||||
if match > 0
|
if match > 0
|
||||||
let ind = indent(match)
|
let ind = indent(match)
|
||||||
elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>'
|
elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return ind < bshft ? bshft : ind
|
return ind < bshft ? bshft : ind
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Cucumber
|
" Language: Cucumber
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -27,7 +27,7 @@ function! GetCucumberIndent()
|
|||||||
let line = getline(prevnonblank(v:lnum-1))
|
let line = getline(prevnonblank(v:lnum-1))
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
let nline = getline(nextnonblank(v:lnum+1))
|
let nline = getline(nextnonblank(v:lnum+1))
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth()
|
||||||
let syn = s:syn(prevnonblank(v:lnum-1))
|
let syn = s:syn(prevnonblank(v:lnum-1))
|
||||||
let csyn = s:syn(v:lnum)
|
let csyn = s:syn(v:lnum)
|
||||||
let nsyn = s:syn(nextnonblank(v:lnum+1))
|
let nsyn = s:syn(nextnonblank(v:lnum+1))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Dylan
|
" Language: Dylan
|
||||||
" Version: 0.01
|
" Version: 0.01
|
||||||
" Last Change: 2003 Feb 04
|
" Last Change: 2017 Jun 13
|
||||||
" Maintainer: Brent A. Fulgham <bfulgham@debian.org>
|
" Maintainer: Brent A. Fulgham <bfulgham@debian.org>
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -45,13 +45,13 @@ function DylanGetIndent()
|
|||||||
|
|
||||||
" If previous line was a 'define', indent
|
" If previous line was a 'define', indent
|
||||||
if prevline =~? '\(^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)\|\s*\S*\s*=>$\)'
|
if prevline =~? '\(^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)\|\s*\S*\s*=>$\)'
|
||||||
let chg = &sw
|
let chg = shiftwidth()
|
||||||
" local methods indent the shift-width, plus 6 for the 'local'
|
" local methods indent the shift-width, plus 6 for the 'local'
|
||||||
elseif prevline =~? '^\s*local'
|
elseif prevline =~? '^\s*local'
|
||||||
let chg = &sw + 6
|
let chg = shiftwidth() + 6
|
||||||
" If previous line was a let with no closing semicolon, indent
|
" If previous line was a let with no closing semicolon, indent
|
||||||
elseif prevline =~? '^\s*let.*[^;]\s*$'
|
elseif prevline =~? '^\s*let.*[^;]\s*$'
|
||||||
let chg = &sw
|
let chg = shiftwidth()
|
||||||
" If previous line opened a parenthesis, and did not close it, indent
|
" If previous line opened a parenthesis, and did not close it, indent
|
||||||
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
|
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
|
||||||
return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
|
return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
|
||||||
@ -75,13 +75,13 @@ function DylanGetIndent()
|
|||||||
" line doesn't start with an indentable command:
|
" line doesn't start with an indentable command:
|
||||||
let curr_str = getline(curr_line)
|
let curr_str = getline(curr_line)
|
||||||
if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)'
|
if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)'
|
||||||
let chg = &sw
|
let chg = shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If a line starts with end, un-indent (even if we just indented!)
|
" If a line starts with end, un-indent (even if we just indented!)
|
||||||
if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)'
|
if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)'
|
||||||
let chg = chg - &sw
|
let chg = chg - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind + chg
|
return ind + chg
|
||||||
|
@ -669,7 +669,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
|
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
|
||||||
return [1, a:stored_vcol + &sw + 2]
|
return [1, a:stored_vcol + shiftwidth() + 2]
|
||||||
else
|
else
|
||||||
return [1, s:UnexpectedToken(a:token, a:stack)]
|
return [1, s:UnexpectedToken(a:token, a:stack)]
|
||||||
endif
|
endif
|
||||||
@ -678,7 +678,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
|
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
|
||||||
return [1, a:stored_vcol + &sw]
|
return [1, a:stored_vcol + shiftwidth()]
|
||||||
elseif a:stack[0] ==# ';'
|
elseif a:stack[0] ==# ';'
|
||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
@ -797,7 +797,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
|
|
||||||
elseif token ==# 'begin'
|
elseif token ==# 'begin'
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
" case EXPR of BRANCHES end
|
" case EXPR of BRANCHES end
|
||||||
@ -848,11 +848,11 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack == ['->']
|
elseif stack == ['->']
|
||||||
call s:Log(' LTI is in a branch after ' .
|
call s:Log(' LTI is in a branch after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
elseif stack == ['when']
|
elseif stack == ['when']
|
||||||
call s:Log(' LTI is in a guard after ' .
|
call s:Log(' LTI is in a guard after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
else
|
else
|
||||||
return s:UnexpectedToken(token, stack)
|
return s:UnexpectedToken(token, stack)
|
||||||
endif
|
endif
|
||||||
@ -888,7 +888,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching ' .
|
call s:Log(' LTI is in a condition; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# 'align_to_begin_element'
|
elseif stack[0] ==# 'align_to_begin_element'
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol
|
let stored_vcol = curr_vcol
|
||||||
@ -897,23 +897,23 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching ' .
|
call s:Log(' LTI is in a branch; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching ' .
|
call s:Log(' LTI is in a guard; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw + 2
|
let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
elseif token ==# 'fun'
|
elseif token ==# 'fun'
|
||||||
@ -930,7 +930,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" stack = ['when'] => LTI is in a guard
|
" stack = ['when'] => LTI is in a guard
|
||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
call s:Log(' LTI is in a condition; matching "fun" found')
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
|
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
call s:Log(' LTI is in a condition; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
@ -938,15 +938,15 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching "fun" found')
|
call s:Log(' LTI is in a branch; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching "fun" found')
|
call s:Log(' LTI is in a guard; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw + 2
|
let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Pass: we have a function reference (e.g. "fun f/0")
|
" Pass: we have a function reference (e.g. "fun f/0")
|
||||||
@ -1220,7 +1220,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" when A,
|
" when A,
|
||||||
" LTI
|
" LTI
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Example:
|
" Example:
|
||||||
@ -1252,7 +1252,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" If LTI is between an 'after' and the corresponding
|
" If LTI is between an 'after' and the corresponding
|
||||||
" 'end', then let's return
|
" 'end', then let's return
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -47,11 +47,7 @@ set cpo&vim
|
|||||||
|
|
||||||
function! GetErubyIndent(...)
|
function! GetErubyIndent(...)
|
||||||
" The value of a single shift-width
|
" The value of a single shift-width
|
||||||
if exists('*shiftwidth')
|
let sw = shiftwidth()
|
||||||
let sw = shiftwidth()
|
|
||||||
else
|
|
||||||
let sw = &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:0 && a:1 == '.'
|
if a:0 && a:1 == '.'
|
||||||
let v:lnum = line('.')
|
let v:lnum = line('.')
|
||||||
|
@ -339,7 +339,7 @@ function FalconGetIndent(...)
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
if s:Match(lnum, s:block_regex)
|
if s:Match(lnum, s:block_regex)
|
||||||
return indent(s:GetMSL(lnum)) + &sw
|
return indent(s:GetMSL(lnum)) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If it contained hanging closing brackets, find the rightmost one, find its
|
" If it contained hanging closing brackets, find the rightmost one, find its
|
||||||
@ -350,20 +350,20 @@ function FalconGetIndent(...)
|
|||||||
if opening.pos != -1
|
if opening.pos != -1
|
||||||
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||||
if col('.') + 1 == col('$')
|
if col('.') + 1 == col('$')
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
else
|
else
|
||||||
return virtcol('.')
|
return virtcol('.')
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
|
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
|
||||||
return nonspace > 0 ? nonspace : ind + &sw
|
return nonspace > 0 ? nonspace : ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif closing.pos != -1
|
elseif closing.pos != -1
|
||||||
call cursor(lnum, closing.pos + 1)
|
call cursor(lnum, closing.pos + 1)
|
||||||
normal! %
|
normal! %
|
||||||
|
|
||||||
if s:Match(line('.'), s:falcon_indent_keywords)
|
if s:Match(line('.'), s:falcon_indent_keywords)
|
||||||
return indent('.') + &sw
|
return indent('.') + shiftwidth()
|
||||||
else
|
else
|
||||||
return indent('.')
|
return indent('.')
|
||||||
endif
|
endif
|
||||||
@ -392,7 +392,7 @@ function FalconGetIndent(...)
|
|||||||
let col = s:Match(lnum, s:falcon_indent_keywords)
|
let col = s:Match(lnum, s:falcon_indent_keywords)
|
||||||
if col > 0
|
if col > 0
|
||||||
call cursor(lnum, col)
|
call cursor(lnum, col)
|
||||||
let ind = virtcol('.') - 1 + &sw
|
let ind = virtcol('.') - 1 + shiftwidth()
|
||||||
" TODO: make this better (we need to count them) (or, if a searchpair
|
" TODO: make this better (we need to count them) (or, if a searchpair
|
||||||
" fails, we know that something is lacking an end and thus we indent a
|
" fails, we know that something is lacking an end and thus we indent a
|
||||||
" level
|
" level
|
||||||
@ -422,9 +422,9 @@ function FalconGetIndent(...)
|
|||||||
" TODO: this does not take into account contrived things such as
|
" TODO: this does not take into account contrived things such as
|
||||||
" module Foo; class Bar; end
|
" module Foo; class Bar; end
|
||||||
if s:Match(lnum, s:falcon_indent_keywords)
|
if s:Match(lnum, s:falcon_indent_keywords)
|
||||||
let ind = msl_ind + &sw
|
let ind = msl_ind + shiftwidth()
|
||||||
if s:Match(lnum, s:end_end_regex)
|
if s:Match(lnum, s:end_end_regex)
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
@ -433,7 +433,7 @@ function FalconGetIndent(...)
|
|||||||
" closing bracket, indent one extra level.
|
" closing bracket, indent one extra level.
|
||||||
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
|
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
|
||||||
if lnum == p_lnum
|
if lnum == p_lnum
|
||||||
let ind = msl_ind + &sw
|
let ind = msl_ind + shiftwidth()
|
||||||
else
|
else
|
||||||
let ind = msl_ind
|
let ind = msl_ind
|
||||||
endif
|
endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: git config file
|
" Language: git config file
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -20,7 +20,7 @@ if exists("*GetGitconfigIndent")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! GetGitconfigIndent()
|
function! GetGitconfigIndent()
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
let line = getline(prevnonblank(v:lnum-1))
|
let line = getline(prevnonblank(v:lnum-1))
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
if line =~ '\\\@<!\%(\\\\\)*\\$'
|
if line =~ '\\\@<!\%(\\\\\)*\\$'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: gitolite configuration
|
" Language: gitolite configuration
|
||||||
" URL: https://github.com/tmatilai/gitolite.vim
|
" URL: https://github.com/tmatilai/gitolite.vim
|
||||||
" Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>
|
" Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>
|
||||||
" Last Change: 2011-12-24
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -27,11 +27,11 @@ function! GetGitoliteIndent()
|
|||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
|
|
||||||
if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
|
if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif cline =~ '^\s*config\s'
|
elseif cline =~ '^\s*config\s'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif cline =~ '^\s*#'
|
elseif cline =~ '^\s*#'
|
||||||
return indent(prevln)
|
return indent(prevln)
|
||||||
elseif cline =~ '^\s*$'
|
elseif cline =~ '^\s*$'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Go
|
" Language: Go
|
||||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
|
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
|
||||||
" Last Change: 2014 Aug 16
|
" Last Change: 2017 Jun 13
|
||||||
"
|
"
|
||||||
" TODO:
|
" TODO:
|
||||||
" - function invocations split across lines
|
" - function invocations split across lines
|
||||||
@ -23,18 +23,6 @@ if exists('*GoIndent')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The shiftwidth() function is relatively new.
|
|
||||||
" Don't require it to exist.
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
function s:sw() abort
|
|
||||||
return shiftwidth()
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function s:sw() abort
|
|
||||||
return &shiftwidth
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! GoIndent(lnum)
|
function! GoIndent(lnum)
|
||||||
let l:prevlnum = prevnonblank(a:lnum-1)
|
let l:prevlnum = prevnonblank(a:lnum-1)
|
||||||
if l:prevlnum == 0
|
if l:prevlnum == 0
|
||||||
@ -51,17 +39,17 @@ function! GoIndent(lnum)
|
|||||||
|
|
||||||
if l:prevl =~ '[({]\s*$'
|
if l:prevl =~ '[({]\s*$'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
if l:prevl =~# '^\s*\(case .*\|default\):$'
|
if l:prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
" previous line is part of a switch statement
|
" previous line is part of a switch statement
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
" TODO: handle if the previous line is a label.
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
if l:thisl =~ '^\s*[)}]'
|
if l:thisl =~ '^\s*[)}]'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let l:ind -= s:sw()
|
let l:ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Colons are tricky.
|
" Colons are tricky.
|
||||||
@ -69,7 +57,7 @@ function! GoIndent(lnum)
|
|||||||
" We ignore trying to deal with jump labels because (a) they're rare, and
|
" We ignore trying to deal with jump labels because (a) they're rare, and
|
||||||
" (b) they're hard to disambiguate from a composite literal key.
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
if l:thisl =~# '^\s*\(case .*\|default\):$'
|
if l:thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
let l:ind -= s:sw()
|
let l:ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:ind
|
return l:ind
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Haml
|
" Language: Haml
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -37,7 +37,7 @@ function! GetHamlIndent()
|
|||||||
let line = substitute(line,'^\s\+','','')
|
let line = substitute(line,'^\s\+','','')
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
let cindent = indent(v:lnum)
|
let cindent = indent(v:lnum)
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
||||||
let indent = cindent < indent ? cindent : indent - sw
|
let indent = cindent < indent ? cindent : indent - sw
|
||||||
endif
|
endif
|
||||||
|
@ -27,13 +27,13 @@ function HamGetIndent(lnum)
|
|||||||
" Add a shiftwidth to statements following if, else, elseif,
|
" Add a shiftwidth to statements following if, else, elseif,
|
||||||
" case, select, default, do, until, while, for, start
|
" case, select, default, do, until, while, for, start
|
||||||
if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
|
if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a shiftwidth from else, elseif, end(if|while|for), until
|
" Subtract a shiftwidth from else, elseif, end(if|while|for), until
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
|
if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -47,7 +47,7 @@ function GetHogIndent()
|
|||||||
" Continuation of a line that wasn't indented
|
" Continuation of a line that wasn't indented
|
||||||
let prevline = getline(prevlnum)
|
let prevline = getline(prevlnum)
|
||||||
if prevline =~ '^\k\+.*\\\s*$'
|
if prevline =~ '^\k\+.*\\\s*$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Continuation of a line that was indented
|
" Continuation of a line that was indented
|
||||||
@ -58,13 +58,13 @@ function GetHogIndent()
|
|||||||
" Indent the next line if previous line contained a start of a block
|
" Indent the next line if previous line contained a start of a block
|
||||||
" definition ('{' or '(').
|
" definition ('{' or '(').
|
||||||
if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$'
|
if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Match inside of a block
|
" Match inside of a block
|
||||||
if s:IsInBlock(v:lnum)
|
if s:IsInBlock(v:lnum)
|
||||||
if prevline =~ "^\k\+.*$"
|
if prevline =~ "^\k\+.*$"
|
||||||
return &sw
|
return shiftwidth()
|
||||||
else
|
else
|
||||||
return indent(prevlnum)
|
return indent(prevlnum)
|
||||||
endif
|
endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Header: "{{{
|
" Header: "{{{
|
||||||
" Maintainer: Bram Moolenaar
|
" Maintainer: Bram Moolenaar
|
||||||
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
||||||
" Last Change: 2017 Jan 17
|
" Last Change: 2017 Jun 13
|
||||||
" Version: 1.0
|
" Version: 1.0
|
||||||
" Description: HTML indent script with cached state for faster indenting on a
|
" Description: HTML indent script with cached state for faster indenting on a
|
||||||
" range of lines.
|
" range of lines.
|
||||||
@ -51,15 +51,6 @@ if exists("*HtmlIndent") && !exists('g:force_reload_html')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" shiftwidth() exists since patch 7.3.694
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
let s:ShiftWidth = function('shiftwidth')
|
|
||||||
else
|
|
||||||
func! s:ShiftWidth()
|
|
||||||
return &shiftwidth
|
|
||||||
endfunc
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Allow for line continuation below.
|
" Allow for line continuation below.
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo-=C
|
set cpo-=C
|
||||||
@ -123,7 +114,7 @@ func! HtmlIndent_CheckUserSettings()
|
|||||||
|
|
||||||
let indone = {"zero": 0
|
let indone = {"zero": 0
|
||||||
\,"auto": "indent(prevnonblank(v:lnum-1))"
|
\,"auto": "indent(prevnonblank(v:lnum-1))"
|
||||||
\,"inc": "b:hi_indent.blocktagind + s:ShiftWidth()"}
|
\,"inc": "b:hi_indent.blocktagind + shiftwidth()"}
|
||||||
|
|
||||||
let script1 = ''
|
let script1 = ''
|
||||||
if exists("b:html_indent_script1")
|
if exists("b:html_indent_script1")
|
||||||
@ -358,7 +349,7 @@ func! s:CheckBlockTag(blocktag, ind)
|
|||||||
endif
|
endif
|
||||||
let b:hi_newstate.blocklnr = v:lnum
|
let b:hi_newstate.blocklnr = v:lnum
|
||||||
" save allover indent for the endtag
|
" save allover indent for the endtag
|
||||||
let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth()
|
let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * shiftwidth()
|
||||||
if a:ind == 3
|
if a:ind == 3
|
||||||
return "SCRIPT" " all except this must be lowercase
|
return "SCRIPT" " all except this must be lowercase
|
||||||
" line is to be checked again for the type attribute
|
" line is to be checked again for the type attribute
|
||||||
@ -480,7 +471,7 @@ func! s:FreshState(lnum)
|
|||||||
let state.blocklnr = stopline
|
let state.blocklnr = stopline
|
||||||
" check preceding tags in the line:
|
" check preceding tags in the line:
|
||||||
call s:CountITags(tagline[: stopcol-2])
|
call s:CountITags(tagline[: stopcol-2])
|
||||||
let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth()
|
let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * shiftwidth()
|
||||||
return state
|
return state
|
||||||
elseif stopline == state.lnum
|
elseif stopline == state.lnum
|
||||||
" handle special case: previous line (= state.lnum) contains a
|
" handle special case: previous line (= state.lnum) contains a
|
||||||
@ -490,7 +481,7 @@ func! s:FreshState(lnum)
|
|||||||
if !swendtag
|
if !swendtag
|
||||||
let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW")
|
let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW")
|
||||||
call s:CountITags(tolower(getline(bline)[: bcol-2]))
|
call s:CountITags(tolower(getline(bline)[: bcol-2]))
|
||||||
let state.baseindent = indent(bline) + (s:curind + s:nextrel) * s:ShiftWidth()
|
let state.baseindent = indent(bline) + (s:curind + s:nextrel) * shiftwidth()
|
||||||
return state
|
return state
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -511,7 +502,7 @@ func! s:FreshState(lnum)
|
|||||||
if found == 2
|
if found == 2
|
||||||
let state.baseindent = b:hi_indent.baseindent
|
let state.baseindent = b:hi_indent.baseindent
|
||||||
endif
|
endif
|
||||||
let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth()
|
let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth()
|
||||||
return state
|
return state
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -530,7 +521,7 @@ func! s:FreshState(lnum)
|
|||||||
let text = tolower(getline(comlnum)[: comcol-2])
|
let text = tolower(getline(comlnum)[: comcol-2])
|
||||||
endif
|
endif
|
||||||
call s:CountITags(text)
|
call s:CountITags(text)
|
||||||
let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth()
|
let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth()
|
||||||
" TODO check tags that follow "-->"
|
" TODO check tags that follow "-->"
|
||||||
return state
|
return state
|
||||||
endif
|
endif
|
||||||
@ -550,9 +541,9 @@ func! s:FreshState(lnum)
|
|||||||
let text = getline(start_lnum)
|
let text = getline(start_lnum)
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(text[: col('.') - 2])
|
call s:CountITags(text[: col('.') - 2])
|
||||||
let state.baseindent += s:nextrel * s:ShiftWidth()
|
let state.baseindent += s:nextrel * shiftwidth()
|
||||||
if !swendtag
|
if !swendtag
|
||||||
let state.baseindent += s:curind * s:ShiftWidth()
|
let state.baseindent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return state
|
return state
|
||||||
@ -565,9 +556,9 @@ func! s:FreshState(lnum)
|
|||||||
let text = getline(state.lnum)
|
let text = getline(state.lnum)
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(tolower(text))
|
call s:CountITags(tolower(text))
|
||||||
let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth()
|
let state.baseindent = indent(state.lnum) + s:nextrel * shiftwidth()
|
||||||
if !swendtag
|
if !swendtag
|
||||||
let state.baseindent += s:curind * s:ShiftWidth()
|
let state.baseindent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
return state
|
return state
|
||||||
endfunc "}}}
|
endfunc "}}}
|
||||||
@ -646,7 +637,7 @@ func! s:CSSIndent()
|
|||||||
|
|
||||||
" add indent after {
|
" add indent after {
|
||||||
let brace_counts = HtmlIndent_CountBraces(prev_lnum)
|
let brace_counts = HtmlIndent_CountBraces(prev_lnum)
|
||||||
let extra = brace_counts.c_open * s:ShiftWidth()
|
let extra = brace_counts.c_open * shiftwidth()
|
||||||
|
|
||||||
let prev_text = getline(prev_lnum)
|
let prev_text = getline(prev_lnum)
|
||||||
let below_end_brace = prev_text =~ '}\s*$'
|
let below_end_brace = prev_text =~ '}\s*$'
|
||||||
@ -663,7 +654,7 @@ func! s:CSSIndent()
|
|||||||
" if the current line is not a comment or starts with @ (used by template
|
" if the current line is not a comment or starts with @ (used by template
|
||||||
" systems) reduce indent if previous line is a continuation line
|
" systems) reduce indent if previous line is a continuation line
|
||||||
if !prev_hasfield && !prev_special
|
if !prev_hasfield && !prev_special
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
|
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
|
||||||
@ -671,14 +662,14 @@ func! s:CSSIndent()
|
|||||||
if !cur_hasfield && (prev_hasfield || prev_unfinished)
|
if !cur_hasfield && (prev_hasfield || prev_unfinished)
|
||||||
" Continuation line has extra indent if the previous line was not a
|
" Continuation line has extra indent if the previous line was not a
|
||||||
" continuation line.
|
" continuation line.
|
||||||
let extra = s:ShiftWidth()
|
let extra = shiftwidth()
|
||||||
" Align with @if
|
" Align with @if
|
||||||
if prev_text =~ '^\s*@if '
|
if prev_text =~ '^\s*@if '
|
||||||
let extra = 4
|
let extra = 4
|
||||||
endif
|
endif
|
||||||
elseif cur_hasfield && !prev_hasfield && !prev_special
|
elseif cur_hasfield && !prev_hasfield && !prev_special
|
||||||
" less indent below a continuation line
|
" less indent below a continuation line
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -699,10 +690,10 @@ func! s:CSSIndent()
|
|||||||
if special
|
if special
|
||||||
" do not reduce indent below @{ ... }
|
" do not reduce indent below @{ ... }
|
||||||
if extra < 0
|
if extra < 0
|
||||||
let extra += s:ShiftWidth()
|
let extra += shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * s:ShiftWidth()
|
let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -710,10 +701,10 @@ func! s:CSSIndent()
|
|||||||
if extra == 0
|
if extra == 0
|
||||||
if brace_counts.p_open > brace_counts.p_close
|
if brace_counts.p_open > brace_counts.p_close
|
||||||
" previous line has more ( than ): add a shiftwidth
|
" previous line has more ( than ): add a shiftwidth
|
||||||
let extra = s:ShiftWidth()
|
let extra = shiftwidth()
|
||||||
elseif brace_counts.p_open < brace_counts.p_close
|
elseif brace_counts.p_open < brace_counts.p_close
|
||||||
" previous line has more ) than (: subtract a shiftwidth
|
" previous line has more ) than (: subtract a shiftwidth
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -816,7 +807,7 @@ func! s:Alien5()
|
|||||||
let idx = match(prevtext, '^\s*\zs<!--')
|
let idx = match(prevtext, '^\s*\zs<!--')
|
||||||
if idx >= 0
|
if idx >= 0
|
||||||
" just below comment start, add a shiftwidth
|
" just below comment start, add a shiftwidth
|
||||||
return idx + s:ShiftWidth()
|
return idx + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Some files add 4 spaces just below a TODO line. It's difficult to detect
|
" Some files add 4 spaces just below a TODO line. It's difficult to detect
|
||||||
@ -837,7 +828,7 @@ func! s:Alien6()
|
|||||||
return indent(lnum)
|
return indent(lnum)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return b:hi_indent.baseindent + s:ShiftWidth()
|
return b:hi_indent.baseindent + shiftwidth()
|
||||||
endfunc "}}}
|
endfunc "}}}
|
||||||
|
|
||||||
" When the "lnum" line ends in ">" find the line containing the matching "<".
|
" When the "lnum" line ends in ">" find the line containing the matching "<".
|
||||||
@ -947,7 +938,7 @@ func! HtmlIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let curtext = tolower(getline(v:lnum))
|
let curtext = tolower(getline(v:lnum))
|
||||||
let indentunit = s:ShiftWidth()
|
let indentunit = shiftwidth()
|
||||||
|
|
||||||
let b:hi_newstate = {}
|
let b:hi_newstate = {}
|
||||||
let b:hi_newstate.lnum = v:lnum
|
let b:hi_newstate.lnum = v:lnum
|
||||||
@ -1030,9 +1021,9 @@ func! HtmlIndent()
|
|||||||
if col('.') > 2
|
if col('.') > 2
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(text[: col('.') - 2])
|
call s:CountITags(text[: col('.') - 2])
|
||||||
let indent += s:nextrel * s:ShiftWidth()
|
let indent += s:nextrel * shiftwidth()
|
||||||
if !swendtag
|
if !swendtag
|
||||||
let indent += s:curind * s:ShiftWidth()
|
let indent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" IDL (Interactive Data Language) indent file.
|
" IDL (Interactive Data Language) indent file.
|
||||||
" Language: IDL (ft=idlang)
|
" Language: IDL (ft=idlang)
|
||||||
" Last change: 2012 May 18
|
" Last change: 2017 Jun 13
|
||||||
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
|
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -34,25 +34,25 @@ function GetIdlangIndent(lnum)
|
|||||||
" Indenting of continued lines.
|
" Indenting of continued lines.
|
||||||
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
|
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
|
||||||
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
|
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
|
||||||
let curind = curind+&sw
|
let curind = curind+shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
|
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
|
||||||
let curind = curind-&sw
|
let curind = curind-shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indenting blocks of statements.
|
" Indenting blocks of statements.
|
||||||
if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
|
if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
|
||||||
if getline(pnum) =~? 'begin\>'
|
if getline(pnum) =~? 'begin\>'
|
||||||
elseif indent(v:lnum) > curind-&sw
|
elseif indent(v:lnum) > curind-shiftwidth()
|
||||||
let curind = curind-&sw
|
let curind = curind-shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
elseif getline(pnum) =~? 'begin\>'
|
elseif getline(pnum) =~? 'begin\>'
|
||||||
if indent(v:lnum) < curind+&sw
|
if indent(v:lnum) < curind+shiftwidth()
|
||||||
let curind = curind+&sw
|
let curind = curind+shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
@ -50,17 +50,17 @@ fun! GetIshdIndent(lnum)
|
|||||||
|
|
||||||
" Add
|
" Add
|
||||||
if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
|
if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract
|
" Subtract
|
||||||
if this_line =~ '^\s*\<endswitch\>'
|
if this_line =~ '^\s*\<endswitch\>'
|
||||||
let ind = ind - 2 * &sw
|
let ind = ind - 2 * shiftwidth()
|
||||||
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
|
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif this_line =~ '^\s*\<\(case\|default\)\>'
|
elseif this_line =~ '^\s*\<\(case\|default\)\>'
|
||||||
if previous_line !~ '^\s*\<switch\>'
|
if previous_line !~ '^\s*\<switch\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -236,9 +236,10 @@ function s:OneScope(lnum)
|
|||||||
\ s:save_pos('s:previous_token') != '.'
|
\ s:save_pos('s:previous_token') != '.'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
|
" returns braceless levels started by 'i' and above lines * shiftwidth().
|
||||||
" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
|
" 'num' is the lineNr which encloses the entire context, 'cont' if whether
|
||||||
" a continued expression, which could have started in a braceless context
|
" line 'i' + 1 is a continued expression, which could have started in a
|
||||||
|
" braceless context
|
||||||
function s:iscontOne(i,num,cont)
|
function s:iscontOne(i,num,cont)
|
||||||
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
|
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
|
||||||
let pind = a:num ? indent(l:num) + s:W : 0
|
let pind = a:num ? indent(l:num) + s:W : 0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: JSON
|
" Language: JSON
|
||||||
" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
||||||
" Last Change: 2014 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
|
" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
|
||||||
" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
|
" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
|
||||||
" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
|
" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
|
||||||
@ -141,7 +141,7 @@ function GetJSONIndent()
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
" if s:Match(lnum, s:block_regex)
|
" if s:Match(lnum, s:block_regex)
|
||||||
" return indent(lnum) + &sw
|
" return indent(lnum) + shiftwidth()
|
||||||
" endif
|
" endif
|
||||||
|
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
" If the previous line contained an opening bracket, and we are still in it,
|
||||||
@ -149,7 +149,7 @@ function GetJSONIndent()
|
|||||||
if line =~ '[[({]'
|
if line =~ '[[({]'
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
else
|
else
|
||||||
call cursor(v:lnum, vcol)
|
call cursor(v:lnum, vcol)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Liquid
|
" Language: Liquid
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
@ -54,7 +54,7 @@ function! GetLiquidIndent(...)
|
|||||||
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
||||||
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
|
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
|
||||||
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
|
let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
|
||||||
let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
|
let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
|
||||||
let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
|
let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
|
||||||
|
@ -38,24 +38,24 @@ function! GetLogtalkIndent()
|
|||||||
endif
|
endif
|
||||||
" Check for entity opening directive on previous line
|
" Check for entity opening directive on previous line
|
||||||
if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
|
if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" Check for clause head on previous line
|
" Check for clause head on previous line
|
||||||
elseif pline =~ ':-\s*\(%.*\)\?$'
|
elseif pline =~ ':-\s*\(%.*\)\?$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" Check for entity closing directive on previous line
|
" Check for entity closing directive on previous line
|
||||||
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
|
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
" Check for end of clause on previous line
|
" Check for end of clause on previous line
|
||||||
elseif pline =~ '\.\s*\(%.*\)\?$'
|
elseif pline =~ '\.\s*\(%.*\)\?$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for opening conditional on previous line
|
" Check for opening conditional on previous line
|
||||||
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
|
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for closing an unclosed paren, or middle ; or ->
|
" Check for closing an unclosed paren, or middle ; or ->
|
||||||
if line =~ '^\s*\([);]\|->\)'
|
if line =~ '^\s*\([);]\|->\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: Lua script
|
" Language: Lua script
|
||||||
" Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br>
|
" Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br>
|
||||||
" First Author: Max Ischenko <mfi 'at' ukr.net>
|
" First Author: Max Ischenko <mfi 'at' ukr.net>
|
||||||
" Last Change: 2016 Jan 10
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
@ -48,7 +48,7 @@ function! GetLuaIndent()
|
|||||||
" Add 'shiftwidth' if what we found previously is not in a comment and
|
" Add 'shiftwidth' if what we found previously is not in a comment and
|
||||||
" an "end" or "until" is not present on the same line.
|
" an "end" or "until" is not present on the same line.
|
||||||
if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "luaComment" && prevline !~ '\<end\>\|\<until\>'
|
if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "luaComment" && prevline !~ '\<end\>\|\<until\>'
|
||||||
let ind = ind + &shiftwidth
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ function! GetLuaIndent()
|
|||||||
" This is the part that requires 'indentkeys'.
|
" This is the part that requires 'indentkeys'.
|
||||||
let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)')
|
let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)')
|
||||||
if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment"
|
if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment"
|
||||||
let ind = ind - &shiftwidth
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -44,9 +44,9 @@ function GetMatlabIndent(lnum)
|
|||||||
" See if this line does not follow the line right after an openblock
|
" See if this line does not follow the line right after an openblock
|
||||||
if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
|
if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
|
||||||
" See if the user has already dedented
|
" See if the user has already dedented
|
||||||
elseif indent(v:lnum) > curind - &sw
|
elseif indent(v:lnum) > curind - shiftwidth()
|
||||||
" If not, recommend one dedent
|
" If not, recommend one dedent
|
||||||
let curind = curind - &sw
|
let curind = curind - shiftwidth()
|
||||||
else
|
else
|
||||||
" Otherwise, trust the user
|
" Otherwise, trust the user
|
||||||
return -1
|
return -1
|
||||||
@ -56,9 +56,9 @@ function GetMatlabIndent(lnum)
|
|||||||
" If the previous line opened a block
|
" If the previous line opened a block
|
||||||
elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
|
elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
|
||||||
" See if the user has already indented
|
" See if the user has already indented
|
||||||
if indent(v:lnum) < curind + &sw
|
if indent(v:lnum) < curind + shiftwidth()
|
||||||
"If not, recommend indent
|
"If not, recommend indent
|
||||||
let curind = curind + &sw
|
let curind = curind + shiftwidth()
|
||||||
else
|
else
|
||||||
" Otherwise, trust the user
|
" Otherwise, trust the user
|
||||||
return -1
|
return -1
|
||||||
|
@ -49,7 +49,7 @@ function GetMmaIndent()
|
|||||||
" also, indent only if this line if this line isn't starting a new
|
" also, indent only if this line if this line isn't starting a new
|
||||||
" block... TODO - fix this with indentkeys?
|
" block... TODO - fix this with indentkeys?
|
||||||
if getline(v:lnum-1) =~ '\\\@<!\%(\[[^\]]*\|([^)]*\|{[^}]*\)$' && getline(v:lnum) !~ '\s\+[\[({]'
|
if getline(v:lnum-1) =~ '\\\@<!\%(\[[^\]]*\|([^)]*\|{[^}]*\)$' && getline(v:lnum) !~ '\s\+[\[({]'
|
||||||
let ind = ind+&sw
|
let ind = ind+shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" if this line had unmatched closing block,
|
" if this line had unmatched closing block,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
" Mike Leary <leary@nwlink.com>
|
" Mike Leary <leary@nwlink.com>
|
||||||
" Markus Mottl <markus.mottl@gmail.com>
|
" Markus Mottl <markus.mottl@gmail.com>
|
||||||
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
|
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
|
||||||
" Last Change: 2013 Jun 29
|
" Last Change: 2017 Jun 13
|
||||||
" 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
|
" 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
|
||||||
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
|
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
|
||||||
" 2013 June - commented textwidth (Marc Weber)
|
" 2013 June - commented textwidth (Marc Weber)
|
||||||
@ -101,7 +101,7 @@ function! GetOCamlIndent()
|
|||||||
|
|
||||||
" Return double 'shiftwidth' after lines matching:
|
" Return double 'shiftwidth' after lines matching:
|
||||||
if lline =~ '^\s*|.*->\s*$'
|
if lline =~ '^\s*|.*->\s*$'
|
||||||
return ind + &sw + &sw
|
return ind + 2 * shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
@ -172,7 +172,7 @@ function! GetOCamlIndent()
|
|||||||
" Indent if current line begins with 'and':
|
" Indent if current line begins with 'and':
|
||||||
elseif line =~ '^\s*and\>'
|
elseif line =~ '^\s*and\>'
|
||||||
if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
|
if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent if current line begins with 'with':
|
" Indent if current line begins with 'with':
|
||||||
@ -199,14 +199,14 @@ function! GetOCamlIndent()
|
|||||||
" or 'method':
|
" or 'method':
|
||||||
elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>'
|
elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>'
|
||||||
if lline !~ s:obj
|
if lline !~ s:obj
|
||||||
return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + &sw
|
return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Add a 'shiftwidth' after lines ending with:
|
" Add a 'shiftwidth' after lines ending with:
|
||||||
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
|
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
|
|
||||||
" Back to normal indent after lines ending with ';;':
|
" Back to normal indent after lines ending with ';;':
|
||||||
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
|
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
|
||||||
@ -263,7 +263,7 @@ function! GetOCamlIndent()
|
|||||||
|
|
||||||
" Subtract a 'shiftwidth' after lines matching 'match ... with parser':
|
" Subtract a 'shiftwidth' after lines matching 'match ... with parser':
|
||||||
if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$'
|
if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -131,7 +131,7 @@ function GetOccamIndent()
|
|||||||
if line =~ s:FirstLevelIndent || (line =~ s:FirstLevelNonColonEndIndent && line !~ s:ColonEnd)
|
if line =~ s:FirstLevelIndent || (line =~ s:FirstLevelNonColonEndIndent && line !~ s:ColonEnd)
|
||||||
\ || (line !~ s:ColonStart && (prevline =~ s:SecondLevelIndent
|
\ || (line !~ s:ColonStart && (prevline =~ s:SecondLevelIndent
|
||||||
\ || (prevline =~ s:SecondLevelNonColonEndIndent && prevline !~ s:ColonEnd)))
|
\ || (prevline =~ s:SecondLevelNonColonEndIndent && prevline !~ s:ColonEnd)))
|
||||||
let curindent = curindent + &shiftwidth
|
let curindent = curindent + shiftwidth()
|
||||||
|
|
||||||
" Restore magic
|
" Restore magic
|
||||||
if !save_magic|setlocal nomagic|endif
|
if !save_magic|setlocal nomagic|endif
|
||||||
@ -153,7 +153,7 @@ function GetOccamIndent()
|
|||||||
|
|
||||||
while !found
|
while !found
|
||||||
|
|
||||||
if indent(prevlinenum) == curindent - &shiftwidth
|
if indent(prevlinenum) == curindent - shiftwidth()
|
||||||
let found = 1
|
let found = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ function GetOccamIndent()
|
|||||||
|
|
||||||
if prevlinenum > 0
|
if prevlinenum > 0
|
||||||
if getline(prevlinenum) =~ s:SecondLevelIndent
|
if getline(prevlinenum) =~ s:SecondLevelIndent
|
||||||
let curindent = curindent + &shiftwidth
|
let curindent = curindent + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: Pascal
|
" Language: Pascal
|
||||||
" Maintainer: Neil Carter <n.carter@swansea.ac.uk>
|
" Maintainer: Neil Carter <n.carter@swansea.ac.uk>
|
||||||
" Created: 2004 Jul 13
|
" Created: 2004 Jul 13
|
||||||
" Last Change: 2011 Apr 01
|
" Last Change: 2017 Jun 13
|
||||||
"
|
"
|
||||||
" This is version 2.0, a complete rewrite.
|
" This is version 2.0, a complete rewrite.
|
||||||
"
|
"
|
||||||
@ -102,12 +102,12 @@ function! GetPascalIndent( line_num )
|
|||||||
|
|
||||||
" If the PREVIOUS LINE ended in these items, always indent
|
" If the PREVIOUS LINE ended in these items, always indent
|
||||||
if prev_codeline =~ '\<\(type\|const\|var\)$'
|
if prev_codeline =~ '\<\(type\|const\|var\)$'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if prev_codeline =~ '\<repeat$'
|
if prev_codeline =~ '\<repeat$'
|
||||||
if this_codeline !~ '^\s*until\>'
|
if this_codeline !~ '^\s*until\>'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
else
|
else
|
||||||
return indnt
|
return indnt
|
||||||
endif
|
endif
|
||||||
@ -115,7 +115,7 @@ function! GetPascalIndent( line_num )
|
|||||||
|
|
||||||
if prev_codeline =~ '\<\(begin\|record\)$'
|
if prev_codeline =~ '\<\(begin\|record\)$'
|
||||||
if this_codeline !~ '^\s*end\>'
|
if this_codeline !~ '^\s*end\>'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
else
|
else
|
||||||
return indnt
|
return indnt
|
||||||
endif
|
endif
|
||||||
@ -125,10 +125,10 @@ function! GetPascalIndent( line_num )
|
|||||||
" followed by "begin"
|
" followed by "begin"
|
||||||
if prev_codeline =~ '\<\(\|else\|then\|do\)$' || prev_codeline =~ ':$'
|
if prev_codeline =~ '\<\(\|else\|then\|do\)$' || prev_codeline =~ ':$'
|
||||||
if this_codeline !~ '^\s*begin\>'
|
if this_codeline !~ '^\s*begin\>'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
else
|
else
|
||||||
" If it does start with "begin" then keep the same indent
|
" If it does start with "begin" then keep the same indent
|
||||||
"return indnt + &shiftwidth
|
"return indnt + shiftwidth()
|
||||||
return indnt
|
return indnt
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -137,7 +137,7 @@ function! GetPascalIndent( line_num )
|
|||||||
" only the line before the current one. TODO: Get it working for
|
" only the line before the current one. TODO: Get it working for
|
||||||
" parameter lists longer than two lines.
|
" parameter lists longer than two lines.
|
||||||
if prev_codeline =~ '([^)]\+$'
|
if prev_codeline =~ '([^)]\+$'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ function! GetPascalIndent( line_num )
|
|||||||
" Lines starting with "else", but not following line ending with
|
" Lines starting with "else", but not following line ending with
|
||||||
" "end".
|
" "end".
|
||||||
if this_codeline =~ '^\s*else\>' && prev_codeline !~ '\<end$'
|
if this_codeline =~ '^\s*else\>' && prev_codeline !~ '\<end$'
|
||||||
return indnt - &shiftwidth
|
return indnt - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Lines after a single-statement branch/loop.
|
" Lines after a single-statement branch/loop.
|
||||||
@ -160,16 +160,16 @@ function! GetPascalIndent( line_num )
|
|||||||
" additional unindentation.
|
" additional unindentation.
|
||||||
if this_codeline =~ '^\s*\(end;\|except\|finally\|\)$'
|
if this_codeline =~ '^\s*\(end;\|except\|finally\|\)$'
|
||||||
" Note that we don't return from here.
|
" Note that we don't return from here.
|
||||||
return indnt - &shiftwidth - &shiftwidth
|
return indnt - 2 * shiftwidth()
|
||||||
endif
|
endif
|
||||||
return indnt - &shiftwidth
|
return indnt - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Lines starting with "until" or "end". This rule must be overridden
|
" Lines starting with "until" or "end". This rule must be overridden
|
||||||
" by the one for "end" after a single-statement branch/loop. In
|
" by the one for "end" after a single-statement branch/loop. In
|
||||||
" other words that rule should come before this one.
|
" other words that rule should come before this one.
|
||||||
if this_codeline =~ '^\s*\(end\|until\)\>'
|
if this_codeline =~ '^\s*\(end\|until\)\>'
|
||||||
return indnt - &shiftwidth
|
return indnt - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ function! GetPascalIndent( line_num )
|
|||||||
|
|
||||||
" If the PREVIOUS LINE ended in these items, always indent.
|
" If the PREVIOUS LINE ended in these items, always indent.
|
||||||
if prev_codeline =~ '^\s*\(unit\|uses\|try\|except\|finally\|private\|protected\|public\|published\)$'
|
if prev_codeline =~ '^\s*\(unit\|uses\|try\|except\|finally\|private\|protected\|public\|published\)$'
|
||||||
return indnt + &shiftwidth
|
return indnt + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ???? Indent "procedure" and "functions" if they appear within an
|
" ???? Indent "procedure" and "functions" if they appear within an
|
||||||
@ -212,11 +212,11 @@ function! GetPascalIndent( line_num )
|
|||||||
" UNINDENT ONCE
|
" UNINDENT ONCE
|
||||||
|
|
||||||
if this_codeline =~ '^\s*\(except\|finally\)$'
|
if this_codeline =~ '^\s*\(except\|finally\)$'
|
||||||
return indnt - &shiftwidth
|
return indnt - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$'
|
if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$'
|
||||||
return indnt - &shiftwidth
|
return indnt - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
" Last Change: 2013-07-24
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
" Suggestions and improvements by :
|
" Suggestions and improvements by :
|
||||||
" Aaron J. Sherman (use syntax for hints)
|
" Aaron J. Sherman (use syntax for hints)
|
||||||
@ -138,9 +138,9 @@ function! GetPerlIndent()
|
|||||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
let brace = strpart(line, bracepos, 1)
|
let brace = strpart(line, bracepos, 1)
|
||||||
if brace == '(' || brace == '{' || brace == '['
|
if brace == '(' || brace == '{' || brace == '['
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
else
|
else
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let bracepos = match(line, braceclass, bracepos + 1)
|
let bracepos = match(line, braceclass, bracepos + 1)
|
||||||
@ -152,25 +152,25 @@ function! GetPerlIndent()
|
|||||||
\ || synid == "perlMatchStartEnd"
|
\ || synid == "perlMatchStartEnd"
|
||||||
\ || synid == "perlBraces"
|
\ || synid == "perlBraces"
|
||||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
if cline =~ '^\s*[])}]'
|
if cline =~ '^\s*[])}]'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent lines that begin with 'or' or 'and'
|
" Indent lines that begin with 'or' or 'and'
|
||||||
if cline =~ '^\s*\(or\|and\)\>'
|
if cline =~ '^\s*\(or\|and\)\>'
|
||||||
if line !~ '^\s*\(or\|and\)\>'
|
if line !~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(or\|and\)\>'
|
elseif line =~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
" Last Change: 2013-07-21
|
" Last Change: 2017 Jun 13
|
||||||
" Contributors: Andy Lester <andy@petdance.com>
|
" Contributors: Andy Lester <andy@petdance.com>
|
||||||
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
||||||
"
|
"
|
||||||
@ -107,19 +107,19 @@ function! GetPerl6Indent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
|
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
if cline =~ '^\s*[)}\]»>]'
|
if cline =~ '^\s*[)}\]»>]'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent lines that begin with 'or' or 'and'
|
" Indent lines that begin with 'or' or 'and'
|
||||||
if cline =~ '^\s*\(or\|and\)\>'
|
if cline =~ '^\s*\(or\|and\)\>'
|
||||||
if line !~ '^\s*\(or\|and\)\>'
|
if line !~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(or\|and\)\>'
|
elseif line =~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
||||||
" URL: http://www.2072productions.com/vim/indent/php.vim
|
" URL: http://www.2072productions.com/vim/indent/php.vim
|
||||||
" Home: https://github.com/2072/PHP-Indenting-for-VIm
|
" Home: https://github.com/2072/PHP-Indenting-for-VIm
|
||||||
" Last Change: 2017 March 12th
|
" Last Change: 2017 Jun 13
|
||||||
" Version: 1.62
|
" Version: 1.62
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
@ -50,25 +50,15 @@ let b:did_indent = 1
|
|||||||
|
|
||||||
let g:php_sync_method = 0
|
let g:php_sync_method = 0
|
||||||
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
function! s:sw()
|
|
||||||
return shiftwidth()
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:sw()
|
|
||||||
return &shiftwidth
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if exists("PHP_default_indenting")
|
if exists("PHP_default_indenting")
|
||||||
let b:PHP_default_indenting = PHP_default_indenting * s:sw()
|
let b:PHP_default_indenting = PHP_default_indenting * shiftwidth()
|
||||||
else
|
else
|
||||||
let b:PHP_default_indenting = 0
|
let b:PHP_default_indenting = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("PHP_outdentSLComments")
|
if exists("PHP_outdentSLComments")
|
||||||
let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw()
|
let b:PHP_outdentSLComments = PHP_outdentSLComments * shiftwidth()
|
||||||
else
|
else
|
||||||
let b:PHP_outdentSLComments = 0
|
let b:PHP_outdentSLComments = 0
|
||||||
endif
|
endif
|
||||||
@ -357,7 +347,7 @@ function! FindTheSwitchIndent (lnum) " {{{
|
|||||||
let test = GetLastRealCodeLNum(a:lnum - 1)
|
let test = GetLastRealCodeLNum(a:lnum - 1)
|
||||||
|
|
||||||
if test <= 1
|
if test <= 1
|
||||||
return indent(1) - s:sw() * b:PHP_vintage_case_default_indent
|
return indent(1) - shiftwidth() * b:PHP_vintage_case_default_indent
|
||||||
end
|
end
|
||||||
|
|
||||||
while getline(test) =~ '^\s*}' && test > 1
|
while getline(test) =~ '^\s*}' && test > 1
|
||||||
@ -371,7 +361,7 @@ function! FindTheSwitchIndent (lnum) " {{{
|
|||||||
if getline(test) =~# '^\s*switch\>'
|
if getline(test) =~# '^\s*switch\>'
|
||||||
return indent(test)
|
return indent(test)
|
||||||
elseif getline(test) =~# s:defaultORcase
|
elseif getline(test) =~# s:defaultORcase
|
||||||
return indent(test) - s:sw() * b:PHP_vintage_case_default_indent
|
return indent(test) - shiftwidth() * b:PHP_vintage_case_default_indent
|
||||||
else
|
else
|
||||||
return FindTheSwitchIndent(test)
|
return FindTheSwitchIndent(test)
|
||||||
endif
|
endif
|
||||||
@ -444,7 +434,7 @@ function! GetPhpIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if b:PHP_default_indenting
|
if b:PHP_default_indenting
|
||||||
let b:PHP_default_indenting = g:PHP_default_indenting * s:sw()
|
let b:PHP_default_indenting = g:PHP_default_indenting * shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
@ -701,7 +691,7 @@ function! GetPhpIndent()
|
|||||||
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
||||||
return indent(FindTheIfOfAnElse(v:lnum, 1))
|
return indent(FindTheIfOfAnElse(v:lnum, 1))
|
||||||
elseif cline =~# s:defaultORcase
|
elseif cline =~# s:defaultORcase
|
||||||
return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent
|
return FindTheSwitchIndent(v:lnum) + shiftwidth() * b:PHP_vintage_case_default_indent
|
||||||
elseif cline =~ '^\s*)\=\s*{'
|
elseif cline =~ '^\s*)\=\s*{'
|
||||||
let previous_line = last_line
|
let previous_line = last_line
|
||||||
let last_line_num = lnum
|
let last_line_num = lnum
|
||||||
@ -713,7 +703,7 @@ function! GetPhpIndent()
|
|||||||
let ind = indent(last_line_num)
|
let ind = indent(last_line_num)
|
||||||
|
|
||||||
if b:PHP_BracesAtCodeLevel
|
if b:PHP_BracesAtCodeLevel
|
||||||
let ind = ind + s:sw()
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
@ -724,7 +714,7 @@ function! GetPhpIndent()
|
|||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
|
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
|
||||||
let ind = ind + s:sw() " we indent one level further when the preceding line is not stated
|
let ind = ind + shiftwidth() " we indent one level further when the preceding line is not stated
|
||||||
return ind + addSpecial
|
return ind + addSpecial
|
||||||
|
|
||||||
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
|
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
|
||||||
@ -823,7 +813,7 @@ function! GetPhpIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
|
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
|
||||||
let ind = ind + s:sw()
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
|
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
|
||||||
@ -841,17 +831,17 @@ function! GetPhpIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
elseif last_line =~ '^\s*'.s:blockstart
|
elseif last_line =~ '^\s*'.s:blockstart
|
||||||
let ind = ind + s:sw()
|
let ind = ind + shiftwidth()
|
||||||
|
|
||||||
|
|
||||||
elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
|
elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
|
||||||
let ind = ind + s:sw()
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cline =~ '^\s*[)\]];\='
|
if cline =~ '^\s*[)\]];\='
|
||||||
let ind = ind - s:sw()
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:PHP_CurrentIndentLevel = ind
|
let b:PHP_CurrentIndentLevel = ind
|
||||||
|
@ -41,16 +41,16 @@ function! PostscrIndentGet(lnum)
|
|||||||
|
|
||||||
" Indent for dicts, arrays, and saves with possible trailing comment
|
" Indent for dicts, arrays, and saves with possible trailing comment
|
||||||
if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$'
|
if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Remove indent for popped dicts, and restores.
|
" Remove indent for popped dicts, and restores.
|
||||||
if pline =~ '\(end\|g\=restore\)\s*$'
|
if pline =~ '\(end\|g\=restore\)\s*$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
|
|
||||||
" Else handle immediate dedents of dicts, restores, and arrays.
|
" Else handle immediate dedents of dicts, restores, and arrays.
|
||||||
elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
|
elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
|
|
||||||
" Else handle DSC comments - always start of line.
|
" Else handle DSC comments - always start of line.
|
||||||
elseif getline(a:lnum) =~ '^\s*%%'
|
elseif getline(a:lnum) =~ '^\s*%%'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: PoV-Ray Scene Description Language
|
" Language: PoV-Ray Scene Description Language
|
||||||
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
|
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
|
||||||
" Last Change: 2002-10-20
|
" Last Change: 2017 Jun 13
|
||||||
" URI: http://trific.ath.cx/Ftp/vim/indent/pov.vim
|
" URI: http://trific.ath.cx/Ftp/vim/indent/pov.vim
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -75,9 +75,9 @@ function GetPoVRayIndent()
|
|||||||
" opening line.
|
" opening line.
|
||||||
let cur = s:MatchCount(v:lnum, '^\s*\%(#\s*\%(end\|else\)\>\|[]})]\)')
|
let cur = s:MatchCount(v:lnum, '^\s*\%(#\s*\%(end\|else\)\>\|[]})]\)')
|
||||||
if cur > 0
|
if cur > 0
|
||||||
let final = plind + (chg - cur) * &sw
|
let final = plind + (chg - cur) * shiftwidth()
|
||||||
else
|
else
|
||||||
let final = plind + chg * &sw
|
let final = plind + chg * shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return final < 0 ? 0 : final
|
return final < 0 ? 0 : final
|
||||||
|
@ -41,18 +41,18 @@ function! GetPrologIndent()
|
|||||||
endif
|
endif
|
||||||
" Check for clause head on previous line
|
" Check for clause head on previous line
|
||||||
if pline =~ ':-\s*\(%.*\)\?$'
|
if pline =~ ':-\s*\(%.*\)\?$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" Check for end of clause on previous line
|
" Check for end of clause on previous line
|
||||||
elseif pline =~ '\.\s*\(%.*\)\?$'
|
elseif pline =~ '\.\s*\(%.*\)\?$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for opening conditional on previous line
|
" Check for opening conditional on previous line
|
||||||
if pline =~ '^\s*\([(;]\|->\)'
|
if pline =~ '^\s*\([(;]\|->\)'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for closing an unclosed paren, or middle ; or ->
|
" Check for closing an unclosed paren, or middle ; or ->
|
||||||
if line =~ '^\s*\([);]\|->\)'
|
if line =~ '^\s*\([);]\|->\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: RPL/2
|
" Language: RPL/2
|
||||||
" Version: 0.2
|
" Version: 0.2
|
||||||
" Last Change: 2005 Mar 28
|
" Last Change: 2017 Jun 13
|
||||||
" Maintainer: BERTRAND Jo<4A>l <rpl2@free.fr>
|
" Maintainer: BERTRAND Jo<4A>l <rpl2@free.fr>
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -32,16 +32,16 @@ function RplGetIndent(lnum)
|
|||||||
if prevstat =~? '\<\(if\|iferr\|do\|while\)\>' && prevstat =~? '\<end\>'
|
if prevstat =~? '\<\(if\|iferr\|do\|while\)\>' && prevstat =~? '\<end\>'
|
||||||
elseif prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)' && prevstat =~? '\s\+>>\($\|\s\+\)'
|
elseif prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)' && prevstat =~? '\s\+>>\($\|\s\+\)'
|
||||||
elseif prevstat =~? '\<\(if\|iferr\|then\|else\|elseif\|select\|case\|do\|until\|while\|repeat\|for\|start\|default\)\>' || prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)'
|
elseif prevstat =~? '\<\(if\|iferr\|then\|else\|elseif\|select\|case\|do\|until\|while\|repeat\|for\|start\|default\)\>' || prevstat =~? '\(^\|\s\+\)<<\($\|\s\+\)'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a shiftwidth from then, else, elseif, end, until, repeat, next,
|
" Subtract a shiftwidth from then, else, elseif, end, until, repeat, next,
|
||||||
" step
|
" step
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
if line =~? '^\s*\(then\|else\|elseif\|until\|repeat\|next\|step\|default\|end\)\>'
|
if line =~? '^\s*\(then\|else\|elseif\|until\|repeat\|next\|step\|default\|end\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif line =~? '^\s*>>\($\|\s\+\)'
|
elseif line =~? '^\s*>>\($\|\s\+\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -404,11 +404,7 @@ function GetRubyIndent(...)
|
|||||||
" ----------
|
" ----------
|
||||||
|
|
||||||
" The value of a single shift-width
|
" The value of a single shift-width
|
||||||
if exists('*shiftwidth')
|
let sw = shiftwidth()
|
||||||
let sw = shiftwidth()
|
|
||||||
else
|
|
||||||
let sw = &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" For the current line, use the first argument if given, else v:lnum
|
" For the current line, use the first argument if given, else v:lnum
|
||||||
let clnum = a:0 ? a:1 : v:lnum
|
let clnum = a:0 ? a:1 : v:lnum
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Rust
|
" Language: Rust
|
||||||
" Author: Chris Morgan <me@chrismorgan.info>
|
" Author: Chris Morgan <me@chrismorgan.info>
|
||||||
" Last Change: 2017 Mar 21
|
" Last Change: 2017 Jun 13
|
||||||
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -199,7 +199,7 @@ function GetRustIndent(lnum)
|
|||||||
" It's the closing line, dedent it
|
" It's the closing line, dedent it
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return &shiftwidth
|
return shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Sass
|
" Language: Sass
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -29,7 +29,7 @@ function! GetSassIndent()
|
|||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
let cindent = indent(v:lnum)
|
let cindent = indent(v:lnum)
|
||||||
if line !~ s:property && line !~ s:extend && cline =~ s:property
|
if line !~ s:property && line !~ s:extend && cline =~ s:property
|
||||||
return indent + (exists('*shiftwidth') ? shiftwidth() : &sw)
|
return indent + shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
@ -46,17 +46,17 @@ function! GetSDLIndent()
|
|||||||
if (getline(lnum) =~? '^\s*\(start\|state\|system\|package\|connection\|channel\|alternative\|macro\|operator\|newtype\|select\|substructure\|decision\|generator\|refinement\|service\|method\|exceptionhandler\|asntype\|syntype\|value\|(.*):\|\(priority\s\+\)\=input\|provided\)'
|
if (getline(lnum) =~? '^\s*\(start\|state\|system\|package\|connection\|channel\|alternative\|macro\|operator\|newtype\|select\|substructure\|decision\|generator\|refinement\|service\|method\|exceptionhandler\|asntype\|syntype\|value\|(.*):\|\(priority\s\+\)\=input\|provided\)'
|
||||||
\ || getline(lnum) =~? virtuality . '\(process\|procedure\|block\|object\)')
|
\ || getline(lnum) =~? virtuality . '\(process\|procedure\|block\|object\)')
|
||||||
\ && getline(lnum) !~? 'end[[:alpha:]]\+;$'
|
\ && getline(lnum) !~? 'end[[:alpha:]]\+;$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' after states
|
" Subtract a 'shiftwidth' after states
|
||||||
if getline(lnum) =~? '^\s*\(stop\|return\>\|nextstate\)'
|
if getline(lnum) =~? '^\s*\(stop\|return\>\|nextstate\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' on on end (uncompleted line)
|
" Subtract a 'shiftwidth' on on end (uncompleted line)
|
||||||
if getline(v:lnum) =~? '^\s*end\>'
|
if getline(v:lnum) =~? '^\s*end\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Put each alternatives where the corresponding decision was
|
" Put each alternatives where the corresponding decision was
|
||||||
|
@ -115,9 +115,9 @@ function! GetSMLIndent()
|
|||||||
|
|
||||||
" Return double 'shiftwidth' after lines matching:
|
" Return double 'shiftwidth' after lines matching:
|
||||||
if lline =~ '^\s*|.*=>\s*$'
|
if lline =~ '^\s*|.*=>\s*$'
|
||||||
return ind + &sw + &sw
|
return ind + 2 *shiftwidth()
|
||||||
elseif lline =~ '^\s*val\>.*=\s*$'
|
elseif lline =~ '^\s*val\>.*=\s*$'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
@ -157,7 +157,7 @@ function! GetSMLIndent()
|
|||||||
if lastModule == -1
|
if lastModule == -1
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return lastModule + &sw
|
return lastModule + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent lines starting with '|' from matching 'case', 'handle'
|
" Indent lines starting with '|' from matching 'case', 'handle'
|
||||||
@ -172,7 +172,7 @@ function! GetSMLIndent()
|
|||||||
if switchLine =~ '\<case\>'
|
if switchLine =~ '\<case\>'
|
||||||
return col(".") + 2
|
return col(".") + 2
|
||||||
elseif switchLine =~ '\<handle\>'
|
elseif switchLine =~ '\<handle\>'
|
||||||
return switchLineIndent + &sw
|
return switchLineIndent + shiftwidth()
|
||||||
elseif switchLine =~ '\<datatype\>'
|
elseif switchLine =~ '\<datatype\>'
|
||||||
call search('=')
|
call search('=')
|
||||||
return col(".") - 1
|
return col(".") - 1
|
||||||
@ -184,7 +184,7 @@ function! GetSMLIndent()
|
|||||||
" Indent if last line ends with 'sig', 'struct', 'let', 'then', 'else',
|
" Indent if last line ends with 'sig', 'struct', 'let', 'then', 'else',
|
||||||
" 'in'
|
" 'in'
|
||||||
elseif lline =~ '\<\(sig\|struct\|let\|in\|then\|else\)\s*$'
|
elseif lline =~ '\<\(sig\|struct\|let\|in\|then\|else\)\s*$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
|
|
||||||
" Indent if last line ends with 'of', align from 'case'
|
" Indent if last line ends with 'of', align from 'case'
|
||||||
elseif lline =~ '\<\(of\)\s*$'
|
elseif lline =~ '\<\(of\)\s*$'
|
||||||
@ -199,14 +199,14 @@ function! GetSMLIndent()
|
|||||||
|
|
||||||
" Indent if last line starts with 'fun', 'case', 'fn'
|
" Indent if last line starts with 'fun', 'case', 'fn'
|
||||||
elseif lline =~ '^\s*\(fun\|fn\|case\)\>'
|
elseif lline =~ '^\s*\(fun\|fn\|case\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Don't indent 'let' if last line started with 'fun', 'fn'
|
" Don't indent 'let' if last line started with 'fun', 'fn'
|
||||||
if line =~ '^\s*let\>'
|
if line =~ '^\s*let\>'
|
||||||
if lline =~ '^\s*\(fun\|fn\)'
|
if lline =~ '^\s*\(fun\|fn\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: SQL
|
" Language: SQL
|
||||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||||
" Last Change: 2012 Dec 06
|
" Last Change: 2017 Jun 13
|
||||||
" Version: 3.0
|
" Version: 3.0
|
||||||
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ function! s:CheckToIgnoreRightParan( prev_lnum, num_levels )
|
|||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Fallback - just move back one
|
" Fallback - just move back one
|
||||||
" return a:prev_indent - &sw
|
" return a:prev_indent - shiftwidth()
|
||||||
return ignore_paran
|
return ignore_paran
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ function! s:GetStmtStarterIndent( keyword, curr_lnum )
|
|||||||
let lnum = a:curr_lnum
|
let lnum = a:curr_lnum
|
||||||
|
|
||||||
" Default - reduce indent by 1
|
" Default - reduce indent by 1
|
||||||
let ind = indent(a:curr_lnum) - &sw
|
let ind = indent(a:curr_lnum) - shiftwidth()
|
||||||
|
|
||||||
if a:keyword =~? 'end'
|
if a:keyword =~? 'end'
|
||||||
exec 'normal! ^'
|
exec 'normal! ^'
|
||||||
@ -230,7 +230,7 @@ function! s:ModuloIndent(ind)
|
|||||||
let ind = a:ind
|
let ind = a:ind
|
||||||
|
|
||||||
if ind > 0
|
if ind > 0
|
||||||
let modulo = ind % &shiftwidth
|
let modulo = ind % shiftwidth()
|
||||||
|
|
||||||
if modulo > 0
|
if modulo > 0
|
||||||
let ind = ind - modulo
|
let ind = ind - modulo
|
||||||
@ -291,7 +291,7 @@ function! GetSQLIndent()
|
|||||||
" where END IF, END, should decrease the indent.
|
" where END IF, END, should decrease the indent.
|
||||||
if prevline =~? s:SQLBlockStart
|
if prevline =~? s:SQLBlockStart
|
||||||
" Move indent in
|
" Move indent in
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
|
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
|
||||||
elseif prevline =~ '[()]'
|
elseif prevline =~ '[()]'
|
||||||
if prevline =~ '('
|
if prevline =~ '('
|
||||||
@ -308,7 +308,7 @@ function! GetSQLIndent()
|
|||||||
if num_unmatched_left > 0
|
if num_unmatched_left > 0
|
||||||
" There is a open left paranethesis
|
" There is a open left paranethesis
|
||||||
" increase indent
|
" increase indent
|
||||||
let ind = ind + ( &sw * num_unmatched_left )
|
let ind = ind + ( shiftwidth() * num_unmatched_left )
|
||||||
elseif num_unmatched_right > 0
|
elseif num_unmatched_right > 0
|
||||||
" if it is an unbalanced paranethesis only unindent if
|
" if it is an unbalanced paranethesis only unindent if
|
||||||
" it was part of a command (ie create table(..) )
|
" it was part of a command (ie create table(..) )
|
||||||
@ -323,7 +323,7 @@ function! GetSQLIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if (num_unmatched_right - ignore) > 0
|
if (num_unmatched_right - ignore) > 0
|
||||||
let ind = ind - ( &sw * (num_unmatched_right - ignore) )
|
let ind = ind - ( shiftwidth() * (num_unmatched_right - ignore) )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
@ -339,12 +339,12 @@ function! GetSQLIndent()
|
|||||||
if line =~? '^\s*els'
|
if line =~? '^\s*els'
|
||||||
" Any line when you type else will automatically back up one
|
" Any line when you type else will automatically back up one
|
||||||
" ident level (ie else, elseif, elsif)
|
" ident level (ie else, elseif, elsif)
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
" echom 'curr - else - indent ' . ind
|
" echom 'curr - else - indent ' . ind
|
||||||
elseif line =~? '^\s*end\>'
|
elseif line =~? '^\s*end\>'
|
||||||
let ind = s:GetStmtStarterIndent('end', v:lnum)
|
let ind = s:GetStmtStarterIndent('end', v:lnum)
|
||||||
" General case for end
|
" General case for end
|
||||||
" let ind = ind - &sw
|
" let ind = ind - shiftwidth()
|
||||||
" echom 'curr - end - indent ' . ind
|
" echom 'curr - end - indent ' . ind
|
||||||
elseif line =~? '^\s*when\>'
|
elseif line =~? '^\s*when\>'
|
||||||
let ind = s:GetStmtStarterIndent('when', v:lnum)
|
let ind = s:GetStmtStarterIndent('when', v:lnum)
|
||||||
@ -352,7 +352,7 @@ function! GetSQLIndent()
|
|||||||
" clause, do not change the indent level, since these
|
" clause, do not change the indent level, since these
|
||||||
" statements do not have a corresponding END statement.
|
" statements do not have a corresponding END statement.
|
||||||
" if stmt_starter =~? 'case'
|
" if stmt_starter =~? 'case'
|
||||||
" let ind = ind - &sw
|
" let ind = ind - shiftwidth()
|
||||||
" endif
|
" endif
|
||||||
" elseif line =~ '^\s*)\s*;\?\s*$'
|
" elseif line =~ '^\s*)\s*;\?\s*$'
|
||||||
" elseif line =~ '^\s*)'
|
" elseif line =~ '^\s*)'
|
||||||
@ -371,14 +371,14 @@ function! GetSQLIndent()
|
|||||||
" let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
|
" let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
|
||||||
" if num_unmatched_right > 0
|
" if num_unmatched_right > 0
|
||||||
" elseif strpart( line, strlen(line)-1, 1 ) =~ ')'
|
" elseif strpart( line, strlen(line)-1, 1 ) =~ ')'
|
||||||
" let ind = ind - &sw
|
" let ind = ind - shiftwidth()
|
||||||
if line =~ '^\s*)'
|
if line =~ '^\s*)'
|
||||||
" let ignore = ignore + 1
|
" let ignore = ignore + 1
|
||||||
" echom 'curr - begins ) unbalanced ignore: ' . ignore
|
" echom 'curr - begins ) unbalanced ignore: ' . ignore
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (num_unmatched_right - ignore) > 0
|
if (num_unmatched_right - ignore) > 0
|
||||||
let ind = ind - ( &sw * (num_unmatched_right - ignore) )
|
let ind = ind - ( shiftwidth() * (num_unmatched_right - ignore) )
|
||||||
endif
|
endif
|
||||||
" endif
|
" endif
|
||||||
endif
|
endif
|
||||||
|
@ -29,7 +29,7 @@ function SystemVerilogIndent()
|
|||||||
if exists('b:systemverilog_indent_width')
|
if exists('b:systemverilog_indent_width')
|
||||||
let offset = b:systemverilog_indent_width
|
let offset = b:systemverilog_indent_width
|
||||||
else
|
else
|
||||||
let offset = &sw
|
let offset = shiftwidth()
|
||||||
endif
|
endif
|
||||||
if exists('b:systemverilog_indent_modules')
|
if exists('b:systemverilog_indent_modules')
|
||||||
let indent_modules = offset
|
let indent_modules = offset
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Based on Tera Term Version 4.92
|
" Based on Tera Term Version 4.92
|
||||||
" Maintainer: Ken Takata
|
" Maintainer: Ken Takata
|
||||||
" URL: https://github.com/k-takata/vim-teraterm
|
" URL: https://github.com/k-takata/vim-teraterm
|
||||||
" Last Change: 2016 Aug 17
|
" Last Change: 2017 Jun 13
|
||||||
" Filenames: *.ttl
|
" Filenames: *.ttl
|
||||||
" License: VIM License
|
" License: VIM License
|
||||||
|
|
||||||
@ -22,16 +22,6 @@ if exists("*GetTeraTermIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The shiftwidth() function is relatively new.
|
|
||||||
" Don't require it to exist.
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
let s:sw = function('shiftwidth')
|
|
||||||
else
|
|
||||||
function s:sw() abort
|
|
||||||
return &shiftwidth
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! GetTeraTermIndent(lnum)
|
function! GetTeraTermIndent(lnum)
|
||||||
let l:prevlnum = prevnonblank(a:lnum-1)
|
let l:prevlnum = prevnonblank(a:lnum-1)
|
||||||
if l:prevlnum == 0
|
if l:prevlnum == 0
|
||||||
@ -48,15 +38,15 @@ function! GetTeraTermIndent(lnum)
|
|||||||
|
|
||||||
if l:prevl =~ '^\s*if\>.*\<then\>'
|
if l:prevl =~ '^\s*if\>.*\<then\>'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>'
|
if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>'
|
if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let l:ind -= s:sw()
|
let l:ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:ind
|
return l:ind
|
||||||
|
@ -215,14 +215,14 @@ function! GetTeXIndent() " {{{
|
|||||||
" ZYC modification : \end after \begin won't cause wrong indent anymore
|
" ZYC modification : \end after \begin won't cause wrong indent anymore
|
||||||
if line =~ '\\begin{.*}'
|
if line =~ '\\begin{.*}'
|
||||||
if line !~ g:tex_noindent_env
|
if line !~ g:tex_noindent_env
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:tex_indent_items
|
if g:tex_indent_items
|
||||||
" Add another sw for item-environments
|
" Add another sw for item-environments
|
||||||
if line =~ g:tex_itemize_env
|
if line =~ g:tex_itemize_env
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -241,23 +241,23 @@ function! GetTeXIndent() " {{{
|
|||||||
if g:tex_indent_items
|
if g:tex_indent_items
|
||||||
" Remove another sw for item-environments
|
" Remove another sw for item-environments
|
||||||
if cline =~ g:tex_itemize_env
|
if cline =~ g:tex_itemize_env
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:tex_indent_brace
|
if g:tex_indent_brace
|
||||||
if line =~ '[[{]$'
|
if line =~ '[[{]$'
|
||||||
let ind += &sw
|
let ind += shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum))
|
if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum))
|
||||||
let ind -= &sw
|
let ind -= shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ function! GetTeXIndent() " {{{
|
|||||||
let char = line[i]
|
let char = line[i]
|
||||||
if char == ']' || char == '}'
|
if char == ']' || char == '}'
|
||||||
if s:CheckPairedIsLastCharacter(lnum, i)
|
if s:CheckPairedIsLastCharacter(lnum, i)
|
||||||
let ind -= &sw
|
let ind -= shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -280,12 +280,12 @@ function! GetTeXIndent() " {{{
|
|||||||
if g:tex_indent_items
|
if g:tex_indent_items
|
||||||
" '\item' or '\bibitem' itself:
|
" '\item' or '\bibitem' itself:
|
||||||
if cline =~ g:tex_items
|
if cline =~ g:tex_items
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
" lines following to '\item' are intented once again:
|
" lines following to '\item' are intented once again:
|
||||||
if line =~ g:tex_items
|
if line =~ g:tex_items
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
let stay = 0
|
let stay = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -317,9 +317,9 @@ function! s:GetLastBeginIndentation(lnum) " {{{
|
|||||||
return indent(lnum)
|
return indent(lnum)
|
||||||
endif
|
endif
|
||||||
if line =~ g:tex_itemize_env
|
if line =~ g:tex_itemize_env
|
||||||
return indent(lnum) + 2 * &sw
|
return indent(lnum) + 2 * shiftwidth()
|
||||||
endif
|
endif
|
||||||
return indent(lnum) + &sw
|
return indent(lnum) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return -1
|
return -1
|
||||||
@ -347,7 +347,7 @@ function! s:GetEndIndentation(lnum) " {{{
|
|||||||
let min_indent = min([min_indent, indent(lnum)])
|
let min_indent = min([min_indent, indent(lnum)])
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return min_indent - &sw
|
return min_indent - shiftwidth()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Most of the code is from matchparen.vim
|
" Most of the code is from matchparen.vim
|
||||||
|
@ -25,11 +25,11 @@ function GetTildeIndent(lnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
|
if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
|
||||||
return indent(v:lnum) - &sw
|
return indent(v:lnum) - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if getline(plnum) =~ '^\s*\~\(if\|foreach\|foreach_row\|xml_loop\|file_loop\|file_write\|file_append\|imap_loopsections\|imap_index\|imap_list\|ldap_search\|post_loopall\|post_loop\|file_loop\|sql_loop_num\|sql_dbmsselect\|search\|sql_loop\|post\|for\|function_define\|silent\|while\|setvalbig\|mail_create\|systempipe\|mail_send\|dual\|elseif\|else\)\>'
|
if getline(plnum) =~ '^\s*\~\(if\|foreach\|foreach_row\|xml_loop\|file_loop\|file_write\|file_append\|imap_loopsections\|imap_index\|imap_list\|ldap_search\|post_loopall\|post_loop\|file_loop\|sql_loop_num\|sql_dbmsselect\|search\|sql_loop\|post\|for\|function_define\|silent\|while\|setvalbig\|mail_create\|systempipe\|mail_send\|dual\|elseif\|else\)\>'
|
||||||
return indent(plnum) + &sw
|
return indent(plnum) + shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
@ -49,26 +49,26 @@ fun! VbGetIndent(lnum)
|
|||||||
|
|
||||||
" Add
|
" Add
|
||||||
if previous_line =~? '^\s*\<\(begin\|\%(\%(private\|public\|friend\)\s\+\)\=\%(function\|sub\|property\)\|select\|case\|default\|if\|else\|elseif\|do\|for\|while\|enum\|with\)\>'
|
if previous_line =~? '^\s*\<\(begin\|\%(\%(private\|public\|friend\)\s\+\)\=\%(function\|sub\|property\)\|select\|case\|default\|if\|else\|elseif\|do\|for\|while\|enum\|with\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract
|
" Subtract
|
||||||
if this_line =~? '^\s*\<end\>\s\+\<select\>'
|
if this_line =~? '^\s*\<end\>\s\+\<select\>'
|
||||||
if previous_line !~? '^\s*\<select\>'
|
if previous_line !~? '^\s*\<select\>'
|
||||||
let ind = ind - 2 * &sw
|
let ind = ind - 2 * shiftwidth()
|
||||||
else
|
else
|
||||||
" this case is for an empty 'select' -- 'end select'
|
" this case is for an empty 'select' -- 'end select'
|
||||||
" (w/o any case statements) like:
|
" (w/o any case statements) like:
|
||||||
"
|
"
|
||||||
" select case readwrite
|
" select case readwrite
|
||||||
" end select
|
" end select
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif this_line =~? '^\s*\<\(end\|else\|elseif\|until\|loop\|next\|wend\)\>'
|
elseif this_line =~? '^\s*\<\(end\|else\|elseif\|until\|loop\|next\|wend\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif this_line =~? '^\s*\<\(case\|default\)\>'
|
elseif this_line =~? '^\s*\<\(case\|default\)\>'
|
||||||
if previous_line !~? '^\s*\<select\>'
|
if previous_line !~? '^\s*\<select\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: VHDL
|
" Language: VHDL
|
||||||
" Maintainer: Gerald Lai <laigera+vim?gmail.com>
|
" Maintainer: Gerald Lai <laigera+vim?gmail.com>
|
||||||
" Version: 1.60
|
" Version: 1.60
|
||||||
" Last Change: 2016 Feb 26
|
" Last Change: 2017 Jun 13
|
||||||
" URL: http://www.vim.org/scripts/script.php?script_id=1450
|
" URL: http://www.vim.org/scripts/script.php?script_id=1450
|
||||||
|
|
||||||
" only load this indent file when no other was loaded
|
" only load this indent file when no other was loaded
|
||||||
@ -114,9 +114,9 @@ function GetVHDLindent()
|
|||||||
return ind2 + m
|
return ind2 + m
|
||||||
else
|
else
|
||||||
if g:vhdl_indent_genportmap
|
if g:vhdl_indent_genportmap
|
||||||
return ind2 + stridx(prevs_noi, '(') + &sw
|
return ind2 + stridx(prevs_noi, '(') + shiftwidth()
|
||||||
else
|
else
|
||||||
return ind2 + &sw
|
return ind2 + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -128,7 +128,7 @@ function GetVHDLindent()
|
|||||||
if g:vhdl_indent_rhsassign
|
if g:vhdl_indent_rhsassign
|
||||||
return ind2 + matchend(prevs_noi, '<=\s*\ze.')
|
return ind2 + matchend(prevs_noi, '<=\s*\ze.')
|
||||||
else
|
else
|
||||||
return ind2 + &sw
|
return ind2 + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -218,12 +218,12 @@ function GetVHDLindent()
|
|||||||
let ps = getline(pn)
|
let ps = getline(pn)
|
||||||
|
|
||||||
if (ps =~? s:NC.'\<begin\>')
|
if (ps =~? s:NC.'\<begin\>')
|
||||||
return indent(pn) - &sw
|
return indent(pn) - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
if (pn == 0)
|
if (pn == 0)
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
else
|
else
|
||||||
return indent(pn)
|
return indent(pn)
|
||||||
endif
|
endif
|
||||||
@ -237,7 +237,7 @@ function GetVHDLindent()
|
|||||||
" keyword: "type"
|
" keyword: "type"
|
||||||
let s3 = s:NC.s:NE.'\<type\>'
|
let s3 = s:NC.s:NE.'\<type\>'
|
||||||
if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3
|
if curs !~? s3.'.*'.s:NC.'\<\%(record\|units\)\>.*'.s:ES && prevs =~? s3
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
@ -282,7 +282,7 @@ function GetVHDLindent()
|
|||||||
" removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while"
|
" removed: "begin", "case", "elsif", "if", "loop", "record", "units", "while"
|
||||||
" where: anywhere in previous line
|
" where: anywhere in previous line
|
||||||
if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>'
|
if prevs =~? s:NC.s:NE.'\<\%(block\|process\)\>'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" indent: +sw
|
" indent: +sw
|
||||||
@ -290,7 +290,7 @@ function GetVHDLindent()
|
|||||||
" removed: "component", "for", "when", "with"
|
" removed: "component", "for", "when", "with"
|
||||||
" where: start of previous line
|
" where: start of previous line
|
||||||
if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>'
|
if prevs =~? '^\s*\%(architecture\|configuration\|entity\|package\)\>'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" indent: +sw
|
" indent: +sw
|
||||||
@ -298,7 +298,7 @@ function GetVHDLindent()
|
|||||||
" removed: "generate", "is", "=>"
|
" removed: "generate", "is", "=>"
|
||||||
" where: end of previous line
|
" where: end of previous line
|
||||||
if prevs =~? s:NC.'\<select'.s:ES
|
if prevs =~? s:NC.'\<select'.s:ES
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" indent: +sw
|
" indent: +sw
|
||||||
@ -310,7 +310,7 @@ function GetVHDLindent()
|
|||||||
" where: end of previous line
|
" where: end of previous line
|
||||||
" _note_: indent allowed to leave this filter
|
" _note_: indent allowed to leave this filter
|
||||||
if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES
|
if prevs =~? s:NC.'\%(\<begin\>\|'.s:NE.'\<\%(loop\|record\|units\)\>\)' || prevs =~? '^\s*\%(component\|else\|for\)\>' || prevs =~? s:NC.'\%('.s:NE.'\<generate\|\<\%(is\|then\)\|=>\)'.s:ES
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ****************************************************************************************
|
" ****************************************************************************************
|
||||||
@ -322,7 +322,7 @@ function GetVHDLindent()
|
|||||||
if prevs =~? s:NC.'\<is'.s:ES
|
if prevs =~? s:NC.'\<is'.s:ES
|
||||||
return ind
|
return ind
|
||||||
elseif prevs !~? s4
|
elseif prevs !~? s4
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
else
|
else
|
||||||
return ind2
|
return ind2
|
||||||
endif
|
endif
|
||||||
@ -336,7 +336,7 @@ function GetVHDLindent()
|
|||||||
if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
|
if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
|
||||||
return ind
|
return ind
|
||||||
else
|
else
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -367,9 +367,9 @@ function GetVHDLindent()
|
|||||||
"where: start of previous non-comment line
|
"where: start of previous non-comment line
|
||||||
if m == 1
|
if m == 1
|
||||||
if ps =~? '^\s*end\s\+case\>'
|
if ps =~? '^\s*end\s\+case\>'
|
||||||
return indent(pn) - 2 * &sw
|
return indent(pn) - 2 * shiftwidth()
|
||||||
elseif ps =~? '^\s*when\>'
|
elseif ps =~? '^\s*when\>'
|
||||||
return indent(pn) - &sw
|
return indent(pn) - shiftwidth()
|
||||||
elseif ps =~? '^\s*case\>'
|
elseif ps =~? '^\s*case\>'
|
||||||
return indent(pn)
|
return indent(pn)
|
||||||
endif
|
endif
|
||||||
@ -385,14 +385,14 @@ function GetVHDLindent()
|
|||||||
let pn = prevnonblank(pn - 1)
|
let pn = prevnonblank(pn - 1)
|
||||||
let ps = getline(pn)
|
let ps = getline(pn)
|
||||||
endwhile
|
endwhile
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" indent: -sw
|
" indent: -sw
|
||||||
" keyword: ")"
|
" keyword: ")"
|
||||||
" where: start of current line
|
" where: start of current line
|
||||||
if curs =~ '^\s*)'
|
if curs =~ '^\s*)'
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" indent: 0
|
" indent: 0
|
||||||
@ -407,7 +407,7 @@ function GetVHDLindent()
|
|||||||
" where: start of current line
|
" where: start of current line
|
||||||
"if curs =~? '^\s*end\s\+\w\+\>'
|
"if curs =~? '^\s*end\s\+\w\+\>'
|
||||||
if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)'
|
if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)'
|
||||||
return ind - &sw
|
return ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ****************************************************************************************
|
" ****************************************************************************************
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" Language: xml
|
" Language: xml
|
||||||
" Maintainer: Johannes Zellner <johannes@zellner.org>
|
" Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||||
" Last Change: 2012 Jul 25
|
" Last Change: 2017 Jun 13
|
||||||
" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts)
|
" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts)
|
||||||
" 2) will be confused by unbalanced tags in comments
|
" 2) will be confused by unbalanced tags in comments
|
||||||
" or CDATA sections.
|
" or CDATA sections.
|
||||||
@ -67,7 +67,7 @@ endfun
|
|||||||
fun! <SID>XmlIndentSum(lnum, style, add)
|
fun! <SID>XmlIndentSum(lnum, style, add)
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
if a:style == match(line, '^\s*</')
|
if a:style == match(line, '^\s*</')
|
||||||
return (&sw *
|
return (shiftwidth() *
|
||||||
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
|
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
|
||||||
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
|
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
|
||||||
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
|
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: YAML
|
" Language: YAML
|
||||||
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
|
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
|
||||||
" Last Change: 2015 Nov 01
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
@ -24,14 +24,6 @@ if exists('*GetYAMLIndent')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
let s:shiftwidth = function('shiftwidth')
|
|
||||||
else
|
|
||||||
function s:shiftwidth()
|
|
||||||
return &shiftwidth
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function s:FindPrevLessIndentedLine(lnum, ...)
|
function s:FindPrevLessIndentedLine(lnum, ...)
|
||||||
let prevlnum = prevnonblank(a:lnum-1)
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
let curindent = a:0 ? a:1 : indent(a:lnum)
|
let curindent = a:0 ? a:1 : indent(a:lnum)
|
||||||
@ -119,7 +111,7 @@ function GetYAMLIndent(lnum)
|
|||||||
"
|
"
|
||||||
" - |-
|
" - |-
|
||||||
" Block scalar without indentation indicator
|
" Block scalar without indentation indicator
|
||||||
return previndent+s:shiftwidth()
|
return previndent+shiftwidth()
|
||||||
elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$'
|
elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$'
|
||||||
" - |+2
|
" - |+2
|
||||||
" block scalar with indentation indicator
|
" block scalar with indentation indicator
|
||||||
@ -155,7 +147,7 @@ function GetYAMLIndent(lnum)
|
|||||||
\ '\v)%(\s+|\s*%(\#.*)?$))*'
|
\ '\v)%(\s+|\s*%(\#.*)?$))*'
|
||||||
" Mapping with: value
|
" Mapping with: value
|
||||||
" that is multiline scalar
|
" that is multiline scalar
|
||||||
return previndent+s:shiftwidth()
|
return previndent+shiftwidth()
|
||||||
endif
|
endif
|
||||||
return previndent
|
return previndent
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||||
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
|
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
|
||||||
" Wichert Akkerman <wakkerma@debian.org>
|
" Wichert Akkerman <wakkerma@debian.org>
|
||||||
" Last Change: 2016 Nov 12
|
" Last Change: 2017 Apr 23
|
||||||
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim
|
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim
|
||||||
|
|
||||||
" Standard syntax initialization
|
" Standard syntax initialization
|
||||||
@ -14,14 +14,14 @@ endif
|
|||||||
" Case doesn't matter for us
|
" Case doesn't matter for us
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
|
||||||
let urgency='urgency=\(low\|medium\|high\|critical\)\( [^[:space:],][^,]*\)\='
|
let s:urgency='urgency=\(low\|medium\|high\|critical\)\( [^[:space:],][^,]*\)\='
|
||||||
let binNMU='binary-only=yes'
|
let s:binNMU='binary-only=yes'
|
||||||
|
|
||||||
" Define some common expressions we can use later on
|
" Define some common expressions we can use later on
|
||||||
syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ "
|
syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ "
|
||||||
exe 'syn match debchangelogFirstKV contained "; \('.urgency.'\|'.binNMU.'\)"'
|
exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"'
|
||||||
exe 'syn match debchangelogOtherKV contained ", \('.urgency.'\|'.binNMU.'\)"'
|
exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"'
|
||||||
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
|
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
|
||||||
syn match debchangelogVersion contained "(.\{-})"
|
syn match debchangelogVersion contained "(.\{-})"
|
||||||
syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*"
|
syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*"
|
||||||
syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*"
|
syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: Debian sources.list
|
" Language: Debian sources.list
|
||||||
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||||
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
|
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
|
||||||
" Last Change: 2016 Nov 12
|
" Last Change: 2017 Apr 22
|
||||||
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim
|
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim
|
||||||
|
|
||||||
" Standard syntax initialization
|
" Standard syntax initialization
|
||||||
@ -25,7 +25,7 @@ let s:supported = [
|
|||||||
\ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
|
\ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
|
||||||
\ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy',
|
\ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy',
|
||||||
\
|
\
|
||||||
\ 'precise', 'trusty', 'xenial', 'yakkety', 'zesty', 'devel'
|
\ 'trusty', 'xenial', 'yakkety', 'zesty', 'artful', 'devel'
|
||||||
\ ]
|
\ ]
|
||||||
let s:unsupported = [
|
let s:unsupported = [
|
||||||
\ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
|
\ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
|
||||||
@ -33,15 +33,15 @@ let s:unsupported = [
|
|||||||
\
|
\
|
||||||
\ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
|
\ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
|
||||||
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
|
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
|
||||||
\ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy',
|
\ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
|
||||||
\ 'utopic', 'vivid', 'wily'
|
\ 'utopic', 'vivid', 'wily'
|
||||||
\ ]
|
\ ]
|
||||||
let &cpo=s:cpo
|
let &cpo=s:cpo
|
||||||
|
|
||||||
" Match uri's
|
" Match uri's
|
||||||
syn match debsourcesUri +\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++
|
syn match debsourcesUri +\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++
|
||||||
exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\('. join(s:supported, '\|'). '\)\([-[:alnum:]_./]*\)+'
|
exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
|
||||||
exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\('. join(s:unsupported, '\|') .'\)\([-[:alnum:]_./]*\)+'
|
exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+'
|
||||||
|
|
||||||
" Associate our matches and regions with pretty colours
|
" Associate our matches and regions with pretty colours
|
||||||
hi def link debsourcesLine Error
|
hi def link debsourcesLine Error
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: Vim help file
|
" Language: Vim help file
|
||||||
" Maintainer: Bram Moolenaar (Bram@vim.org)
|
" Maintainer: Bram Moolenaar (Bram@vim.org)
|
||||||
" Last Change: 2016 Sep 02
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
" Quit when a (custom) syntax file was already loaded
|
" Quit when a (custom) syntax file was already loaded
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
@ -50,7 +50,8 @@ else
|
|||||||
syn match helpIgnore "." contained
|
syn match helpIgnore "." contained
|
||||||
endif
|
endif
|
||||||
syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
|
syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
|
||||||
syn keyword helpWarning WARNING: Warning:
|
syn keyword helpWarning WARNING WARNING: Warning:
|
||||||
|
syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated:
|
||||||
syn match helpSpecial "\<N\>"
|
syn match helpSpecial "\<N\>"
|
||||||
syn match helpSpecial "\<N\.$"me=e-1
|
syn match helpSpecial "\<N\.$"me=e-1
|
||||||
syn match helpSpecial "\<N\.\s"me=e-2
|
syn match helpSpecial "\<N\.\s"me=e-2
|
||||||
@ -165,6 +166,7 @@ hi def link helpOption Type
|
|||||||
hi def link helpSpecial Special
|
hi def link helpSpecial Special
|
||||||
hi def link helpNote Todo
|
hi def link helpNote Todo
|
||||||
hi def link helpWarning Todo
|
hi def link helpWarning Todo
|
||||||
|
hi def link helpDeprecated Todo
|
||||||
|
|
||||||
hi def link helpComment Comment
|
hi def link helpComment Comment
|
||||||
hi def link helpConstant Constant
|
hi def link helpConstant Constant
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: php PHP 3/4/5/7
|
" Language: php PHP 3/4/5/7
|
||||||
" Maintainer: Jason Woofenden <jason@jasonwoof.com>
|
" Maintainer: Jason Woofenden <jason@jasonwoof.com>
|
||||||
" Last Change: Apr 28, 2017
|
" Last Change: Jun 09, 2017
|
||||||
" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD
|
" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD
|
||||||
" Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com>
|
" Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com>
|
||||||
" Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
" Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||||
@ -197,7 +197,7 @@ syn keyword phpFunctions nsapi_request_headers nsapi_response_headers nsapi_vir
|
|||||||
syn keyword phpFunctions aggregate_info aggregate_methods_by_list aggregate_methods_by_regexp aggregate_methods aggregate_properties_by_list aggregate_properties_by_regexp aggregate_properties aggregate aggregation_info deaggregate contained
|
syn keyword phpFunctions aggregate_info aggregate_methods_by_list aggregate_methods_by_regexp aggregate_methods aggregate_properties_by_list aggregate_properties_by_regexp aggregate_properties aggregate aggregation_info deaggregate contained
|
||||||
syn keyword phpFunctions ocibindbyname ocicancel ocicloselob ocicollappend ocicollassign ocicollassignelem ocicollgetelem ocicollmax ocicollsize ocicolltrim ocicolumnisnull ocicolumnname ocicolumnprecision ocicolumnscale ocicolumnsize ocicolumntype ocicolumntyperaw ocicommit ocidefinebyname ocierror ociexecute ocifetch ocifetchinto ocifetchstatement ocifreecollection ocifreecursor ocifreedesc ocifreestatement ociinternaldebug ociloadlob ocilogoff ocilogon ocinewcollection ocinewcursor ocinewdescriptor ocinlogon ocinumcols ociparse ociplogon ociresult ocirollback ocirowcount ocisavelob ocisavelobfile ociserverversion ocisetprefetch ocistatementtype ociwritelobtofile ociwritetemporarylob contained
|
syn keyword phpFunctions ocibindbyname ocicancel ocicloselob ocicollappend ocicollassign ocicollassignelem ocicollgetelem ocicollmax ocicollsize ocicolltrim ocicolumnisnull ocicolumnname ocicolumnprecision ocicolumnscale ocicolumnsize ocicolumntype ocicolumntyperaw ocicommit ocidefinebyname ocierror ociexecute ocifetch ocifetchinto ocifetchstatement ocifreecollection ocifreecursor ocifreedesc ocifreestatement ociinternaldebug ociloadlob ocilogoff ocilogon ocinewcollection ocinewcursor ocinewdescriptor ocinlogon ocinumcols ociparse ociplogon ociresult ocirollback ocirowcount ocisavelob ocisavelobfile ociserverversion ocisetprefetch ocistatementtype ociwritelobtofile ociwritetemporarylob contained
|
||||||
syn keyword phpFunctions odbc_autocommit odbc_binmode odbc_close_all odbc_close odbc_columnprivileges odbc_columns odbc_commit odbc_connect odbc_cursor odbc_data_source odbc_do odbc_error odbc_errormsg odbc_exec odbc_execute odbc_fetch_array odbc_fetch_into odbc_fetch_object odbc_fetch_row odbc_field_len odbc_field_name odbc_field_num odbc_field_precision odbc_field_scale odbc_field_type odbc_foreignkeys odbc_free_result odbc_gettypeinfo odbc_longreadlen odbc_next_result odbc_num_fields odbc_num_rows odbc_pconnect odbc_prepare odbc_primarykeys odbc_procedurecolumns odbc_procedures odbc_result_all odbc_result odbc_rollback odbc_setoption odbc_specialcolumns odbc_statistics odbc_tableprivileges odbc_tables contained
|
syn keyword phpFunctions odbc_autocommit odbc_binmode odbc_close_all odbc_close odbc_columnprivileges odbc_columns odbc_commit odbc_connect odbc_cursor odbc_data_source odbc_do odbc_error odbc_errormsg odbc_exec odbc_execute odbc_fetch_array odbc_fetch_into odbc_fetch_object odbc_fetch_row odbc_field_len odbc_field_name odbc_field_num odbc_field_precision odbc_field_scale odbc_field_type odbc_foreignkeys odbc_free_result odbc_gettypeinfo odbc_longreadlen odbc_next_result odbc_num_fields odbc_num_rows odbc_pconnect odbc_prepare odbc_primarykeys odbc_procedurecolumns odbc_procedures odbc_result_all odbc_result odbc_rollback odbc_setoption odbc_specialcolumns odbc_statistics odbc_tableprivileges odbc_tables contained
|
||||||
syn keyword phpFunctions openssl_csr_export_to_file openssl_csr_export openssl_csr_new openssl_csr_sign openssl_error_string openssl_free_key openssl_get_privatekey openssl_get_publickey openssl_open openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export_to_file openssl_pkey_export openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_seal openssl_sign openssl_verify openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export_to_file openssl_x509_export openssl_x509_free openssl_x509_parse openssl_x509_read contained
|
syn keyword phpFunctions openssl_cipher_iv_length openssl_csr_export_to_file openssl_csr_export openssl_csr_get_public_key openssl_csr_get_subject openssl_csr_new openssl_csr_sign openssl_decrypt openssl_dh_compute_key openssl_digest openssl_encrypt openssl_error_string openssl_free_key openssl_get_cert_locations openssl_get_cipher_methods openssl_get_md_methods openssl_get_privatekey openssl_get_publickey openssl_open openssl_pbkdf2 openssl_pkcs12_export_to_file openssl_pkcs12_export openssl_pkcs12_read openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export_to_file openssl_pkey_export openssl_pkey_free openssl_pkey_get_details openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_random_pseudo_bytes openssl_seal openssl_sign openssl_spki_export_challenge openssl_spki_export openssl_spki_new openssl_spki_verify openssl_verify openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export_to_file openssl_x509_export openssl_x509_fingerprint openssl_x509_free openssl_x509_parse openssl_x509_read contained
|
||||||
syn keyword phpFunctions ora_bind ora_close ora_columnname ora_columnsize ora_columntype ora_commit ora_commitoff ora_commiton ora_do ora_error ora_errorcode ora_exec ora_fetch_into ora_fetch ora_getcolumn ora_logoff ora_logon ora_numcols ora_numrows ora_open ora_parse ora_plogon ora_rollback contained
|
syn keyword phpFunctions ora_bind ora_close ora_columnname ora_columnsize ora_columntype ora_commit ora_commitoff ora_commiton ora_do ora_error ora_errorcode ora_exec ora_fetch_into ora_fetch ora_getcolumn ora_logoff ora_logon ora_numcols ora_numrows ora_open ora_parse ora_plogon ora_rollback contained
|
||||||
syn keyword phpFunctions flush ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_get_status ob_gzhandler ob_implicit_flush ob_list_handlers ob_start output_add_rewrite_var output_reset_rewrite_vars contained
|
syn keyword phpFunctions flush ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_get_status ob_gzhandler ob_implicit_flush ob_list_handlers ob_start output_add_rewrite_var output_reset_rewrite_vars contained
|
||||||
syn keyword phpFunctions overload contained
|
syn keyword phpFunctions overload contained
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vim 7.4\n"
|
"Project-Id-Version: vim 8.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2016-02-11 12:10+0100\n"
|
"POT-Creation-Date: 2016-02-11 12:10+0100\n"
|
||||||
"PO-Revision-Date: 2016-02-11 14:42+0200\n"
|
"PO-Revision-Date: 2016-02-11 14:42+0200\n"
|
||||||
|
Reference in New Issue
Block a user