bitstream
bitstream

Reputation: 1126

Vim: <leader>h mapping slow

I am not very good with vimscript, but I am trying to do some custom mappings in 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. Is there a way to see what mappings are there starting with the "h" key and unmapping them? Or maybe another, more elegant solution?

Thanks, H.

Upvotes: 12

Views: 3467

Answers (2)

Spiderman
Spiderman

Reputation: 2087

Thats Because You need to add enter key also :)

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

Upvotes: 0

Micah Elliott
Micah Elliott

Reputation: 10274

To see all your mappings, type :map. To see what mapping(s) apply to a given prefix, like your h situation, type :map <leader>h.

What’s likely happening is that you have some other h-mappings that take multiple characters. E.g., 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.

So you’ll need to track down where your longer mapping are coming from and possibly remove them.

Upvotes: 34

Related Questions