kakoune paste block or multiple selections
Assume you have:
aaa
bbb
ccc
111
222
333
…and you want to end up with:
aaa 111
bbb 222
ccc 333
I dunno what you’d call this. Maybe “pasting a block” or “interlacing lines”.
In vim (what I know fairly well), I’d do:
- position cursor on the first
1 <c-v>for block modejtwice to go down two linesEor$to extend selection to enddto cut (kill) the selection- position cursor on end of the
aaaline <c-v>jjto select a block of the last char of all 3 linesAto append- insert four spaces
escto let the block insert finish$to jump to the end of the line<c-v>jjto select a block of the last char of all 3 linespto paste the block (knowing the selected chars will be clobbered)
So as I’m still learning kak, I wanted to recreate that in kakoune. This is what I’ve
come up with:
- position cursor on the first
1 ]pto select paragraph<a-s>to split on line boundariesdto cut (kill) the selections- position cursor on the start of the
aaaline Ctwice to add cursors on the two lines belowglto go-to end of linepto pastekto go up one line<a-j>to join linesato append- insert 2 spaces
Note: if you do not do the <a-s> to split the selection, you’ll end up pasting the
whole block (all 3 lines) after each selected line. That’s not what we want.
Or, I can do it without cutting the newlines:
- position cursor on the first
1 Ctwice to add cursors on the two lines belowxto expand selection to the whole lines_to drop newlinesdto cut (kill) selections- position cursor on the start of the
aaaline Ctwice to add cursors on the two lines belowglto go-to end of lineato append- insert 3 spaces
<c-r>"to paste registerescto exit insert mode
I’m a total kak n00b so I’m sure there are better ways, and I even found that _ trick
to drop newlines while I was writing this, but I’m just happy I’ve got it working at all.