"join" without extra whitespace?

Hi, folks. When I use “join” (alt+j or alt+J) to join lines, I notice that Kakoune inserts a space before the incoming line. I don’t expect it to do that. I mostly delete that space.

  1. Do other people expect the current behavior? If so, then why do you prefer it?
  2. Assuming that “join” ought not to insert that extra space, how easily can one fix it? If it seems easy, then I’d consider trying to contribute that myself.

Thank you.



Put the cursor on the beginning of the line with “—”, then press alt+j.

I expect this line:

Instead, I see this line:
— invoice:

Hi JB!!

I know I often use the space. For example: joining lines when reflowing markdown, joining lines of code, or making a multi-line string single-line.

I know I sometimes kill the space.

Though, as I’m trying to understand what the best mappings are empirically, I have a plan to make a table of most frequencies of key pairs. Let’s see…

Not enough data to answer this empirically, I think.

What you can do is <a-J>, it will join the lines and select the spaces between. Which means you can do d to delete them.

1 Like

Thank you! I hadn’t noticed that kakoune was selecting the intervening spaces after <a-J>. They seemed to be doing the same thing, and I decided that I might be missing something, but I didn’t have the energy at the moment to figure that out.

Is there an easy way, then, to select 7 lines and apply -then-d to every line? or to apply a composite command like g-l-<a-J>-d 7 times in a row? (I guess this would be composing a macro?)

Your cursor doesn’t need to be on the line-end to join lines, so it’s a bit easier than that:

  • 7X to select seven lines, including the current one
  • <a-J> to join them and select the inserted spaces
  • d to delete the inserted spaces
1 Like