2024-02-23 05:45:05 +11:00
|
|
|
|
" Vim :map commands
|
|
|
|
|
|
|
|
|
|
map!
|
|
|
|
|
map! lhs rhs
|
|
|
|
|
map
|
|
|
|
|
map lhs rhs
|
|
|
|
|
|
2025-03-07 18:49:11 +01:00
|
|
|
|
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
|
|
|
|
|
|
2024-02-23 05:45:05 +11:00
|
|
|
|
mapclear <buffer>
|
|
|
|
|
mapclear! <buffer>
|
|
|
|
|
nmapclear <buffer>
|
|
|
|
|
vmapclear <buffer>
|
|
|
|
|
xmapclear <buffer>
|
|
|
|
|
smapclear <buffer>
|
|
|
|
|
omapclear <buffer>
|
|
|
|
|
imapclear <buffer>
|
|
|
|
|
lmapclear <buffer>
|
|
|
|
|
cmapclear <buffer>
|
|
|
|
|
tmapclear <buffer>
|
2024-03-10 04:01:22 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" :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
|
|
|
|
|
|
2025-03-07 18:49:11 +01:00
|
|
|
|
map <Leader>baz
|
|
|
|
|
\ :echo (<Bar>
|
2024-03-10 04:01:22 +11:00
|
|
|
|
\
|
2025-03-07 18:49:11 +01:00
|
|
|
|
\'bar')<CR>
|
2024-03-10 04:01:22 +11:00
|
|
|
|
"\ 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"
|
|
|
|
|
|
|
|
|
|
|
2024-07-18 20:45:19 +02:00
|
|
|
|
" 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
|
|
|
|
|
|
|
|
|
|
|
2024-03-10 04:01:22 +11:00
|
|
|
|
" Issue #12672
|
|
|
|
|
|
2025-03-07 18:49:11 +01:00
|
|
|
|
nnoremap <Leader>foo :echo call(
|
2024-03-10 04:01:22 +11:00
|
|
|
|
"\ comment
|
|
|
|
|
\ {x->x},
|
2025-03-07 18:49:11 +01:00
|
|
|
|
\ ['foo'])<CR>
|
2024-03-10 04:01:22 +11:00
|
|
|
|
|
2025-03-07 18:49:11 +01:00
|
|
|
|
nnoremap <Leader>bar :echo (
|
2024-03-10 04:01:22 +11:00
|
|
|
|
\
|
2025-03-07 18:49:11 +01:00
|
|
|
|
\ 'bar')<CR>
|
2024-03-10 04:01:22 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Example:
|
|
|
|
|
" /autoload/netrw.vim
|
|
|
|
|
|
|
|
|
|
if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif
|