Share some cool kakrc snippets


#1

Because we all have these tricked-out kakrcs with hidden gems inside.

I’ll start with this one:

map global normal w     <a-i>w                #select word
map global normal <a-w> <a-i><a-w>            #select WORD
map global normal W     '"_s.<ret><a-i>w'     #subselect words from current selection
map global normal <a-W> '"_s.<ret><a-i><a-w>' #subselect WORDS

which repurposes w into a word selection mapping.

My reasoning is that the difference between default e and w is too subtle to warrant having both mappings, and I was never able to tell which I need in which circumstances anyway. So now I only move by words using e and b, which are symmetrical anyway.
I also think selecting the current word is an incredibly common thing to do, and it deserves a better mapping than the awkward <a-i>w


#2

map global object h 'c<gt>,<lt><ret>' -docstring "select in the (html) angle brackets"

I use the above way more than I thought to select like <C-i>h when in like

<foo>a long string I want to replace</foo>

EDIT: I plan to add one that selected between whitespace, just haven’t decided what to map it to.