mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -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>
64 lines
1.8 KiB
VimL
64 lines
1.8 KiB
VimL
" Vim indent file
|
|
" Language: RPL/2
|
|
" Version: 0.2
|
|
" Last Change: 2005 Mar 28
|
|
" Maintainer: BERTRAND Joël <rpl2@free.fr>
|
|
|
|
" Only load this indent file when no other was loaded.
|
|
if exists("b:did_indent")
|
|
finish
|
|
endif
|
|
let b:did_indent = 1
|
|
|
|
setlocal autoindent
|
|
setlocal indentkeys+==~end,=~case,=~if,=~then,=~else,=~do,=~until,=~while,=~repeat,=~select,=~default,=~for,=~start,=~next,=~step,<<>,<>>
|
|
|
|
" Define the appropriate indent function but only once
|
|
setlocal indentexpr=RplGetFreeIndent()
|
|
if exists("*RplGetFreeIndent")
|
|
finish
|
|
endif
|
|
|
|
let b:undo_indent = "set ai< indentkeys< indentexpr<"
|
|
|
|
function RplGetIndent(lnum)
|
|
let ind = indent(a:lnum)
|
|
let prevline=getline(a:lnum)
|
|
" Strip tail comment
|
|
let prevstat=substitute(prevline, '!.*$', '', '')
|
|
|
|
" Add a shiftwidth to statements following if, iferr, then, else, elseif,
|
|
" case, select, default, do, until, while, repeat, for, start
|
|
if prevstat =~? '\<\(if\|iferr\|do\|while\)\>' && prevstat =~? '\<end\>'
|
|
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\+\)'
|
|
let ind = ind + &sw
|
|
endif
|
|
|
|
" Subtract a shiftwidth from then, else, elseif, end, until, repeat, next,
|
|
" step
|
|
let line = getline(v:lnum)
|
|
if line =~? '^\s*\(then\|else\|elseif\|until\|repeat\|next\|step\|default\|end\)\>'
|
|
let ind = ind - &sw
|
|
elseif line =~? '^\s*>>\($\|\s\+\)'
|
|
let ind = ind - &sw
|
|
endif
|
|
|
|
return ind
|
|
endfunction
|
|
|
|
function RplGetFreeIndent()
|
|
" Find the previous non-blank line
|
|
let lnum = prevnonblank(v:lnum - 1)
|
|
|
|
" Use zero indent at the top of the file
|
|
if lnum == 0
|
|
return 0
|
|
endif
|
|
|
|
let ind=RplGetIndent(lnum)
|
|
return ind
|
|
endfunction
|
|
|
|
" vim:sw=2 tw=130
|