Reputation: 27875
I just did some changes to the .vimrc
file and .bash_aliases
file and from that time I can't delete words with backspace key.
My .vimrc
file has:
set nocompatible
set number
set incsearch
set autoindent
set ruler
set autowrite
set smarttab
set linebreak
set spell
set et
set title
set mouse=v
set history=50
set tabstop=4
set matchtime=2
set matchpairs+=<:>
syntax enable
filetype plugin indent on
filetype indent on
set sw=4
map <f2> :w\|!python %
hi SpellBad ctermfg=000 guifg=#000
And my .bash_aliases
file has two line for Vim:
alias vim="vim -c 'startinsert' -u ~/.vim/.vimrc"
alias vi="vi -c 'startinsert' -u ~/.vim/.vimrc"
My ~/.vim
directory doesn't have a single plugin or script, so there's isn't any chance that plugin will cause this.
~/.vim/.vimrc
is a symlink. The actual .vimrc
file is in ~/vimrc/
directory which is a git repository.
Upvotes: 157
Views: 179288
Reputation: 1488
I have compiled vim8.2 from source.Then I encouter this problem.
After insert source $VIMRUNTIME/defaults.vim
in .vimrc
. BackSpace works.
Upvotes: 6
Reputation: 8424
Like a linux-newb, I was on a fresh Ubuntu 18.04 install and my vim editor behaved differently than I was used to on the other machines I use (to include the backspace behavior you're describing). I didn't realize that I was actually using vi and not vim (both of which are executed with vi
).
Installing vim and then editing a file brought back the behavior I was used to, including the backspacing working like I was expecting.
sudo apt install vim
Upvotes: 44
Reputation: 149726
To allow backspacing over everything in insert mode (including automatically inserted indentation, line breaks and start of insert) you can set the backspace
option:
:set backspace=indent,eol,start
or
:set backspace=2 "compatible with version 5.4 and earlier
By default this option is empty, not allowing you to backspace over the above-mentioned things. This is the standard Vi behavior.
You can put this line to your vimrc
file to have it set automatically when Vim starts:
set backspace=indent,eol,start " more powerful backspacing
Also, starting from Vim 8.0 if no user vimrc file is found, Vim will set backspace
to this value by loading the defaults.vim
script.
Upvotes: 282
Reputation: 68905
My ~/.vimrc
file had content set nocompatible
. Added another line to the same file to make backspace work -
set backspace=indent,eol,start
And just run
source ~/.vimrc
in the same terminal for change to take immediate effect in same shell. No need to open vi and run
:set backspace=indent,eol,start
Upvotes: 14
Reputation: 155
For me,I had the setting below, however the backspace still doesn't work.
set backspace=indent,eol,start
Finally, I found following line led to this problem.
inoremap <expr><C-h> neocomplete#smart_close_popup()
When this setting is deleted, backspace key works well in insert mode.
Reason
: That's because Vim sees CTRL-H as a backspace, and this line makes remapped to neocomplete#smart_close_popup() in insert mode.
Upvotes: 4
Reputation: 882
Many a times it is also a function of the getty type selected if one is using an SSH client like Putty or some such. Most preferable would be to use vt100+ as it is the most standard emulation.
I already had :fixdel
which was not working. I had to remove it and replace it with the first suggestion to get it to work
Upvotes: 1
Reputation: 165
I had the same problem on a Debian 7.8 over SSH in urxvt + tmux. I had vim and vim-tiny installed.
Removing vim-tiny fixed the problem.
Upvotes: 2
Reputation: 21
For me (Debian server, connected with "Konsole" from other linux), problems with backspace key and arrow keys were solved after uninstalling the vim-tiny package and installing the vim package.
Upvotes: 1