annotate runtime/syntax/hitest.vim @ 14893:291656f731c9 v8.1.0458

patch 8.1.0458: ml_get error and crash when using "do" commit https://github.com/vim/vim/commit/df77cef92ec034796723ffa3adb12e8b46daa98e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 7 17:46:42 2018 +0200 patch 8.1.0458: ml_get error and crash when using "do" Problem: Ml_get error and crash when using "do". Solution: Adjust cursor position also when diffupdate is not needed. (Hirohito Higashi)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Oct 2018 18:00:05 +0200
parents 4f7081eb1e26
children d23afa4d8b63
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 syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: none; used to see highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Ronald Schild <rs@scutum.de>
11914
4f7081eb1e26 Updated runtime files
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
4 " Last Change: 2017 Jul 28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Version: 5.4n.1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " To see your current highlight settings, do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " :so $VIMRUNTIME/syntax/hitest.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " save global options and registers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let s:hidden = &hidden
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let s:lazyredraw = &lazyredraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 let s:more = &more
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 let s:report = &report
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 let s:shortmess = &shortmess
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 let s:wrapscan = &wrapscan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 let s:register_a = @a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 let s:register_se = @/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " set global options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 set hidden lazyredraw nomore report=99999 shortmess=aoOstTW wrapscan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " print current highlight settings into register a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 redir @a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 highlight
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Open a new window if the current one isn't empty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 if line("$") != 1 || getline(1) != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 new
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 " edit temporary file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 edit Highlight\ test
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " set local options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 setlocal autoindent noexpandtab formatoptions=t shiftwidth=16 noswapfile tabstop=16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 let &textwidth=&columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " insert highlight settings
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 % delete
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 put a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " remove the colored xxx items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 g/xxx /s///e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " remove color settings (not needed here)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 global! /links to/ substitute /\s.*$//e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 " move linked groups to the end of file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 global /links to/ move $
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 " move linked group names to the matching preferred groups
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 % substitute /^\(\w\+\)\s*\(links to\)\s*\(\w\+\)$/\3\t\2 \1/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 global /links to/ normal mz3ElD0#$p'zdd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " delete empty lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 global /^ *$/ delete
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " precede syntax command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 % substitute /^[^ ]*/syn keyword &\t&/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " execute syntax commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 % yank a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 @a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " remove syntax commands again
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 % substitute /^syn keyword //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " pretty formatting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 global /^/ exe "normal Wi\<CR>\t\eAA\ex"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 global /^\S/ join
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " find out first syntax highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 let b:various = &highlight.',:Normal,:Cursor,:,'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 let b:i = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 while b:various =~ ':'.substitute(getline(b:i), '\s.*$', ',', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 let b:i = b:i + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 if b:i > line("$") | break | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " insert headlines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 call append(0, "Highlighting groups for various occasions")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 call append(1, "-----------------------------------------")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 if b:i < line("$")-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let b:synhead = "Syntax highlighting groups"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 if exists("hitest_filetypes")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 redir @a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 let @a = substitute(@a, 'did_\(\w\+\)_syn\w*_inits\s*#1', ', \1', 'g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 let @a = substitute(@a, "\n\\w[^\n]*", '', 'g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let @a = substitute(@a, "\n", '', 'g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let @a = substitute(@a, '^,', '', 'g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 if @a != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 let b:synhead = b:synhead." - filetype"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 if @a =~ ','
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 let b:synhead = b:synhead."s"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 let b:synhead = b:synhead.":".@a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 call append(b:i+1, "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 call append(b:i+2, b:synhead)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 call append(b:i+3, substitute(b:synhead, '.', '-', 'g'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 " remove 'hls' highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 nohlsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 normal 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " we don't want to save this temporary file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 set nomodified
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 " the following trick avoids the "Press RETURN ..." prompt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 0 append
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 " restore global options and registers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 let &hidden = s:hidden
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 let &lazyredraw = s:lazyredraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 let &more = s:more
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 let &report = s:report
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 let &shortmess = s:shortmess
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 let &wrapscan = s:wrapscan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 let @a = s:register_a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 " restore last search pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 call histdel("search", -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 let @/ = s:register_se
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 " remove variables
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 unlet s:hidden s:lazyredraw s:more s:report s:shortmess
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 unlet s:wrapscan s:register_a s:register_se
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 " vim: ts=8