0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00
vim/runtime/syntax/testdir/input/vim_ex_map.vim
Doug Kearns b88f9e4a04 runtime(vim): Update base syntax, fix :map termination in :command RHS
Ensure :map (and :abbreviate) terminate at | when included in :command
replacement strings containing commands separated by line continuations.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
2025-08-01 22:20:15 +10:00

125 lines
2.0 KiB
VimL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

" Vim :map commands
" VIM_TEST_SETUP hi link vimMapLhs Identifier
" VIM_TEST_SETUP hi link vimMapRhs Todo
" VIM_TEST_SETUP hi link vimMapRhsContinue Todo
map!
map! lhs rhs
map
map lhs rhs
map <buffer><expr><nowait><script><silent><special><unique> lhs rhs
map <buffer> <expr> <nowait> <script> <silent> <special> <unique> lhs rhs
" :map special arguments are case sensitive, <BUFFER> is the LHS
map <BUFFER> rhs
map <Leader>lhs rhs
map <LocalLeader>lhs rhs
map lhs <Leader>rhs
map lhs <LocalLeader>rhs
map lhs <Plug>rhs
mapclear <buffer>
mapclear! <buffer>
nmapclear <buffer>
vmapclear <buffer>
xmapclear <buffer>
smapclear <buffer>
omapclear <buffer>
imapclear <buffer>
lmapclear <buffer>
cmapclear <buffer>
tmapclear <buffer>
" :help map-bar
" <Bar> '<' is not in 'cpoptions'
map _l :!ls <Bar> more^M:echo "rhs"<CR>
" \| 'b' is not in 'cpoptions'
map _l :!ls \| more^M:echo "rhs"<CR>
" ^V| always, in Vim and Vi
map _l :!ls | more^M:echo "rhs"<CR>
map lhs :search('foo\\|bar')<CR>:echo "rhs"<CR>
" Multiline RHS
map <Leader>baz
\ :echo (<Bar>
\
\'bar')<CR>
"\ comment
map lhs
"\ comment
\ echo "foo"
map lhs
"\ comment
\ echo "foo"
map lhs
"\ comment
\ echo "foo"
map l hs
"\ comment
\ echo "foo"
map l hs
"\ comment
\ echo "foo"
map lhs rhs
map l h s rhs
map lhs
"\ comment (matches as RHS but harmless)
echo "clear"
" Differentiate map() from :map
map ( :echo "open-paren"<CR>
call map(list, 'v:val')
call map (list, 'v:val')
function Foo()
map ( :echo "open-paren"<CR>
call map(list, 'v:val')
call map (list, 'v:val')
endfunction
def Foo()
map ( :echo "open-paren"<CR>
map(list, 'v:val')
# :map LHS=(list, RHS='v:val')
map (list, 'v:val')
enddef
" Issue #12672
nnoremap <Leader>foo :echo call(
"\ comment
\ {x->x},
\ ['foo'])<CR>
nnoremap <Leader>bar :echo (
\
\ 'bar')<CR>
" Example:
" /autoload/netrw.vim
if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif