Mercurial > vim
annotate runtime/indent/teraterm.vim @ 19017:d9ea4f0bfd34 v8.2.0069
patch 8.2.0069: ETYPE_ is used for two different enums
Commit: https://github.com/vim/vim/commit/87396072c5c468f0c129e4ec7cd944ac897b7752
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 31 22:36:18 2019 +0100
patch 8.2.0069: ETYPE_ is used for two different enums
Problem: ETYPE_ is used for two different enums.
Solution: Rename one to use EXPR_.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 31 Dec 2019 22:45:03 +0100 |
parents | 34fd018452ed |
children | ebedba7a4898 |
rev | line source |
---|---|
6951 | 1 " Vim indent file |
2 " Language: Tera Term Language (TTL) | |
14668 | 3 " Based on Tera Term Version 4.100 |
6951 | 4 " Maintainer: Ken Takata |
5 " URL: https://github.com/k-takata/vim-teraterm | |
14668 | 6 " Last Change: 2018-08-31 |
6951 | 7 " Filenames: *.ttl |
8 " License: VIM License | |
9 | |
10 if exists("b:did_indent") | |
11 finish | |
12 endif | |
13 let b:did_indent = 1 | |
14 | |
15 setlocal nosmartindent | |
16 setlocal noautoindent | |
17 setlocal indentexpr=GetTeraTermIndent(v:lnum) | |
18 setlocal indentkeys=!^F,o,O,e | |
19 setlocal indentkeys+==elseif,=endif,=loop,=next,=enduntil,=endwhile | |
20 | |
21 if exists("*GetTeraTermIndent") | |
22 finish | |
23 endif | |
24 | |
25 function! GetTeraTermIndent(lnum) | |
26 let l:prevlnum = prevnonblank(a:lnum-1) | |
27 if l:prevlnum == 0 | |
28 " top of file | |
29 return 0 | |
30 endif | |
31 | |
32 " grab the previous and current line, stripping comments. | |
33 let l:prevl = substitute(getline(l:prevlnum), ';.*$', '', '') | |
34 let l:thisl = substitute(getline(a:lnum), ';.*$', '', '') | |
35 let l:previ = indent(l:prevlnum) | |
36 | |
37 let l:ind = l:previ | |
38 | |
9908
2b6654519a7c
commit https://github.com/vim/vim/commit/7571d55f7dcc009a375b2124cce2c8b21f361234
Christian Brabandt <cb@256bit.org>
parents:
6951
diff
changeset
|
39 if l:prevl =~ '^\s*if\>.*\<then\>' |
6951 | 40 " previous line opened a block |
11518 | 41 let l:ind += shiftwidth() |
6951 | 42 endif |
43 if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>' | |
44 " previous line opened a block | |
11518 | 45 let l:ind += shiftwidth() |
6951 | 46 endif |
47 if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>' | |
48 " this line closed a block | |
11518 | 49 let l:ind -= shiftwidth() |
6951 | 50 endif |
51 | |
52 return l:ind | |
53 endfunction | |
54 | |
55 " vim: ts=8 sw=2 sts=2 |