i read this answer about mapping <ESC>
key to jk
. i tried the answer but nothing worked for me. these are i have tried in my vimrc:
inoremap jk <ESC>, inoremap jk <^[>, inoremap jk ^[, inoremap <special> jk <ESC
are they all wrong? i also tried setting cpo-=< above the mapping definition. and there is no comment after the key
here is my vimrc , the command is on the bottom of the file
im new in vim. thanks!
inoremap
is spelled wrong. (I also assume you put each of those on a separate line.) This should work.
inoremap <special> jk <ESC>
<special>
forces <ESC>
to be act as escape regardless of what cpo
is set to.
problem solved. the reason why <esc>
doesnt work is because of this function in my vimrc:
if ! has("gui_running")
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
inoremap jk <ESC>
works perfectly after getting rid of above function.
i guess its augroup FastEscape
that makes <esc>
mapping not working.
对于那些因标题而在此处的内容,启用:set paste
时,jk映射将不起作用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.