Reputation: 41
I'm having a weird issue with vim on Ubuntu. I've been using it for the last few weeks, trying to learn, on Windows and it behaves differently now that I'm using it on Linux.
I noticed that while in insert mode pressing backspace will delete text just like any other editor on Windows, but on Linux the text is "deleted" yet it stays there until I press ESC or write over it.
I was trying to fix this but I'm confused as to whether this is intended behaviour or not. It happens in gvim too.
The reason of this question is this, however:
I deleted my .vimrc file to see if any of my config was at fault and it fixed it. Backspace was now back to its regular self.
But then I tried creating an empty .vimrc file and that made it go back to the delayed delete. It's empty. Why the hell?
So I have no idea what's causing this. Hope my question makes sense my English ain't the best. Thanks.
Alright so looking at :h compatible I found this:
"When a |vimrc| or |gvimrc| file is found while Vim is starting up, this option is switched off, and all options that have not been modified will be set to the Vim defaults. Effectively, this means that when a |vimrc| or |gvimrc| file exists, Vim will use the Vim defaults, otherwise it will use the Vi defaults. (Note: This doesn't happen for the system-wide vimrc or gvimrc file, nor for a file given with the |-u| argument). Also see |compatible-default| and |posix-compliance|."
So if I'm getting this right, running Vim with a .vimrc file should automatically set nocompatible and running it without one should set compatible... ? Whatever the case, I tried checking with :verbose set compatible? and it always says nocompatible is on so the -N flag shouldn't do anything... Yet it fixes the issue.
Upvotes: 4
Views: 809
Reputation: 41
Alright I fixed it.
Running vim with the -N command makes it work properly. I'm not sure why but that's what's happening.
Upvotes: 0
Reputation: 6016
Without a vimrc Vim will load /usr/share/vim/vim80/defaults.vim
(depending on your vim version). In this file the bs
/backspace
parameter is set to 2
, or actually it is indent,eol,start
which is the same as 2
(see :h bs
)
Now if you create an empty .vimrc
, defaults.vim
will not be loaded, so your bs
will possibly be 0.
This behaviour is described in :h defaults.vim
So to solve your problem, just put set bs=2
in your .vimrc
Upvotes: 4