mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
a98a6996c2
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
51 lines
1.7 KiB
VimL
51 lines
1.7 KiB
VimL
" Vim indent file
|
|
" Language: J
|
|
" Maintainer: David Bürgin <676c7473@gmail.com>
|
|
" URL: https://github.com/glts/vim-j
|
|
" Last Change: 2014-04-05
|
|
|
|
if exists('b:did_indent')
|
|
finish
|
|
endif
|
|
let b:did_indent = 1
|
|
|
|
setlocal indentexpr=GetJIndent()
|
|
setlocal indentkeys-=0{,0},:,0#
|
|
setlocal indentkeys+=0),0<:>,=case.,=catch.,=catchd.,=catcht.,=do.,=else.,=elseif.,=end.,=fcase.
|
|
|
|
let b:undo_indent = 'setlocal indentkeys< indentexpr<'
|
|
|
|
if exists('*GetJIndent')
|
|
finish
|
|
endif
|
|
|
|
" If g:j_indent_definitions is true, the bodies of explicit definitions of
|
|
" adverbs, conjunctions, and verbs will be indented. Default is false (0).
|
|
if !exists('g:j_indent_definitions')
|
|
let g:j_indent_definitions = 0
|
|
endif
|
|
|
|
function GetJIndent() abort
|
|
let prevlnum = prevnonblank(v:lnum-1)
|
|
if prevlnum == 0
|
|
return 0
|
|
endif
|
|
let indent = indent(prevlnum)
|
|
let prevline = getline(prevlnum)
|
|
if prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$'
|
|
" Increase indentation after an initial control word that starts or
|
|
" continues a block and is not terminated by "end."
|
|
let indent += shiftwidth()
|
|
elseif g:j_indent_definitions && (prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || prevline =~# '^\s*:\s*$')
|
|
" Increase indentation in explicit definitions of adverbs, conjunctions,
|
|
" and verbs
|
|
let indent += shiftwidth()
|
|
endif
|
|
" Decrease indentation in lines that start with either control words that
|
|
" continue or end a block, or the special items ")" and ":"
|
|
if getline(v:lnum) =~# '^\s*\%()\|:\|\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)'
|
|
let indent -= shiftwidth()
|
|
endif
|
|
return indent
|
|
endfunction
|