comparison runtime/indent/j.vim @ 6505:198e1e498edf

Updated runtime files.
author Bram Moolenaar <bram@vim.org>
date Wed, 14 Jan 2015 19:42:21 +0100
parents d735e62f5925
children cb3163d590a1
comparison
equal deleted inserted replaced
6504:ca0b33e86f83 6505:198e1e498edf
1 " Vim indent file 1 " Vim indent file
2 " Language: J 2 " Language: J
3 " Maintainer: David Bürgin <676c7473@gmail.com> 3 " Maintainer: David Bürgin <676c7473@gmail.com>
4 " URL: https://github.com/glts/vim-j 4 " URL: https://github.com/glts/vim-j
5 " Last Change: 2014-04-05 5 " Last Change: 2015-01-11
6 6
7 if exists('b:did_indent') 7 if exists('b:did_indent')
8 finish 8 finish
9 endif 9 endif
10 let b:did_indent = 1 10 let b:did_indent = 1
24 if !exists('g:j_indent_definitions') 24 if !exists('g:j_indent_definitions')
25 let g:j_indent_definitions = 0 25 let g:j_indent_definitions = 0
26 endif 26 endif
27 27
28 function GetJIndent() abort 28 function GetJIndent() abort
29 let prevlnum = prevnonblank(v:lnum-1) 29 let l:prevlnum = prevnonblank(v:lnum - 1)
30 if prevlnum == 0 30 if l:prevlnum == 0
31 return 0 31 return 0
32 endif 32 endif
33 let indent = indent(prevlnum) 33 let l:indent = indent(l:prevlnum)
34 let prevline = getline(prevlnum) 34 let l:prevline = getline(l:prevlnum)
35 if prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$' 35 if l:prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$'
36 " Increase indentation after an initial control word that starts or 36 " Increase indentation after an initial control word that starts or
37 " continues a block and is not terminated by "end." 37 " continues a block and is not terminated by "end."
38 let indent += shiftwidth() 38 let l:indent += shiftwidth()
39 elseif g:j_indent_definitions && (prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || prevline =~# '^\s*:\s*$') 39 elseif g:j_indent_definitions && (l:prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || l:prevline =~# '^\s*:\s*$')
40 " Increase indentation in explicit definitions of adverbs, conjunctions, 40 " Increase indentation in explicit definitions of adverbs, conjunctions,
41 " and verbs 41 " and verbs
42 let indent += shiftwidth() 42 let l:indent += shiftwidth()
43 endif 43 endif
44 " Decrease indentation in lines that start with either control words that 44 " Decrease indentation in lines that start with either control words that
45 " continue or end a block, or the special items ")" and ":" 45 " continue or end a block, or the special items ")" and ":"
46 if getline(v:lnum) =~# '^\s*\%()\|:\|\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)' 46 if getline(v:lnum) =~# '^\s*\%()\|:\|\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)'
47 let indent -= shiftwidth() 47 let l:indent -= shiftwidth()
48 endif 48 endif
49 return indent 49 return l:indent
50 endfunction 50 endfunction