codekingpro/portable-devtools
114k
1" Vim indent file2" Language: YACC input file3" Maintainer: Doug Kearns <dougkearns@gmail.com>4" Previous Maintainer: Nikolai Weibull <now@bitwi.se>5" Last Change: 2022 April 256 7" Only load this indent file when no other was loaded.8if exists("b:did_indent")9 finish10endif11 12let b:did_indent = 113 14setlocal indentexpr=GetYaccIndent()15setlocal indentkeys=!^F,o,O16setlocal nosmartindent17 18let b:undo_indent = "setl inde< indk< si<"19 20" Only define the function once.21if exists("*GetYaccIndent")22 finish23endif24 25function GetYaccIndent()26 if v:lnum == 127 return 028 endif29 30 let ind = indent(v:lnum - 1)31 let line = getline(v:lnum - 1)32 33 if line == ''34 let ind = 035 elseif line =~ '^\w\+\s*:'36 let ind = ind + matchend(line, '^\w\+\s*')37 elseif line =~ '^\s*;'38 let ind = 039 else40 let ind = indent(v:lnum)41 endif42 43 return ind44endfunction45 