Vim Keys in Visual Studio

Anyone who writes applications on the Windows platform will likely spend most of their time in Visual Studio.

Although I find Visual Studio is pretty bloated, it ends up being a necessity when working with clients as it’s a tool the rest of their team will be used to.

To make Visual Studio more friendly to Vim users there is a plugin called VSVim which is available in the market place:
VsVim – Visual Studio Marketplace

Below is the config I’ve been using for over a year and really makes using Visual Studio a much nicer experience.

I’ve tried to group the features and really like using , as the leader key, especially when using the Halmak keyboard layout.

Happy Vimming!!


" Navigation
nnoremap ,. :vsc View.QuickActionsForPosition
nnoremap ,, :vsc Edit.GoToAll
nnoremap ,g :vsc Edit.GoToImplementation
nnoremap ,d :vsc Edit.GoToDefinition
nnoremap ,f :vsc Edit.FindAllReferences
nnoremap ,mn :vsc View.NavigateForward
nnoremap ,mp :vsc View.NavigateBackward
nnoremap ,mm :vsc View.NavigateBackward

nnoremap ,s :vsc File.SaveAll
nnoremap ,x :vsc File.Close

" Errors - ,eX
nnoremap ,ee :vsc View.ErrorList
nnoremap ,en :vsc View.NextError
nnoremap ,ep :vsc View.PreviousError

" Refactoring - ,rX
nnoremap ,ri :vsc Refactor.ExtractInterface
nnoremap ,rr :vsc Refactor.Rename
nnoremap ,rf :vsc Edit.FormatDocument
" comment isn't working
nnoremap ,cc :vsc Edit.ToggleBlockComment
"nnoremap ,cc :vsc Edit.ToggleLineComment

" Tests - ,tX
nnoremap ,ta :vsc TestExplorer.RunAllTests
nnoremap ,tt :vsc TestExplorer.RunAllTestsInContext
nnoremap ,tc :vsc TestExplorer.RunAllTestsInContext
nnoremap ,ts :vsc TestExplorer.RunSelectedTests
nnoremap ,td :vsc TestExplorer.DebugAllTestsInContext
nnoremap ,tf :vsc TestExplorer.RunFailedTests

" Build - ,bX
nnoremap ,bb :vsc Build.BuildSolution
nnoremap ,bc :vsc Build.CleanSolution
nnoremap ,br :vsc Build.RebuildSolution
nnoremap ,bd :vsc Debug.Start
nnoremap ,bw :vsc Debug.StartWithoutDebugging
nnoremap ,bq :vsc Debug.StopDebugging

" Window - ,wX
nnoremap ,wn :vsc Window.NextTab
nnoremap ,wp :vsc Window.PreviousTab
nnoremap ,ww :vsc Window.MoveToMainDocumentGroup
nnoremap ,wa :vsc File.CloseAllButThis
nnoremap ,w/ :vsc Window.NewVerticalTabGroup
nnoremap ,wd :vsc Window.CloseDocumentGroup
nnoremap ,wh :vsc Window.MovetoPreviousTabGroup
nnoremap ,wl :vsc Window.MovetoNextTabGroup
nnoremap ,' :vsc Window.NextDocumentWindowNav

" Ncrunch - ,nX
nnoremap ,nn :vsc NCrunch.GotoNextBuildorTestFailure
nnoremap ,nh :vsc NCrunch.HotSpots
nnoremap ,nm :vsc NCrunch.Metrics
nnoremap ,na :vsc NCrunch.RunAllTestsRightNow
nnoremap ,ns :vsc NCrunch.Showcoveringtests
nnoremap ,np :vsc NCrunch.PincoveringteststoTestsWindow
nnoremap ,nu :vsc NCrunch.UnpincoveringtestsfromTestsWindow
" nnoremap ,nu :vsc NCrunch.UnpinalltestsfromTestsWindow

nnoremap ' `

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s