Reputation: 70
Preliminary Info:
Detailed Description:
When I'm in Insert mode, I can type text as normal, but backspace does nothing. While in normal mode, the backspace key deletes text. This is exactly opposite the behavior I had just earlier today. I have read numerous other posts online describing Vim's unorthodox backspace behavior, but the suggested config settings (namely bs=2 or bs=indent,eol,start) had done nothing.
More unusual is that gVim behaves "normally" that is: Backspace move the cursor to the left in normal mode, and deletes text in insert mode.
What I would like is for backspace to delete text in insert mode (just like most other programs) and to be navigation/disabled in normal mode. How can I regain this behavior?
Below is a copy of my _vimrc: (I would put this on github but my git is messed up at the moment and I've yet to fix it.) Additionally there was a function that was inside of the _vimrc by default. I have no idea what it does but omitted it to save space. If you want to see if I can post it in a reply.
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
" Pathogen - Plugin manager
execute pathogen#infect()
set nocompatible " Turns off Vi compatability gubbinz
" Color Theme
if !has("gui_running") " Allows some 256 color themes to work in Terminal
set term=xterm
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
colorscheme gruvbox
endif
let g:gruvbox_dark_contrast = 'hard' " Both of these are just visual gruvbox tweaks
let g:gruvbox_light_contrast = 'hard'
set guifont=Consolas:h10:cANSI:qDRAFT " Changes font
set bs=indent,eol,start " Makes backspace be normal
set filetype=ON " Has vim check for filetype
set showcmd " Displays incomplete commands
set ruler " Shows position of cursor in document
set syntax=ON " Turns on syntax highlighting
set number " Show line numbers
set linebreak " Break lines at word (requires Wrap lines)
set showbreak=+++ " Wrap-broken line prefix
set textwidth=100 " Line wrap (number of cols)
set showmatch " Highlight matching brace
set hlsearch " Highlight all search results
set smartcase " Enable smart-case search
set incsearch " Searches for strings incrementally
set autoindent " Auto-indent new lines
set shiftwidth=4 " Number of auto-indent spaces
set smartindent " Enable smart-indent
set smarttab " Enable smart-tabs
set softtabstop=4 " Number of spaces per Tab
set undolevels=1000 " Number of undo levels
set backspace=indent,eol,start " Backspace behaviour
set go=egrLTm " Changes flags that specify how the GUI loads
Upvotes: 1
Views: 1301
Reputation: 7657
Most likely, your insert-mode backspace is mapped to do nothing (i.e. <nop>
). Verify this by typing :verbose imap <bs>
. This will show if backspace key is mapped and where the map was set.
What I would like is for backspace to delete text in insert mode (just like most other programs) and to be navigation/disabled in normal mode. How can I regain this behavior?
You can do:
iunmap <bs>
nnoremap <bs> <nop>
The first line unmaps <bs>
in insert mode, thus <bs>
will recover its default functionality. The second line maps <bs>
in normal mode to do nothing.
Upvotes: 5