Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backspace doesn't work in gvim 7.2 64-bit for Windows?

I just installed the 64-bit zipped version for Windows of gvim on my new machine at work, and I changed some settings to make it compatible with Visual Studio 2010.

Now the backspace key doesn't work for some reason.

Here's my .vimrc file:

set nowrap set ruler set encoding=utf-8 set fileencoding=utf-8 set ff=dos 

It's only a minor annoyance (the delete key works), but I was just wondering if anybody knew.

like image 251
leeand00 Avatar asked Mar 24 '11 13:03

leeand00


People also ask

Why backspace is not working in Gvim?

Backspacing won't work. This is because in the first example, Vim determined it should add 1 level of indentation when you pressed Enter; but in the second example, Vim didn't autoindent anything, it's just Tab characters or a few spaces.

How do I backspace in Gvim?

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

Why can't I delete in Vim?

To delete a line in Vi or Vim, switch to normal mode first. If you're into command mode or insert mode, you can switch back to normal mode by pressing Escape. Highlight the line that you want to delete, then hit dd or D on the keyboard. The editor will automatically remove the whole line from the file.


2 Answers

Does it entirely not work, or does it just not backspace past where you went into insert mode? There's an option backspace which controls this:

Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert mode.  This is a list of items, separated by commas.  Each item allows a way to backspace over something: value       effect indent      allow backspacing over autoindent eol         allow backspacing over line breaks (join lines) start       allow backspacing over the start of insert; CTRL-W and CTRL-U             stop once at the start of insert. 

owen_water's suggestion is the same as Carpetsmoker's comment, enabling all three of these. That's generally what people want, since it's a bit surprising to have Vim refuse to let you backspace text that's right there. So take your pick of the two equivalent choices - I'd go with the more verbose and clear one:

set backspace=2 set backspace=indent,eol,start 

In some cases, bad terminals can mess with backspace and delete, but I doubt that's your problem in Windows. There is some ability to fix this; see :help fixdel.

like image 103
Cascabel Avatar answered Oct 04 '22 16:10

Cascabel


never use vim in Windows, but I have meet the same problem before in open solaris.
Just try:

 set backspace=2 
like image 24
owenwater Avatar answered Oct 04 '22 16:10

owenwater