user347284
user347284

Reputation:

Why are my Vim keyboard shortcuts so slow?

I've created myself the following vim shortcut: map <Leader>c magg=G'a<CR>

When I use it, there's a pretty noticeable 2-second lag happening before my file is actually indented. If I manually type magg=G'a, the problem doesn't happen. How can I fix it?

Upvotes: 2

Views: 398

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172728

You probably have other mappings that start with <Leader>c, so Vim has to wait to resolve the ambiguity; :verbose map <Leader>c will tell you. Then, just choose different keys for one to get immediate response.

Also, you should use :noremap; it makes the mapping immune to remapping and recursion.

Upvotes: 3

Related Questions