annotate runtime/indent/tcsh.vim @ 2994:7f4f5ca70dbd v7.3.269

updated for version 7.3.269 Problem: 'shellcmdflag' only works with one flag. Solution: Split into multiple arguments. (Gary Johnson)
author Bram Moolenaar <bram@vim.org>
date Thu, 04 Aug 2011 22:59:28 +0200
parents 18ee39301b82
children 8b8ef1fed009
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)
378
6b49757d378c updated for version 7.0098
vimboss
parents: 7
diff changeset
3 " Maintainer: Gautam Iyer <gautam@math.uchicago.edu>
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 378
diff changeset
4 " Last Modified: Sat 16 Jun 2007 04:27:45 PM PDT
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 set cpoptions-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 function TcshGetIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 let lnum = prevnonblank(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " Hit the start of the file, use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " Add indent if previous line begins with while or foreach
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " OR line ends with case <str>:, default:, else, then or \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 let line = getline(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let ind = ind + &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if line =~ '\v^\s*breaksw>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 let ind = ind - &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Subtract indent if current line has on end, endif, case commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 let line = getline(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 if line =~ '\v^\s*%(else|end|endif)\s*$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 let ind = ind - &sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 endfunction