annotate runtime/indent/ishd.vim @ 24381:7b84cf514dd8 v8.2.2731

patch 8.2.2731: Mac: SF symbols are not displayed properly Commit: https://github.com/vim/vim/commit/8dddc1f0e2e9eeb29fc59477b515bcd6bb1243ec Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 7 19:00:25 2021 +0200 patch 8.2.2731: Mac: SF symbols are not displayed properly Problem: Mac: SF symbols are not displayed properly. Solution: Add custom range to list of double-width characters. (Yee Cheng Chin, closes #8077)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Apr 2021 19:15:03 +0200
parents 63b0b7b79b25
children
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 " Description: InstallShield indenter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Author: Johannes Zellner <johannes@zellner.org>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Last Change: Tue, 27 Apr 2004 14:54:59 CEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
234
a686fd6c8beb updated for version 7.0065
vimboss
parents: 7
diff changeset
11 setlocal autoindent
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 setlocal indentexpr=GetIshdIndent(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 setlocal indentkeys&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentkeys+==else,=elseif,=endif,=end,=begin,<:>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " setlocal indentkeys-=0#
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
234
a686fd6c8beb updated for version 7.0065
vimboss
parents: 7
diff changeset
17 let b:undo_indent = "setl ai< indentexpr< indentkeys<"
a686fd6c8beb updated for version 7.0065
vimboss
parents: 7
diff changeset
18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if exists("*GetIshdIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 fun! GetIshdIndent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " labels and preprocessor get zero indent immediately
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 let this_line = getline(a:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let LABELS_OR_PREPROC = '^\s*\(\<\k\+\>:\s*$\|#.*\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 let LABELS_OR_PREPROC_EXCEPT = '^\s*\<default\+\>:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 if this_line =~ LABELS_OR_PREPROC && this_line !~ LABELS_OR_PREPROC_EXCEPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Skip over labels and preprocessor directives.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 let lnum = a:lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 while lnum > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let lnum = prevnonblank(lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 let previous_line = getline(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if previous_line !~ LABELS_OR_PREPROC || previous_line =~ LABELS_OR_PREPROC_EXCEPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Hit the start of the file, use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " Add
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 234
diff changeset
53 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 " Subtract
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 if this_line =~ '^\s*\<endswitch\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 234
diff changeset
58 let ind = ind - 2 * shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 234
diff changeset
60 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 elseif this_line =~ '^\s*\<\(case\|default\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 if previous_line !~ '^\s*\<switch\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 234
diff changeset
63 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endfun