Join line to previous line

Emacs has a slightly obscurely named command delete-indentation which is bound to M-^ which can be rather useful. From the help for the function (which you can always look up using C-h k M-^ or C-h f delete-indentation):

Join this line to previous and fix up whitespace at join.

You can use this multiple times to “gather up” lines, joining them together. The easiest way to explain is with an example:


N.B. after I have joined the lines in the example above, I used M-q to wrap (fill) the lines tidily.

  • Rene Froger

    Thanks for sharing it, so I need to press Meta – Shift – 6 to reach that? I found that somewhat cumbersome.
    Or you could simply press J in Evil (J = Join).

    Nice blog btw.