1

My question is similar to this one but for the i_<Del>.

In insert mode, if I type <Del> it removes the next character, including newlines. In normal mode, I have to type x if the cursor is inner the line or J if the cursor is just before the new line.

I could write a mapping that check the position of the cursor (something like nmap <expr> <Del> getpos(".") == getpos("$") ? "J" : "x"), but I am surprised there is no standard way to do that.

2

1 Answer 1

1

I'm not 100% sure this answers your question, but you can join the lines from anywhere in the line by simply pressing J:

                            *J*
J           Join [count] lines, with a minimum of two lines.
            Remove the indent and insert up to two spaces (see
            below).  Fails when on the last line of the buffer.
            If [count] is too big it is reduced to the number of
            lines available.

You might also be interested in any of the following nearby help topics:

  • v_J
  • gJ (and v_gJ)
  • :join

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.