[英]Vim mapping for diffget | diffput not working with v:count
Pretty new to mappings in Vim, Vim 中的映射很新,
In Diff Mode I've got C-Up
and C-Down
mapped to [c
and ]c
for diffjumping.在 Diff 模式下,我将
C-Up
和C-Down
映射到[c
和]c
以进行 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.我想要 map
C-Right
和C-Left
到:<CU>diffput v:count<CR>
和:<CU>diffget v:count<CR>
分别加速合并。
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".但是我收到错误“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?该命令看起来是从字面上理解 v:count 并运行
:diffget v:count
而不是:diffget 3
例如..我如何让 v:count 解析为一个数字? like dereference the variable?喜欢取消引用变量?
I can echo "diffget v:count"
and that looks to be correct... but obviously doesn't do anything...我可以
echo "diffget v:count"
,这看起来是正确的……但显然什么也没做……
Found the answer in vi.SE在 vi.SE 中找到答案
<expr> <C-Left> ":\<CU>diffget ".. v:count.. "\<CR>"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.