annotate runtime/indent/treetop.vim @ 11931:689bcb8f241c v8.0.0845

patch 8.0.0845: MS-Windows: missing semicolon in terminal code commit https://github.com/vim/vim/commit/d8dc1799377027be622d8571545658b20042e92e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 3 11:55:21 2017 +0200 patch 8.0.0845: MS-Windows: missing semicolon in terminal code Problem: MS-Windows: missing semicolon in terminal code. Solution: Add it. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/1923)
author Christian Brabandt <cb@256bit.org>
date Thu, 03 Aug 2017 12:00:04 +0200
parents d0a20101ecb2
children 11b656e74444
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
11062
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 2725
diff changeset
2 " Language: Treetop
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 2725
diff changeset
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 2725
diff changeset
4 " Latest Revision: 2011-03-14
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 if exists("b:did_indent")
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 finish
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 let b:did_indent = 1
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 setlocal indentexpr=GetTreetopIndent()
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 setlocal indentkeys=0{,0},!^F,o,O,=end
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 setlocal nosmartindent
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 if exists("*GetTreetopIndent")
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 finish
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 function GetTreetopIndent()
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 let pnum = prevnonblank(v:lnum - 1)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 if pnum == 0
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 return 0
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 let ind = indent(pnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 let line = getline(pnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 if line =~ '^\s*\%(grammar\|module\|rule\)\>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
29 let ind += shiftwidth()
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 let line = getline(v:lnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 if line =~ '^\s*end\>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
34 let ind -= shiftwidth()
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 end
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 retur ind
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 endfunction