Having used Kakoune for about two weeks time now, I really like the visual approach. Coming from Vim though, I’ve a couple of annoyances maybe someone could clarify or give a solution to.
How do you quickly jump around in a line? I’m used to hitting f to find a char and replace it by a another one using r. Kakoune selects a region when using f or t, so it forces me to use ; after every jump to narrow my selection before doing a change or replace command. Is there a quicker way?
Along the same lines: when changing/deleting to a certain char, I hit f to find the spot. However, it could be the first jump is not far enough. I can repeat the command using <a-.>, but then Kakoune selects a new region instead of extending the existing one. Is there a better way?
<a-h> does not do the same thing as ^ in Vim. I’d like a way to select to the first non blank character on a line and operate on it.
What is the equivalent of Vim’s 2cc in Kakoune? If I hit 2Xc (which, alas, is not as quick to hit as 2cc), Kakoune deletes 2 lines including the line end and starts insert mode at column 0 with the contents of the next line after the cursor. I find this particularly annoying for a couple of reasons:
Kakoune does not take into account the indentation of the surrounding lines.
The line I’m editing is polluted with the contents of the next line which moves along when I type.
I have to hit return after my changes to re-enter the end of line which was deleted.
There is the fact that 2Xc or 2Xd might delete three lines when my cursor happend to be on an empty line, which I find really inconsistent…
hl is more keys that ;, but they’re keys directly under my fingertips.
Gi
That’s Shift-G to open the goto menu in “extend selection” mode, and i for “first non-blank character”.
I’ve learned to make selections and so forth visually. That is, I don’t count two lines and type a 2 before the command, I just bounce on the X key until I can see that all the text I wanted to select is selected. Maybe that’s two presses, maybe that’s three presses, whatever it takes.
hl is more keys that ; , but they’re keys directly under my fingertips.
Although it is under my fingers, it is more keys to hit to make a correction I don’t wanne make.
Gi. That’s Shift-G to open the goto menu in “extend selection” mode, and i for “first non-blank character”.
Thanks, that does the trick!
I’ve learned to make selections and so forth visually. That is, I don’t count two lines and type a 2 before the command, I just bounce on the X key until I can see that all the text I wanted to select is selected. Maybe that’s two presses, maybe that’s three presses, whatever it takes.
It really does not make a difference for my reasoning between hitting 2Xc or XXc, the effect is the same. That means that Kakoune still
puts me in column 0,
deletes the end of line,
requires me to correct that afterwards, and
is not consistent in deleting 2 or 3 lines depending on the line to be empty or not.
Additionally: how do I correct my selection when my fingers selected an extra line? There is no “deselect line” motion as B is for W…
Yeah, I know that feeling. Sometimes, editing text with Kakoune feels a little bit like playing Snake, since you have to think about where the anchor is as well as the cursor.
I use K for this. It’s not a complete “undo” since X moves to the end of the following line while K does not move to the end of the previous line, but manually adjusting the end of the selection is usually easier than deselecting everything and starting from scratch.
only r is actually mapped to anything so tonnes of room to change the bindings there.
Edit - Nevermind, R and <a-R> are both mapped to something but <a-r> is still free
For 2:
map global normal f ';F'
map global normal <a-f> ';<a-F>'
map global normal . ';<a-.>'
only downside of this mapping is that it slightly changes the behaviour for when you reach the last f.
you also need to rebind the normal .
But this lets you press . to repeat the last action as per normal but <a-.> will always force selection.
This doesn’t work for T because you have to move past the character to do the next T. I have a mapping for that I can post but it’s kinda complicated and I never use T anyway.
For 3:
already answered
For 4:
AFAIK X4Jc is identical to 5cc in Vim. A lot more keys tho. But I’m already holding down Shift so it’s not a big deal to press <shift+x> then just hammer j while still holding shift.
If you want to go up press <shift+k> but if you reach the original line then you want to go <a-;> before press <shift+k> or, as other posters said, you don’t get the whole line.
If this is a common case for you @alex.boswell – I would recommend a custom binding for it. I have a lot of custom bindings just for stuff I happen to use a lot that shouldn’t be generalized.