简体   繁体   中英

Issues mapping <C-[> to :pop in vim

I've reassigned the default <CT> mapping for :pop to the CtrlP fuzzy finder, as my Sublime Text use means I hit that instead of <CP> every time. I also use the default <C-]> mapping for Ctags, but when I try to reassign :pop to <C-[> as so:

nmap <C-[> :pop<CR>

the mapping works, and pressing <C-[> correctly pushes me back up the tree, but using the arrow keys now adds random characters into my buffer. With that single line commented out the arrow keys work correctly. Anyone have any ideas as to why this mapping would cause this behaviour? I can post the full .vimrc and list of plugins used if needed.

The problem is that <C-[> is the same as <Esc> .

You can check that by entering insert mode and hitting <CV> + <C-[> and <CV> + <C-[> (it is possible that you need to use <CQ> instead of <CV> ).

You should try using a different key, as the Esc is part of the keycode of other keys. You may find this link helpful: Vim FAQ: 20.4. I am not able to create a mapping for the key. What is wrong?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM