Mac terminal Vim will only use backspace when at the end of a line

MacosVimTerminal

Macos Problem Overview


I seem to have something odd with either my Mac 10.6 terminal or my .vimrc.

When I type backspace on my laptop's keyboard, it only works when the cursor is at the end of the line. Trying to delete from within a line does nothing. MacVim operates normally. Google hasn't helped because I can't even figure out what to call this behavior.

All other backspace commands in my Terminal work as expected, so I am leaning towards it being Vim specific.

Here's the output of my ~/.vimrc 's mappings, I can't see anything that would make Vim in the terminal operate this way:

cflewis@coral-reef ~> egrep ".*map.*" ~/.vimrc 
"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
let mapleader = ","
map Q gq
nmap <silent> <leader>s :set nolist!<CR>
" extended '%' mapping for if/then/else/end etc
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
nmap <silent> <C-N> :silent noh<CR>
nmap <C-E> :b#<CR>
nmap <C-P> :NERDTreeToggle<CR>
nmap <leader>p :NERDTreeFind<CR>
nmap <leader>/ :call NERDComment(0, "invert")<cr>
vmap <leader>/ :call NERDComment(0, "invert")<cr>
nmap <leader>t :TlistToggle<CR>
nmap <leader>e :e **/
nmap <Leader>b :MiniBufExplorer<cr>
nmap <Leader>sh :ConqueSplit bash<cr>
nmap <Leader>r :ConqueSplit 
" map ,y to show the yankring
nmap <leader>y :YRShow<cr>
imap <silent> <Down> <C-o>gj
imap <silent> <Up> <C-o>gk
nmap <silent> <Down> gj
nmap <silent> <Up> gk
cmap w!! %!sudo tee > /dev/null %
inoremap jj <Esc>
nnoremap JJJJ <Nop>

Any ideas would be appreciated. I tried flipping the delete key to send ^H or ^?, to no difference.

Macos Solutions


Solution 1 - Macos

Most likely, the "problem" you're seeing is that you can't delete anything that was not typed during your current insert mode session. This is due to the default setting for the 'backspace' option. Adding set backspace=indent,eol,start to your ~/.vimrc is the behavior that you probably want.

Solution 2 - Macos

This is the only explicit backspace mapping I have in my config. I do not know if it will help for your problem, but it might be worth a try?

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncflewisView Question on Stackoverflow
Solution 1 - MacosjamessanView Answer on Stackoverflow
Solution 2 - MacosJohanView Answer on Stackoverflow