开发者

Invoke NERDCommenter in insert mode?

开发者 https://www.devze.com 2023-03-08 08:26 出处:网络
In my .vimrc, I have the following mapping which I use to toggle comments using the excellent NERDCommenter plugin:

In my .vimrc, I have the following mapping which I use to toggle comments using the excellent NERDCommenter plugin:

vmap <D-/> ,c<space>gv
map <D-/> ,c<space>开发者_StackOverflow

Works great for this TextMate refugee.

However, I'd like it to work in Insert mode as well. Roughly:

  • Use the same combo (command-/)
  • Switch to normal mode
  • Execute the toggle
  • Bonus points for saving the cursor position, I suppose.

My .vimrc skills don't extend to this. Any help?


Use imap to map commands in insert mode. I think the following should work.

imap <D-/> <esc>,c<space>
0

精彩评论

暂无评论...
验证码 换一张
取 消