Sunday, August 24, 2014

Re: vim: leaders vs. character searches

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBCgAGBQJT+dspAAoJEERGtGilKM7wucwH/07k9HZtp3C5MPDN766gO+BP
2mQew8oaWLLH6IjHf/QK7ysT6O2yfwrzAooLkbe+6A4Sehvss95JkyHq5OyKKQ4S
DfrsIGtlcRFC8F9czRa98o6bZyNt+AbKiujIyozy0nqoMq06vn/S+UYYZeLd76+d
4fQSkjUTZu6MTjaEl06BDsZTC0XiZBXX/5zV6Pt4+wAaTQlriG+fGBA7MzuH4HOI
/PXIrESAQGtnohBNZw3dzDew2YeGP2awW7Wz9nAf0eHpaj0fJGZTq5NF83FUwfFE
aCk1yGYWXrXuV2Hg5veoI77JHmYDmduQLnHG57c9flNC9/f19rlyRx3I7WPlLAU=
=a4a3
-----END PGP SIGNATURE-----
On 2014-08-24 13:16, Óscar Pereira wrote:
> 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?

I tend to not remap built-ins unless they have duplicates, so I
leave ,/; as their default (I use them ALL the time) and leave "\" as
the default leader. I've never had to use "g:maplocalleader", but
I'd consider "+" or Enter because they both perform the same
action, so remapping one of them doesn't interfere with using the
other. Alternatively, I'd consider the "_" which I don't use because
it's functionally almost identical to "+"/Enter except the count is
reduced by one (I find that pretty useless).

Some folks also remap "Q" because going into Ex mode doesn't really
net you much unless you know ahead of time that you're going to enter
lots of Ex commands consecutively.

I find that, if I'm reaching to remap something and it clashes with
an existing Vim key that I didn't know about, it's a good opportunity
to read up on that conflicting key and see if I can integrate it into
my day-to-day vimming.

-tim

No comments:

Post a Comment