Mercurial > vim
annotate runtime/syntax/nroff.vim @ 25102:b7062becbfb5 v8.2.3088
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Commit: https://github.com/vim/vim/commit/9cee4a1c9c69542ccd73bcd2db05920150856361
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 3 15:08:37 2021 +0200
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Problem: With 'virtualedit' set to "block" Visual highlight is wrong after
using "$". (Marco Trosi)
Solution: Do not set w_old_cursor_lcol to MAXCOL. (closes #8495)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Jul 2021 15:15:03 +0200 |
parents | 4ab4ef0c48b1 |
children |
rev | line source |
---|---|
7 | 1 " VIM syntax file |
2 " Language: nroff/groff | |
24278 | 3 " Maintainer: John Marshall <jmarshall@hey.com> |
4 " Previous Maintainer: Pedro Alejandro López-Valencia <palopezv@gmail.com> | |
5 " Previous Maintainer: Jérôme Plût <Jerome.Plut@ens.fr> | |
6 " Last Change: 2021 Mar 28 | |
7 | 7 " |
8 " {{{1 Todo | |
9 " | |
10 " TODO: | |
11 " | |
12 " * Write syntax highlighting files for the preprocessors, | |
13 " and integrate with nroff.vim. | |
14 " | |
15 " | |
16 " {{{1 Start syntax highlighting. | |
17 " | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3312
diff
changeset
|
18 " quit when a syntax file was already loaded |
7 | 19 " |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3312
diff
changeset
|
20 if exists("b:current_syntax") |
7 | 21 finish |
22 endif | |
23 | |
3312 | 24 let s:cpo_save = &cpo |
25 set cpo&vim | |
26 | |
24278 | 27 if exists("nroff_is_groff") |
28 let b:nroff_is_groff = 1 | |
29 endif | |
30 | |
31 syn spell toplevel | |
32 syn case match | |
33 | |
7 | 34 " |
35 " {{{1 plugin settings... | |
36 " | |
37 " {{{2 enable spacing error highlighting | |
38 " | |
39 if exists("nroff_space_errors") | |
40 syn match nroffError /\s\+$/ | |
41 syn match nroffSpaceError /[.,:;!?]\s\{2,}/ | |
42 endif | |
43 " | |
44 " | |
45 " {{{1 Special file settings | |
46 " | |
47 " {{{2 ms exdented paragraphs are not in the default paragraphs list. | |
48 " | |
49 setlocal paragraphs+=XP | |
50 " | |
24278 | 51 " {{{2 Activate navigation to preprocessor sections. |
7 | 52 " |
53 if exists("b:preprocs_as_sections") | |
54 setlocal sections=EQTSPS[\ G1GS | |
55 endif | |
56 | |
57 " {{{1 Escape sequences | |
58 " ------------------------------------------------------------ | |
59 | |
60 syn match nroffEscChar /\\[CN]/ nextgroup=nroffEscCharArg | |
61 syn match nroffEscape /\\[*fgmnYV]/ nextgroup=nroffEscRegPar,nroffEscRegArg | |
62 syn match nroffEscape /\\s[+-]\=/ nextgroup=nroffSize | |
63 syn match nroffEscape /\\[$AbDhlLRvxXZ]/ nextgroup=nroffEscPar,nroffEscArg | |
64 | |
65 syn match nroffEscRegArg /./ contained | |
66 syn match nroffEscRegArg2 /../ contained | |
67 syn match nroffEscRegPar /(/ contained nextgroup=nroffEscRegArg2 | |
68 syn match nroffEscArg /./ contained | |
69 syn match nroffEscArg2 /../ contained | |
70 syn match nroffEscPar /(/ contained nextgroup=nroffEscArg2 | |
71 syn match nroffSize /\((\d\)\=\d/ contained | |
72 | |
73 syn region nroffEscCharArg start=/'/ end=/'/ contained | |
74 syn region nroffEscArg start=/'/ end=/'/ contained contains=nroffEscape,@nroffSpecial | |
75 | |
76 if exists("b:nroff_is_groff") | |
77 syn region nroffEscRegArg matchgroup=nroffEscape start=/\[/ end=/\]/ contained oneline | |
78 syn region nroffSize matchgroup=nroffEscape start=/\[/ end=/\]/ contained | |
79 endif | |
80 | |
81 syn match nroffEscape /\\[adprtu{}]/ | |
82 syn match nroffEscape /\\$/ | |
83 syn match nroffEscape /\\\$[@*]/ | |
84 | |
85 " {{{1 Strings and special characters | |
86 " ------------------------------------------------------------ | |
87 | |
88 syn match nroffSpecialChar /\\[\\eE?!-]/ | |
89 syn match nroffSpace "\\[&%~|^0)/,]" | |
90 syn match nroffSpecialChar /\\(../ | |
91 | |
92 if exists("b:nroff_is_groff") | |
93 syn match nroffSpecialChar /\\\[[^]]*]/ | |
94 syn region nroffPreserve matchgroup=nroffSpecialChar start=/\\?/ end=/\\?/ oneline | |
95 endif | |
96 | |
97 syn region nroffPreserve matchgroup=nroffSpecialChar start=/\\!/ end=/$/ oneline | |
98 | |
99 syn cluster nroffSpecial contains=nroffSpecialChar,nroffSpace | |
100 | |
101 | |
102 syn region nroffString start=/"/ end=/"/ skip=/\\$/ contains=nroffEscape,@nroffSpecial contained | |
103 syn region nroffString start=/'/ end=/'/ skip=/\\$/ contains=nroffEscape,@nroffSpecial contained | |
104 | |
105 | |
106 " {{{1 Numbers and units | |
107 " ------------------------------------------------------------ | |
108 syn match nroffNumBlock /[0-9.]\a\=/ contained contains=nroffNumber | |
109 syn match nroffNumber /\d\+\(\.\d*\)\=/ contained nextgroup=nroffUnit,nroffBadChar | |
110 syn match nroffNumber /\.\d\+)/ contained nextgroup=nroffUnit,nroffBadChar | |
111 syn match nroffBadChar /./ contained | |
112 syn match nroffUnit /[icpPszmnvMu]/ contained | |
113 | |
114 | |
115 " {{{1 Requests | |
116 " ------------------------------------------------------------ | |
117 | |
118 " Requests begin with . or ' at the beginning of a line, or | |
119 " after .if or .ie. | |
120 | |
121 syn match nroffReqLeader /^[.']/ nextgroup=nroffReqName skipwhite | |
122 syn match nroffReqLeader /[.']/ contained nextgroup=nroffReqName skipwhite | |
123 | |
124 if exists("b:nroff_is_groff") | |
125 " | |
126 " GNU troff allows long request names | |
127 " | |
829 | 128 syn match nroffReqName /[^\t \\\[?]\+/ contained nextgroup=nroffReqArg |
7 | 129 else |
130 syn match nroffReqName /[^\t \\\[?]\{1,2}/ contained nextgroup=nroffReqArg | |
131 endif | |
132 | |
829 | 133 syn region nroffReqArg start=/\S/ skip=/\\$/ end=/$/ contained contains=nroffEscape,@nroffSpecial,nroffString,nroffError,nroffSpaceError,nroffNumBlock,nroffComment |
7 | 134 |
135 " {{{2 Conditional: .if .ie .el | |
136 syn match nroffReqName /\(if\|ie\)/ contained nextgroup=nroffCond skipwhite | |
137 syn match nroffReqName /el/ contained nextgroup=nroffReqLeader skipwhite | |
138 syn match nroffCond /\S\+/ contained nextgroup=nroffReqLeader skipwhite | |
139 | |
140 " {{{2 String definition: .ds .as | |
141 syn match nroffReqname /[da]s/ contained nextgroup=nroffDefIdent skipwhite | |
142 syn match nroffDefIdent /\S\+/ contained nextgroup=nroffDefinition skipwhite | |
143 syn region nroffDefinition matchgroup=nroffSpecialChar start=/"/ matchgroup=NONE end=/\\"/me=e-2 skip=/\\$/ start=/\S/ end=/$/ contained contains=nroffDefSpecial | |
144 syn match nroffDefSpecial /\\$/ contained | |
145 syn match nroffDefSpecial /\\\((.\)\=./ contained | |
146 | |
147 if exists("b:nroff_is_groff") | |
148 syn match nroffDefSpecial /\\\[[^]]*]/ contained | |
149 endif | |
150 | |
151 " {{{2 Macro definition: .de .am, also diversion: .di | |
152 syn match nroffReqName /\(d[ei]\|am\)/ contained nextgroup=nroffIdent skipwhite | |
153 syn match nroffIdent /[^[?( \t]\+/ contained | |
154 if exists("b:nroff_is_groff") | |
155 syn match nroffReqName /als/ contained nextgroup=nroffIdent skipwhite | |
156 endif | |
157 | |
158 " {{{2 Register definition: .rn .rr | |
159 syn match nroffReqName /[rn]r/ contained nextgroup=nroffIdent skipwhite | |
160 if exists("b:nroff_is_groff") | |
161 syn match nroffReqName /\(rnn\|aln\)/ contained nextgroup=nroffIdent skipwhite | |
162 endif | |
163 | |
164 | |
165 " {{{1 eqn/tbl/pic | |
166 " ------------------------------------------------------------ | |
167 " <jp> | |
168 " XXX: write proper syntax highlight for eqn / tbl / pic ? | |
169 " <jp /> | |
170 | |
171 syn region nroffEquation start=/^\.\s*EQ\>/ end=/^\.\s*EN\>/ | |
24278 | 172 syn region nroffTable start=/^\.\s*TS\>/ end=/^\.\s*TE\>/ contains=@Spell |
7 | 173 syn region nroffPicture start=/^\.\s*PS\>/ end=/^\.\s*PE\>/ |
24278 | 174 syn region nroffRefer start=/^\.\s*\[\>/ end=/^\.\s*\]\>/ contains=@Spell |
7 | 175 syn region nroffGrap start=/^\.\s*G1\>/ end=/^\.\s*G2\>/ |
176 syn region nroffGremlin start=/^\.\s*GS\>/ end=/^\.\s*GE|GF\>/ | |
177 | |
178 " {{{1 Comments | |
179 " ------------------------------------------------------------ | |
180 | |
181 syn region nroffIgnore start=/^[.']\s*ig/ end=/^['.]\s*\./ | |
24278 | 182 syn match nroffComment /\(^[.']\s*\)\=\\".*/ contains=nroffTodo,@Spell |
183 syn match nroffComment /^'''.*/ contains=nroffTodo,@Spell | |
7 | 184 |
185 if exists("b:nroff_is_groff") | |
24278 | 186 syn match nroffComment "\\#.*$" contains=nroffTodo,@Spell |
7 | 187 endif |
188 | |
189 syn keyword nroffTodo TODO XXX FIXME contained | |
190 | |
191 " {{{1 Hilighting | |
192 " ------------------------------------------------------------ | |
193 " | |
194 | |
195 " | |
196 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3312
diff
changeset
|
197 " Only when an item doesn't have highlighting yet |
7 | 198 " |
199 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
200 hi def link nroffEscChar nroffSpecialChar |
24278 | 201 hi def link nroffEscCharArg nroffSpecialChar |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
202 hi def link nroffSpecialChar SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
203 hi def link nroffSpace Delimiter |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3312
diff
changeset
|
204 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
205 hi def link nroffEscRegArg2 nroffEscRegArg |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
206 hi def link nroffEscRegArg nroffIdent |
7 | 207 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
208 hi def link nroffEscArg2 nroffEscArg |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
209 hi def link nroffEscPar nroffEscape |
7 | 210 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
211 hi def link nroffEscRegPar nroffEscape |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
212 hi def link nroffEscArg nroffEscape |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
213 hi def link nroffSize nroffEscape |
24278 | 214 hi def link nroffEscape PreProc |
7 | 215 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
216 hi def link nroffIgnore Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
217 hi def link nroffComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
218 hi def link nroffTodo Todo |
7 | 219 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
220 hi def link nroffReqLeader nroffRequest |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
221 hi def link nroffReqName nroffRequest |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
222 hi def link nroffRequest Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
223 hi def link nroffCond PreCondit |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
224 hi def link nroffDefIdent nroffIdent |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
225 hi def link nroffIdent Identifier |
7 | 226 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
227 hi def link nroffEquation PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
228 hi def link nroffTable PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
229 hi def link nroffPicture PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
230 hi def link nroffRefer PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
231 hi def link nroffGrap PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
232 hi def link nroffGremlin PreProc |
7 | 233 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
234 hi def link nroffNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
235 hi def link nroffBadChar nroffError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
236 hi def link nroffSpaceError nroffError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
237 hi def link nroffError Error |
7 | 238 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
239 hi def link nroffPreserve String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
240 hi def link nroffString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
241 hi def link nroffDefinition String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
242 hi def link nroffDefSpecial Special |
7 | 243 |
244 | |
245 let b:current_syntax = "nroff" | |
246 | |
3312 | 247 let &cpo = s:cpo_save |
248 unlet s:cpo_save | |
7 | 249 " vim600: set fdm=marker fdl=2: |