Sunday, August 24, 2014

vim: leaders vs. character searches

Hello all,

So, these were my leader mappings:

let g:mapleader = ","
let g:maplocalleader = ";"

Which work very well, except for the fact that (repeating) character
searches (';' or ',') get slightly slower. Slightly, but noticeably
and very annoyingly slower. I tried other combinations of
leader/localleader, but they all sucked. So finally I thought this
solution up:

let g:mapleader = ","
let g:maplocalleader = ";"
nnoremap - ;
nnoremap _ ,

Now repeating a previous character search is done with a dash, and
repeating a previous character search in reverse is done with an
underscore. This works really nicely, and I see no drawbacks --
other than the fact that it changes a vim default command...

Does anyone see any problems with this solution, or has any other
better alternatives?

---Óscar Pereira

No comments: