Mercurial > repo
view src/ploki/indent/ploki.vim @ 7490:fb46ec3ff0ae
<hppavilion[1]> ` echo "F=\\"$(find esobible -name \\"*$(echo "$1" | lowercase)*\\" -type f | shuf -n1)\\"; echo -n \\"${F#esobible/}/\\" | rnooodl; cat \\"$F\\" | rnooodl" > bin/bookofeso
author | HackBot |
---|---|
date | Tue, 19 Apr 2016 20:14:09 +0000 |
parents | ac0403686959 |
children |
line wrap: on
line source
" Only load this one if no other indent file was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetPlokiIndent() setlocal indentkeys=!^F,o,O,0=ELSE,0=END\ IF,0=FI,0=KTHX " Only define the function once. if exists("*GetPlokiIndent") finish endif function GetPlokiIndent() if v:lnum == 1 return 0 endif let plnum = v:lnum - 1 let prevline = getline(plnum) while plnum > 0 && prevline =~ '^\s*$' let plnum = plnum - 1 let prevline = getline(plnum) endwhile let ind = indent(plnum) let thisline = getline(v:lnum) if prevline =~ '^FOR\%(\s*\S\+\)\@>\%(\s*KTHX\)\@!' let ind = ind + &sw endif if prevline =~ '^\s*\%(FOR\s*\S\+\|\d*\)\s*\%(IF\|ELSE\)' let ind = ind + &sw endif if thisline =~ '^\s*\%(FOR\s*\S\+\|\d*\)\s*\%(ELSE\|END IF\|FI\)' let ind = ind - &sw elseif ind == &sw && thisline =~ '^\s*\%(\d\+\s*\)\=KTHX' let ind = ind - &sw endif return ind endfunction