robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
521e91e1c4
master
1" Vim indent file 2" Language: Treetop 3" Maintainer: Doug Kearns <dougkearns@gmail.com> 4" Previous Maintainer: Nikolai Weibull <now@bitwi.se> 5" Last Change: 2022 April 25 6 7if exists ( "b:did_indent" ) 8finish 9endif 10let b: did_indent = 1 11 12setlocal indentexpr = GetTreetopIndent () 13setlocal indentkeys = 0{,0},!^F,o,O,=end 14setlocal nosmartindent 15 16let b: undo_indent = "setl inde< indk< si<" 17 18if exists ( "*GetTreetopIndent" ) 19finish 20endif 21 22function GetTreetopIndent () 23let pnum = prevnonblank ( v: lnum - 1 ) 24if pnum == 0 25return 0 26endif 27 28let ind = indent ( pnum ) 29let line = getline ( pnum ) 30 31if line =~ '^\s*\%(grammar\|module\|rule\)\>' 32let ind += shiftwidth () 33endif 34 35let line = getline ( v: lnum ) 36if line =~ '^\s*end\>' 37let ind -= shiftwidth () 38end 39 40return ind 41endfunction