Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to map keys in VsVim to Visual Studio commands?

Is it possible to map keys in VsVim to Visual Studio commands? For example, can I map gb to View.NavigateBackward?

like image 201
Smilediver Avatar asked Nov 23 '14 13:11

Smilediver


People also ask

What is vsvim and how to use it?

This is where you can map keys like the traditional vim editor (it lives in your windows user home directory). VsVim also allows you to bind things to visual studio commands, and by extension, resharper. The following are a number of useful bindings

How do I map a key in Vim?

How to map keys in vim Say you want to setup vim to have a certain key stroke, preform a desired operation You can use the map command to do this. The file [s] to add the mappings are ~/.vimrc or /etc/vim/vimrc or you can add a map, temporarily, through vim command-line.

How to setup Vim to have a certain key stroke?

Say you want to setup vim to have a certain key stroke, preform a desired operation You can use the map command to do this. The file [s] to add the mappings are ~/.vimrc or /etc/vim/vimrc or you can add a map, temporarily, through vim command-line. Keys can be mapped in all types of modes, all mapping syntaxes are the same as described above

Can vsvim handle Ctrl key combinations?

Resharper / VsVim Handling of Ctrl In the VsVim Settings you can set whether VsVim or VisualStudio should handle the various Ctrl key combinations, there is fine grained control over the various Ctrl combinations, but in general, prefer using VsVim if VsVim has functionality that uses Ctrl.


1 Answers

You do it via your _vsvimrc file.

This should do the trick:

nnoremap gb :vsc View.NavigateBackward<CR>

You can even map extension commands, like those from Resharper:

nnoremap gi :vsc Resharper.Resharper_GotoImplementation<CR>

The full documentation is here: https://github.com/jaredpar/VsVim/wiki/VsVim-Nonstandard-Behavior

like image 155
Thomas Svensen Avatar answered Oct 24 '22 09:10

Thomas Svensen