visual-studiovimvsvim

Can I define command-line commands for VsVim?


Is it possible to define my own custom command-line commands in VsVim like it can be done in Vim and described here?

I tried adding different variations of the following lines to my .vsvimrc file, without success.

command clean :vsc CodeMaid.CleanupCode<cr>
:command clean :vsc CodeMaid.CleanupCode<cr>
command clean execute ":vsc CodeMaid.CleanupCode<cr>"

Although

nmap :clean :vsc CodeMaid.CleanupCode<cr>

seems to work, it is not what I was really looking for.


Solution

  • Looking at the source, from what I can tell it does not have support for user-defined commands via the :command command. https://github.com/jaredpar/VsVim/blob/master/Src/VimCore/Interpreter_Parser.fs#L121

    You can ask the author if he plans to add support for it, the best place for that is probably the Q&A section of the plugin's page: https://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329/view/Discussions

    Looking at the structure of his command parser briefly, it seems like it might be a lot of work to add support for custom commands, but it can't hurt to ask.