[英]switching windows with <leader> instead of ctrl
I recently start using leader key in vim, and mapped to space
我最近开始在vim中使用leader key,并mapped to space
Earlier I use window switching with ctrl + {h, j, k, l}
之前我使用 window 切换与ctrl + {h, j, k, l}
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
And now I was trying something like现在我正在尝试类似的东西
nnoremap <leader>h <C-w>h
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>l <C-w>l
I already remove any prior mapping with the above mentioned key.我已经使用上述密钥删除了任何先前的映射。
Now issue I am facing is, with ctrl key i can switch the window panes without lifting finger from ctrl
现在我面临的问题是,使用 ctrl 键我可以切换 window 窗格,而无需从ctrl
抬起手指
While with space I have to press Leader and {h, j, k, l}
simultaneously and then I have to press leader and {h, j, k, l}
if want to go to some other window pane.虽然有空格,但我必须同时按Leader and {h, j, k, l}
,然后如果想要 go 到其他一些 window 窗格,我必须按leader and {h, j, k, l}
。
What I am trying to say is, let say my window vertically split b/w two and I wish to go to second window and come back to original.我想说的是,让我说我的 window 垂直分割黑白两个,我希望 go 到第二个 window 并回到原来的状态。
With ctrl
key: ctrl + l + h
使用ctrl
键: ctrl + l + h
with leader
key: space + l, space + h
带leader
键: space + l, space + h
I want my leader key work exact same as ctrl, since it is convenient to use我希望我的领导键工作与 ctrl 完全相同,因为它使用起来很方便
Is this possible?这可能吗?
Also If you have some advice for newbie like me, I will be glad to hear it.另外,如果您对像我这样的新手有一些建议,我会很高兴听到的。
What you call "leader key" is not a special key at all and certainly not a modifier , like Ctrl
, Shift
, or Alt
so you can't make it work like one.您所说的“前导键”根本不是特殊键,当然也不是修饰符,例如Ctrl
、 Shift
或Alt
所以你不能让它像一个键一样工作。 Unless they involve one of those modifiers, Vim mappings are always sequential: you press the first key, then the second one, etc.除非它们涉及其中一个修饰符,否则 Vim 映射始终是顺序的:您按第一个键,然后按第二个键,依此类推。
If you absolutely want chord-like mappings, you could try arpeggio .如果你绝对想要类似和弦的映射,你可以试试arpeggio 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.