comparison runtime/indent/yacc.vim @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children f14cbd913415
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
1 " Vim indent file
2 " Language: YACC input file
3 " Maintainer: Nikolai Weibull <source@pcppopper.org>
4 " URL: http://www.pcppopper.org/vim/indent/pcp/yacc/
5 " Latest Revision: 2004-04-25
6 " arch-tag: 629aa719-8fe4-4787-adb7-ae94ca801610
7
8 " Only load this indent file when no other was loaded.
9 if exists("b:did_indent")
10 finish
11 endif
12
13 let b:did_indent = 1
14
15 setlocal indentexpr=GetYaccIndent()
16 setlocal indentkeys=!^F,o,O
17
18 " Only define the function once.
19 if exists("*GetYaccIndent")
20 finish
21 endif
22
23 function GetYaccIndent()
24 if v:lnum == 1
25 return 0
26 endif
27
28 let ind = indent(v:lnum - 1)
29 let line = getline(v:lnum - 1)
30
31 if line == ''
32 let ind = 0
33 elseif line =~ '^\w\+\s*:'
34 let ind = ind + matchend(line, '^\w\+\s*')
35 elseif line =~ '^\s*;'
36 let ind = 0
37 else
38 let ind = indent(v:lnum)
39 endif
40
41 return ind
42 endfunction
43
44 " vim: set sts=2 sw=2: