Mercurial > vim
annotate runtime/syntax/testdir/input/vim_ex_map.vim @ 35745:154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Commit: https://github.com/vim/vim/commit/99984fc58abf8dd5dac76c80635a724a94824e69
Author: Doug Kearns <dougkearns@gmail.com>
Date: Thu Jul 18 20:45:19 2024 +0200
runtime(vim): Update base-syntax, improve :map highlighting
Match :map ( RHS properly.
Only match ! after :map, :noremap, :unmap and :mapclear.
closes: #15297
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 18 Jul 2024 21:01:56 +0200 |
parents | 97fc56ee7ca7 |
children |
rev | line source |
---|---|
34402
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Vim :map commands |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 map! |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 map! lhs rhs |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 map |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 map lhs rhs |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 mapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 mapclear! <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 nmapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 vmapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 xmapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 smapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 omapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 imapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 lmapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 cmapclear <buffer> |
80f395e142c6
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 tmapclear <buffer> |
34513
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
19 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
20 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
21 " :help map-bar |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
22 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
23 " <Bar> '<' is not in 'cpoptions' |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
24 map _l :!ls <Bar> more^M:echo "rhs"<CR> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
25 " \| 'b' is not in 'cpoptions' |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
26 map _l :!ls \| more^M:echo "rhs"<CR> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
27 " ^V| always, in Vim and Vi |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
28 map _l :!ls | more^M:echo "rhs"<CR> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
29 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
30 map lhs :search('foo\\|bar')<CR>:echo "rhs"<CR> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
31 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
32 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
33 " multiline RHS |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
34 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
35 map <leader>baz |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
36 \ :echo (<bar> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
37 \ |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
38 \'bar')<cr> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
39 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
40 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
41 map lhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
42 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
43 \ echo "foo" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
44 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
45 map lhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
46 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
47 \ echo "foo" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
48 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
49 map lhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
50 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
51 \ echo "foo" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
52 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
53 map l hs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
54 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
55 \ echo "foo" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
56 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
57 map l hs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
58 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
59 \ echo "foo" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
60 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
61 map lhs rhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
62 map l h s rhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
63 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
64 map lhs |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
65 "\ comment (matches as RHS but harmless) |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
66 echo "clear" |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
67 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
68 |
35745
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
69 " Differentiate map() from :map |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
70 |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
71 map ( :echo "open-paren"<CR> |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
72 |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
73 call map(list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
74 call map (list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
75 |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
76 function Foo() |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
77 map ( :echo "open-paren"<CR> |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
78 call map(list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
79 call map (list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
80 endfunction |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
81 |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
82 def Foo() |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
83 map ( :echo "open-paren"<CR> |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
84 map(list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
85 # :map LHS=(list, RHS='v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
86 map (list, 'v:val') |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
87 enddef |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
88 |
154ebf2de10d
runtime(vim): Update base-syntax, improve :map highlighting
Christian Brabandt <cb@256bit.org>
parents:
34513
diff
changeset
|
89 |
34513
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
90 " Issue #12672 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
91 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
92 nnoremap <leader>foo :echo call( |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
93 "\ comment |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
94 \ {x->x}, |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
95 \ ['foo'])<cr> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
96 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
97 nnoremap <leader>bar :echo ( |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
98 \ |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
99 \ 'bar')<cr> |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
100 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
101 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
102 " Example: |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
103 " /autoload/netrw.vim |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
104 |
97fc56ee7ca7
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Christian Brabandt <cb@256bit.org>
parents:
34402
diff
changeset
|
105 if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif |