开发者

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

开发者 https://www.devze.com 2023-01-12 23:37 出处:网络
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 f

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 lea开发者_运维百科ning 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.


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号