Friday, August 19, 2016

Help with nmap repeat

I love NERDCommenter, and I'm using vsvim in Visual Studio 2015 which unfortunately doesn't support plugins. I want to define some keyboard mappings to replicate some barebones NERDCommenter functionality, like to comment a single line:

nmap ,cc I//<esc><down> " Insert a c++ style // leading comment

(note I use ",cc" as my leader key for commenting)

and that mapping works great for one line. But if I try to repeat the command for several lines, e.g. "5,cc" then it will just comment the same line 5 times. It appears that the "5" modifier is applied only to "I//" while the "<esc><down>" part is only executed once.

Does anyone know of a way around this, so that "5,cc" will comment 5 successive lines rather than commenting one line 5 times?

Thanks

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: