简体   繁体   English

插入模式下Command + V粘贴后如何让VIM进入正常模式?

[英]How to get VIM to enter normal mode after Command + V paste in insert mode?

The workflow Id like is as follows工作流程Id如下

  • Im in insert mode我处于插入模式
  • I paste using Command + V我使用Command + V粘贴
  • The text is pasted文本已粘贴
  • Normal mode is initiated启动正常模式

Currently I remain in insert mode afterwards目前我之后仍处于插入模式

It's not recommended that you use cmd+v for pasting but here is the solution.不建议您使用 cmd+v 进行粘贴,但这是解决方案。 Remap your key like this and your register to whatever you use.像这样将您的密钥和您的寄存器重新映射到您使用的任何内容。 Position your cursor however you want in the function. Position 你的 cursor 但是你想在 function 中。

function! LeaveInsert() abort
exe "normal! ".'"'."+p "
call feedkeys("\<Esc>")
endfunction

inoremap <c-v>  <Cmd> :call LeaveInsert()<cr>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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