Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim backspace key only works on new text

Tags:

vim

For fun I decided to compile vim from source. Long story short the build seemed to go fine, but when I enter insert mode I cannot use the <BACKSPACE> key to delete existing characters or newlines created using the <ENTER> key in insert mode. The distro's pre-built package does this just fine. I also know there's no problem with the backspace key itself because I can backspace over characters I've just typed, just not existing characters.

It almost makes sense, as vim operates on a per-line basis most of the time. Is there a flag I need to set in order to support this behavior? Or is it faster by design to enter normal mode to delete existing characters/newlines?

like image 464
Joe Avatar asked Feb 16 '11 16:02

Joe


People also ask

Why is my backspace not working in vim?

To fix “not working” backspace key in the insert mode permanently, add set backspace=indent,eol,start command to vi / vim configuration file in your $HOME directory.

Does backspace work in vim?

Backspace in vim is done with X (and delete with x ), but often what you really wanted to do was db for example to delete until the beginning of the word, or daw to delete the whole word etc.

How do I backspace in vim?

vi/vim editor FAQ: What is the vi/vim backspace key? In Vim, you delete the character under the cursor using the 'x' key while in command mode (which is the equivalent of a [delete] key), and to delete characters to the left of the cursor -- which is the equivalent of a vim backspace key -- use the capital letter 'X'.

How do I get rid of insert mode?

Once in insert mode, you can type in your text. Press ENTER at the end of each line. Use Backspace to delete to the left of the cursor. If you need to move the cursor to another line, or make a change, or pretty much anything else, you need to press ESC to get back to Command mode first.


1 Answers

Wow, second time I've figured out the answer minutes after posting the question.

set backspace=indent,eol,start 

Must have been set automatically by the distro's package vimrc. Hope this answer helps someone else! For more info:

:help i_backspacing 
like image 180
Joe Avatar answered Sep 28 '22 18:09

Joe