annotate runtime/indent/tcsh.vim @ 23043:6616bf17dc94 v8.2.2068

patch 8.2.2068: transparent syntax item uses start/end of containing region Commit: https://github.com/vim/vim/commit/b46f57e87b3706a8c4b97d8e03f7853a7938b061 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 29 14:11:41 2020 +0100 patch 8.2.2068: transparent syntax item uses start/end of containing region Problem: Transparent syntax item uses start/end of containing region. Solution: Do not change the startpos and endpos of a transparent region to that of its containing region. (Adrian Ghizaru, closes #7349, closes #7391)
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 Nov 2020 14:15:05 +0100
parents d0a20101ecb2
children 9c221ad9634a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: C-shell (tcsh)
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
3 " Maintainer: GI <a@b.c>, where a='gi1242+vim', b='gmail', c='com'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
4 " Last Modified: Sat 10 Dec 2011 09:23:00 AM EST
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 setlocal indentexpr=TcshGetIndent()
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 378
diff changeset
14 setlocal indentkeys+=e,0=end,0=endsw indentkeys-=0{,0},0),:,0#
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 if exists("*TcshGetIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 function TcshGetIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 let lnum = prevnonblank(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " Hit the start of the file, use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " Add indent if previous line begins with while or foreach
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " OR line ends with case <str>:, default:, else, then or \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 let line = getline(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
35 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 if line =~ '\v^\s*breaksw>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
39 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " Subtract indent if current line has on end, endif, case commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 let line = getline(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 if line =~ '\v^\s*%(else|end|endif)\s*$'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
45 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endfunction