Vim remap in paste mode

浪尽此生 提交于 2019-12-08 01:18:04

问题


Is there a possibility to remap in paste mode.

For example, I remapped jk to <ESC> in insert mode with inoremap jk <esc>, so I can easily exit normal mode. But when I'm in paste mode with :pastetoggle my remapping does not work anymore. I looked for the help with :help map-modes but could not find anything related to the paste mode.


回答1:


From :help 'paste':

[...]
When the 'paste' option is switched on (also when it was already on):
        - mapping in Insert mode and Command-line mode is disabled
[...] 



回答2:


One workaround to the fact that remappings don't work in paste mode is to use vim-unimpaired's yo and yOcommands to paste. At least this way leaving insert mode with paste set will also set nopaste and you won't find yourself in paste mode when you don't want to be as much.



来源:https://stackoverflow.com/questions/39317055/vim-remap-in-paste-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!