Invoke NERDCommenter in insert mode?
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>
精彩评论