'Vim mapping for diffget | diffput not working with v:count
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 :<C-U>diffput v:count<CR> and :<C-U>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...
Solution 1:[1]
Found the answer in vi.SE
<expr> <C-Left> ":\<C-U>diffget " .. v:count .. "\<CR>"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jackleberryfin |
