vim:无法将Escape重新绑定到jj

时间:2011-03-14 05:07:40

标签: vim

我所有其他的键绑定工作正常,但由于某些原因我无法绑定jj。捣碎jkkj也不起作用。这是我的整个.vimrc:

    "Maps for jj to act as Esc
inoremap jk <Esc>
inoremap kj <Esc>
"inoremap jj <Esc>
ino jj <Esc>
cno jj <C-c>

set number
set nocompatible 
set paste

    "fix cygwin backspace problem
set backspace=indent,eol,start
fixdel

set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
    "use spaces instead of \t
"set expandtab 
set nowrap

syntax on
highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
    "remove trailing whitespace
    "http://vim.wikia.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_whitespace
"autocmd BufWritePre * :%s/\s\+$//e
autocmd BufWritePre *.c :%s/\s\+$//e
autocmd BufWritePre *.cpp :%s/\s\+$//e
autocmd BufWritePre *.c++ :%s/\s\+$//e
autocmd BufWritePre *.h :%s/\s\+$//e
autocmd BufWritePre *.java :%s/\s\+$//e
autocmd BufWritePre *.php :%s/\s\+$//e

autocmd BufWritePre *.pl :%s/\s\+$//e
autocmd BufWritePre *.py :%s/\s\+$//e
"autocmd FileType c,cpp,c++,java,php,pl,py autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,

    "search options
set incsearch
set ignorecase
set showmatch

nmap <space> zz
nmap n nzz
nmap N Nzz

    "set arrow keys to move between buffer / tabs
inoremap <Up> :bprev<CR>
inoremap <Down> :bnext<CR>
inoremap <Left> :tabprev<CR>
inoremap <Right> :tabnext<CR>
noremap <Up> :bprev<CR>
noremap <Down> :bnext<CR>
noremap <Left> :tabprev<CR>
noremap <Right> :tabnext<CR>

set vb t_vb=
set guioptions-=T

"set foldmethod=indent
set showtabline=2

"au BufWinLeave * mkview
"au BufWinEnter * silent loadview

对于记录,timeoutlen设置为默认值1000毫秒。

2 个答案:

答案 0 :(得分:5)

刚刚找到答案研究一个无关的.vimrc问题。使用set paste禁用插入缩写,即使它实际上从来没有在.vimrc中为我工作。

答案 1 :(得分:0)

您想要inoremap jj <Esc>,您似乎已对其进行了评论。取消注释并注释/删除jj的其他映射。这有用吗?