问题
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