Pretty new to mappings in Vim,
In Diff Mode I've got C-Up
and C-Down
mapped to [c
and ]c
for diffjumping. I'm wanting to map C-Right
and C-Left
to :<CU>diffput v:count<CR>
and :<CU>diffget v:count<CR>
respectively to speed up merging.
nnoremap <C-Left> :<C-U>diffget v:count<CR>
nnoremap <C-Right> :<C-U>diffput v:count<CR>
nnoremap <C-Up> [c
nnoremap <C-Down> ]c
This should.... put from buffer # or get from buffer #.
But I get the error "no matching buffer for v:count".
the command looks to be taking v:count literally and running :diffget v:count
instead of :diffget 3
for example.. how do I get v:count to resolve to a number? like dereference the variable?
I can echo "diffget v:count"
and that looks to be correct... but obviously doesn't do anything...
Found the answer in vi.SE
<expr> <C-Left> ":\<CU>diffget ".. v:count.. "\<CR>"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.