Mercurial > vim
annotate runtime/indent/tf.vim @ 14615:c6b41d47bac1 v8.1.0321
patch 8.1.0321: 'incsearch' regression: / highlights everything
commit https://github.com/vim/vim/commit/4edfe2d2a2d70ea66a7f73e9b923c2d1f6246a57
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 23 20:55:45 2018 +0200
patch 8.1.0321: 'incsearch' regression: /\v highlights everything
Problem: 'incsearch' regression: /\v highlights everything.
Solution: Put back the empty_pattern() check.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 23 Aug 2018 21:00:06 +0200 |
parents | 1218c5353e2b |
children | 4d76b3e07c07 |
rev | line source |
---|---|
1624 | 1 " Vim indent file |
2 " Language: tf (TinyFugue) | |
2239
732cb7b31956
Crypt the text in the undo file if the file itself is crypted.
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
3 " Maintainer: Christian J. Robinson <heptite@gmail.com> |
11062 | 4 " URL: http://www.vim.org/scripts/script.php?script_id=174 |
5 " Last Change: 2017 Feb 25 | |
1624 | 6 |
7 " Only load this indent file when no other was loaded. | |
8 if exists("b:did_indent") | |
9 finish | |
10 endif | |
11 let b:did_indent = 1 | |
12 | |
13 setlocal indentexpr=GetTFIndent() | |
14 setlocal indentkeys-=0{,0} indentkeys-=0# indentkeys-=: | |
15 setlocal indentkeys+==/endif,=/then,=/else,=/done,0; | |
16 | |
17 " Only define the function once: | |
18 if exists("*GetTFIndent") | |
19 finish | |
20 endif | |
21 | |
22 function GetTFIndent() | |
23 " Find a non-blank line above the current line: | |
24 let lnum = prevnonblank(v:lnum - 1) | |
25 | |
26 " No indent for the start of the file: | |
27 if lnum == 0 | |
28 return 0 | |
29 endif | |
30 | |
31 let ind = indent(lnum) | |
32 let line = getline(lnum) | |
33 | |
34 " No indentation if the previous line didn't end with "\": | |
35 " (Could be annoying, but it lets you know if you made a mistake.) | |
36 if line !~ '\\$' | |
37 return 0 | |
38 endif | |
39 | |
40 if line =~ '\(/def.*\\\|/for.*\(%;\s*\)\@\<!\\\)$' | |
11062 | 41 let ind = ind + shiftwidth() |
1624 | 42 elseif line =~ '\(/if\|/else\|/then\)' |
43 if line !~ '/endif' | |
11062 | 44 let ind = ind + shiftwidth() |
1624 | 45 endif |
46 elseif line =~ '/while' | |
47 if line !~ '/done' | |
11062 | 48 let ind = ind + shiftwidth() |
1624 | 49 endif |
50 endif | |
51 | |
52 let line = getline(v:lnum) | |
53 | |
54 if line =~ '\(/else\|/endif\|/then\)' | |
55 if line !~ '/if' | |
11062 | 56 let ind = ind - shiftwidth() |
1624 | 57 endif |
58 elseif line =~ '/done' | |
59 if line !~ '/while' | |
11062 | 60 let ind = ind - shiftwidth() |
1624 | 61 endif |
62 endif | |
63 | |
64 " Comments at the beginning of a line: | |
65 if line =~ '^\s*;' | |
66 let ind = 0 | |
67 endif | |
68 | |
69 | |
70 return ind | |
71 | |
72 endfunction |