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:

join-lines.gif

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

Advertisement

One comment

  1. 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.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s