简体   繁体   English

Vim的: <leader> h映射速度慢

[英]Vim: <leader>h mapping slow

I am not very good with vimscript, but I am trying to do some custom mappings in Vim. 我对vimscript不太满意,但我想在Vim中做一些自定义映射。 What I want to do is map <leader>h to switch to the previous tab, but when I press <leader> followed by h , it's waiting for another key and doesn't switch quickly. 我想要做的是映射<leader>h切换到上一个选项卡,但是当我按<leader>然后按h ,它正在等待另一个键并且不会快速切换。 Is there a way to see what mappings are there starting with the "h" key and unmapping them? 有没有办法看到哪些映射以“h”键开头并取消映射? Or maybe another, more elegant solution? 或者也许是另一种更优雅的解决方案

Thanks, H. 谢谢,H.

To see all your mappings, type :map . 要查看所有映射,请键入:map To see what mapping(s) apply to a given prefix, like your h situation, type :map <leader>h . 要查看映射(S)适用于特定的前缀,像你的h的情况下,键入:map <leader>h

What's likely happening is that you have some other h -mappings that take multiple characters. 可能发生的是你有一些其他的h -mappings需要多个字符。 Eg, if you also have map <leader>hx , then vim will pause for timeoutlen milliseconds (see :help tm and also ttm ) before trying to honor your shorter <leader>h , in case you're actually trying to type the longer one. 例如,如果你还有map <leader>hx ,那么vim会在尝试尊重你的短<leader>h之前暂停timeoutlen毫秒(参见:help tmttm ),以防你真正尝试输入更长的时间一。

So you'll need to track down where your longer mapping are coming from and possibly remove them. 因此,您需要跟踪较长映射的来源,并可能将其删除。

Thats Because You need to add enter key also :) 那是因为你还需要添加回车键:)

let mapleader = "z"
nnoremap <leader>n :tabe<Enter>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM