I have the following lines in my vimrc:
noremap gb vnoremap gb
The goal of these is pretty clear: move one word to the left whenever I press g.
My issue is that there is a delay of about 1/2 second before vim executes the move. It is as if vim is waiting for me to enter an addition command.
I know vim does this kind of thing when it is expecting more information. However, this is the only case where I have a remap that involves g, so it's unlikely to be the case.
Other people seem to be having similar problems: Eliminating lag when remapping 'd' key in VIM
But no one has yet offered a solution.
Any thoughts?
If I do this and start vim using vim -u NONE -N
I can't replicate the behaviour. Looking further, this seems to be caused by the netrw plugin, which maps the gx
key as well as the matchit plugin, that maps g%
. (You might to check using :verbose :map g
to see, if there are other ambigious g mappings that could cause this and where they were defined (by the use of :verbose
)).
So to prevent this, you should unmap those mappings and then the g
works without delay. But as progo already said, you lose all those nice builtin g<x>
commands, so I would not recommend to map g
away
Note also, recent vims have the <nowait>
modifier, so you can just do noremap <nowait> gb
and no delay will occur.
But vim is expecting more information. There is a bunch of normal mode key bindings that start with g
such as ( gg
, gd
, gf
, gq
, ...) and of course vim has to wait until it knows what you started to type in.
This is a situation you can't really fix without breaking lots of other mappings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.