Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 623
cflewis Avatar asked Aug 20 '10 19:08

cflewis


People also ask

Can t use backspace Vim?

To fix “not working” backspace key in the insert mode permanently, add set backspace=indent,eol,start command to vi / vim configuration file in your $HOME directory.

How do I backspace in vim Mac?

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. Aha, that was it.

How to backspace in Vim?

vi/vim editor FAQ: What is the vi/vim backspace key? 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'.

How do you go to the start of a line in vim on a Mac?

In MacVim, you can use Command 'Left Arrow' and Command 'Right Arrow' to go to the beginning and end of line while being in edit mode.


2 Answers

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.

like image 166
jamessan Avatar answered Sep 21 '22 21:09

jamessan


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 
like image 42
Johan Avatar answered Sep 19 '22 21:09

Johan