0

Example:

I type "abc" then [newline]. Now I want to effectively just remove the [newline] to remove the current line (dd) and then jump to the end of "abc" ($).

It might seem odd to ask for something shorter than dd$ but doing dd$ instead of using [backspace] as it would work in most editors feels out of flow and makes me curious whether there is something more concise.

But maybe dd$ is already the recommended command for that situation.

2 Answers 2

3

You can set backspace to work like in other editors:

set backspace=indent,eol,start

Sanity's great.

2

Note: dd$ only work at the end of the buffer, where the dd will automatically move the cursor on line up. Elsewhere, it's ddk$.

If you're in insert mode, you can alternatively also use <BS> to remove the empty line and move the cursor to the end of the previous line. This also works from normal mode: i<BS><Esc> with this setting:

set backspace=indent,eol,start

but it's not shorter.

Why do you need the cursor to be at the end of the previous line (in normal mode)? I don't see that requirement often. If you want to restart editing there, you can just use A from anywhere in the line.

2
  • actually the initial state would be insert mode. the situation where you think about starting a new paragraph (newline) and then decide to instead just append another sentence - then you want to just go back to the ende of the last sentence and the newly created line becomes superfluous.
    – Raffael
    Commented Sep 24, 2014 at 12:04
  • I don't know what configurations you guys are using, but using the actual vim (vi improved), in insert mode the backspace key performs exactly as in "other editors". Or am I missing something?
    – Bananguin
    Commented Sep 24, 2014 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .