" ~/.vsneorc — VsNeo user configuration, ported from .vsvimrc (VsVim). " " Install: copy this file to %USERPROFILE%\.vsneorc and restart Visual Studio. " " What is different from VsVim, and why: " " * ':Vsc Some.Command' runs ANY Visual Studio command by its " Tools > Options > Keyboard name - VsVim's command set included, and a " lowercase ':vsc' typed at the start of the command line expands to it " like in VsVim. This file uses the ':Vsc' spelling throughout. " " * Insert mode belongs to Visual Studio. nvim never sees insert-mode keys " (only and are claimed), so 'inoremap' entries can never " fire. jj/jk to escape, insert-mode line movers and insert-mode " clipboard-ring mappings from the .vsvimrc are omitted on purpose. VS's own insert-mode editing " (IntelliSense, Copilot Tab-accept, Ctrl+V paste) keeps working natively. " " * 'set number', 'relativenumber', 'cursorline', 'scrolloff', 'ttimeout', " 'guicursor' are gone: nvim is headless and renders nothing, and " scrolloff in particular would desync the viewport synchroniser (VsNeo " re-forces it to 0 after this file loads anyway). " " * Ctrl+Alt(+Shift) chords are never sent to nvim - that is AltGr on many " layouts and VS's own binding namespace. The multi-caret chords " (, , ) therefore go straight to Visual Studio; " bind Edit.InsertCaretBelow/Above/NextMatchingCaret there if you want them. " " * Copilot 'accept' macros ('i') are gone: executed inside nvim " they would insert a literal tab through the buffer mirror instead of " accepting the suggestion. In insert mode VS's own Tab already accepts. " " * Duplicate left-hand sides were resolved to their LAST definition, which " is what VsVim did with the same file. Notably: " a -> Edit.GoToAll (the Copilot-accept macro is dropped) " . -> View.QuickActions (was also NextDocumentWindow, append '.') " , -> append ',' (was also PreviousDocumentWindow) " sw -> Edit.FindInFiles (normal mode; visual mode stays SurroundWith) " gc -> Team.Git.Commit (was also GenerateConstructor) " bd -> CloseDocumentWindow (was also DisableAllBreakpoints) " tl -> View.TaskList (was also RepeatLastRun) " rf -> Edit.GoToRecentFile (was also Edit.Replace) " tt -> ViewTypeHierarchy (was also View.Terminal) " gb -> Team.Git.ManageBranches (was also Edit.GoToBase) " gp -> Team.Git.Pull (was also PeekDefinition) " n / N -> nzzzv / Nzzzv (was also nzz / Nzz) " Two typos in the original were fixed: '' -> '' on " ReorderParameters, and a stray 'VsVim' suffix on ww. " " * Re-sourcing this file works (:source ~/.vsneorc, or vs below), " but VsNeo's invariant re-assert only runs at startup - if you experiment " with scrolloff/wrap, restart VS to get back to a known-good state. " Search. nvim owns the regex engine, and VsNeo's search-highlight bridge reads " getreg('/') + 'hlsearch', so these all do real work here. set ignorecase set smartcase set hlsearch set incsearch " Indentation, used by nvim's own >> << == operators on the mirrored buffer. set tabstop=4 set shiftwidth=4 set softtabstop=4 set expandtab set autoindent set backspace=eol,start,indent set nostartofline set magic set selection=inclusive " These three groups are read by VsNeo and drive what Visual Studio draws: " Search = every hlsearch match, CurSearch = the match under the cursor, " IncSearch = the yank flash. Defaults follow nvim's own; uncomment to taste. " highlight Search guibg=#3e68d7 " highlight CurSearch guibg=#ff9e64 " highlight IncSearch guibg=#ff9e64 nnoremap let mapleader=" " " F1 help and VS's C-j/C-k are dead in normal/visual mode. The inoremap " versions from the .vsvimrc are omitted - insert mode never reaches nvim. nnoremap vnoremap nnoremap vnoremap nnoremap vnoremap " :Flash was a VsVim-side plugin command; no equivalent exists in VsNeo. " nmap z :Flash " Surround the word under the cursor with a delimiter. nnoremap s) ciw(") nnoremap s] ciw["] nnoremap s} ciw{"} nnoremap s> ciw"> nnoremap s" ciw""" nnoremap s' ciw'"' nnoremap sw) ciW(") nnoremap sw] ciW["] nnoremap sw} ciW{"} nnoremap sw> ciW"> nnoremap sw" ciW""" nnoremap sw' ciW'"' " Surround the visual selection with a delimiter. vnoremap S" c""" vnoremap S' c""' vnoremap S) c(") vnoremap S] c["] vnoremap S} c{"} vnoremap S> c"> vnoremap S* c/*"*/ " Type a delimiter for splitting the line into separate lines. nnoremap \ :s//&\r xnoremap \ :s//&\r nnoremap :nohl " Reload this file. nnoremap vs :source ~/.vsneorc:echo "vsneorc reloaded" map zl :source ~/.vsneorc:echo "vsneorc reloaded" nnoremap a :Vsc Edit.GoToAll nnoremap y "+y vnoremap y "+y " inoremap jj/jk intentionally omitted: insert mode belongs to VS. " Keep search results centered (last-wins resolution of n/N/*/#). nnoremap n nzzzv nnoremap N Nzzzv nnoremap * *zzzv nnoremap # #zzzv nnoremap Y y$ " Replace the visual selection with the default register without yanking it. vnoremap p "_dP " Document window and tab group navigation. nnoremap mp :Vsc Window.MoveToPreviousTabGroup nnoremap mx :Vsc Window.MoveToNextTabGroup nnoremap sg :Vsc SeekyVS.SeekyLiveGrepCommand nnoremap vf :Vsc SeekyVS.SeekyLiveGrepCommand " Keep scrolling centered. nnoremap zzzv nnoremap zzzv " Keep joins centered, cursor on the front. nnoremap J mzJ`z " Move lines up/down. Insert-mode versions omitted (insert passes through). nnoremap :m .+1== nnoremap :m .-2== vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " Easier indent in visual mode: stay in visual mode. vnoremap < >gv " Toggles. noremap ln :Vsc Edit.ToggleLineNumbers noremap wws :Vsc Edit.ViewWhiteSpace " Line-ending punctuation helpers. noremap . :Vsc View.QuickActions noremap , :s/\v\s*(,\s*)*$/,/:nohl noremap ; :s/\v\s*(;\s*)*$/;/:nohl noremap x :s/.\{1}$//:nohl " Pinning and tab management. noremap wp :Vsc Window.PinTab noremap wca :Vsc Window.CloseAllButPinned nnoremap :Vsc Window.NextTab nnoremap :Vsc Window.PreviousTab nnoremap c :Vsc Window.Close " Window navigation. nnoremap wf :Vsc FullScreen nnoremap wc :Vsc Window.CloseDocumentWindow nnoremap wj :Vsc Window.NextDocumentWindow nnoremap wk :Vsc Window.PreviousDocumentWindow nnoremap :Vsc FullScreen nnoremap :Vsc Window.CloseDocumentWindow nnoremap :Vsc Window.NextDocumentWindow nnoremap :Vsc Window.PreviousDocumentWindow xnoremap sw :Vsc Edit.SurroundWith nnoremap is :Vsc Edit.InsertSnippet " Comment / uncomment. nnoremap cc V:Vsc Edit.CommentSelection xnoremap cc :Vsc Edit.CommentSelection nnoremap CC V:Vsc Edit.UncommentSelection xnoremap CC :Vsc Edit.UncommentSelection nnoremap fif :Vsc Edit.FindInFiles nnoremap :nohlsearch " K - quick info and parameter details. Overrides VsNeo's built-in K. nnoremap K :Vsc Edit.QuickInfo:Vsc Edit.ParameterInfo " Improve navigation when wrapping: VS owns wrap, so j/k follow screen lines. nnoremap j gj nnoremap k gk " Navigation history. noremap - :Vsc View.NavigateBackward noremap = :Vsc View.NavigateForward " Goto commands. nnoremap gd :Vsc Edit.GotoDefinition nnoremap d :Vsc Edit.GotoDeclaration nnoremap gi :Vsc Edit.GoToImplementation nnoremap gf :Vsc Edit.GoToFile nnoremap f :Vsc Edit.GoToFile nnoremap gt :Vsc Edit.GoToType nnoremap gT :Vsc Edit.GotoTypeDefinition nnoremap rf :Vsc Edit.GoToRecentFile nnoremap sf :Vsc EditorContextMenus.CodeWindow.ToggleHeaderCodeFile noremap ff :Vsc Edit.GoToFile noremap fm :Vsc Edit.GoToMember noremap fw :Vsc Edit.GoToAll noremap gs :Vsc Edit.GoToSymbol noremap gco :Vsc Copilot.ToggleCompletions noremap gcp :Vsc Copilot.ToggleCompletions " Refactor. nnoremap rn :Vsc Refactor.Rename xnoremap rn :Vsc Refactor.Rename xnoremap rem :Vsc Refactor.ExtractMethod nnoremap rem :Vsc Refactor.ExtractMethod xnoremap rrp :Vsc Refactor.RemoveParameters nnoremap rrp :Vsc Refactor.RemoveParameters xnoremap rop :Vsc Refactor.ReorderParameter nnoremap rop :Vsc Refactor.ReorderParameters " Code generation. nnoremap gh :Vsc EditorContextMenus.CodeWindow.GenerateEqualsAndGetHashCode " Tests. noremap tr :Vsc TestExplorer.RunSelectedTests noremap ta :Vsc TestExplorer.RunAllTests noremap tf :Vsc TestExplorer.RunFailedTests noremap td :Vsc TestExplorer.DebugSelectedTests noremap tss :Vsc TestExplorer.ShowTestExplorer noremap tsc :Vsc View.CodeCoverageResults " Breakpoints. bd resolves to CloseDocumentWindow below (last wins). noremap be :Vsc Debug.EnableAllBreakpoints noremap br :Vsc Debug.DeleteAllBreakpoints noremap ba :Vsc Debug.Breakpoints " Build / debug. noremap sb :Vsc Build.BuildSolution noremap sc :Vsc Build.CleanSolution noremap sbs :Vsc Build.BuildSelection noremap scs :Vsc Build.CleanSelection noremap sd :Vsc Debug.Start noremap sr :Vsc Debug.StartWithoutDebugging noremap sbc :Vsc Build.Cancel noremap sdc :Vsc Debug.StopDebugging nnoremap qw :Vsc Debug.QuickWatch nnoremap :Vsc Debug.SetNextStatement nnoremap :Vsc Debug.StepOver nnoremap :Vsc Debug.StepInto nnoremap :Vsc Debug.StepOut " Solution explorer / blame. nnoremap e :Vsc View.SolutionExplorer nnoremap lb :Vsc Git.Blame " PeasyMotion bindings (work if the extension is installed). noremap ,, :Vsc Tools.InvokePeasyMotion noremap ls :Vsc Tools.InvokePeasyMotionLineJumptoWordBegining noremap le :Vsc Tools.InvokePeasyMotionLineJumpToWordEnding noremap ,t :Vsc Tools.InvokePeasyMotionJumpToDocumentTab nmap ;l gS:Vsc Tools.InvokePeasyMotionJumpToLineBegining nmap ;c gS:Vsc Tools.InvokePeasyMotionTwoCharJump " Visual Assist. noremap ms :Vsc VAssistX.FindSelected noremap gD :Vsc View.ClassViewShowDerivedTypes noremap v :Vsc Window.NewVerticalTabGroup noremap np :Vsc OtherContextMenus.UITestEditorContextMenu.Splitintoanewmethod noremap ww :Vsc Window.Windows " Quick Actions (lightbulb). nnoremap qa :Vsc View.QuickActions " Format document / selection. nnoremap fd :Vsc Edit.FormatDocument vnoremap fd :Vsc Edit.FormatSelection " Organize usings. nnoremap ou :Vsc Edit.RemoveAndSort " Navigate errors/warnings. nnoremap ]e :Vsc View.NextError nnoremap [e :Vsc View.PreviousError nnoremap ]d :Vsc Edit.GoToNextIssueinFile nnoremap [d :Vsc Edit.GoToPreviousIssueinFile " Navigate methods/members. nnoremap ]m :Vsc Edit.NextMethod nnoremap [m :Vsc Edit.PreviousMethod " Peek definition / implementation. gp resolves to Git Pull below. nnoremap gp :Vsc Edit.PeekDefinition nnoremap gP :Vsc Edit.PeekImplementation " Copilot Chat. nnoremap ai :Vsc GitHub.Copilot.Chat.ToggleChatWindow nnoremap ae :Vsc Explain vnoremap ae :Vsc Explain nnoremap af :Vsc GitHub.Copilot.Chat.Fix vnoremap af :Vsc GitHub.Copilot.Chat.Fix nnoremap ad :Vsc GitHub.Copilot.Chat.Doc vnoremap ad :Vsc GitHub.Copilot.Chat.Doc " Bookmarks. nnoremap mt :Vsc Edit.ToggleBookmark nnoremap mn :Vsc Edit.NextBookmark nnoremap mN :Vsc Edit.PreviousBookmark nnoremap mc :Vsc Edit.ClearBookmarks nnoremap ma :Vsc View.BookmarkWindow " Sync Solution Explorer with the active document, error list, output. nnoremap el :Vsc SolutionExplorer.SyncWithActiveDocument nnoremap er :Vsc View.ErrorList nnoremap to :Vsc View.Output " Extract interface. nnoremap rei :Vsc Refactor.ExtractInterface nnoremap fz :Vsc Edit.GoToText " Git (LazyVim-style). nnoremap gg :Vsc Team.Git.GoToGitChanges nnoremap gc :Vsc Team.Git.Commit nnoremap gp :Vsc Team.Git.Pull nnoremap gP :Vsc Team.Git.Push nnoremap gb :Vsc Team.Git.ManageBranches nnoremap gl :Vsc Team.Git.ViewHistory nnoremap gd :Vsc Diff.CompareWithUnmodified nnoremap gB :Vsc Team.Git.Annotate nnoremap vc :Vsc View.GitChanges nnoremap gr :Vsc View.GitRepository " UI toggles. nnoremap uf :Vsc View.FullScreen nnoremap uw :Vsc Edit.ToggleWordWrap " Buffer navigation, LazyVim style. is just H, which TextInput delivers. nnoremap :Vsc Window.PreviousTab nnoremap :Vsc Window.NextTab nnoremap bb :Vsc Debug.ToggleBreakpoint nnoremap bd :Vsc Window.CloseDocumentWindow nnoremap bo :Vsc Window.CloseAllButThis " Splits, LazyVim style. nnoremap - :Vsc Window.NewHorizontalTabGroup nnoremap :Vsc Window.NewVerticalTabGroup " LazyVim LSP-style. nnoremap cr :Vsc Refactor.Rename nnoremap ca :Vsc View.QuickActions vnoremap ca :Vsc View.QuickActions vnoremap cf :Vsc Edit.FormatSelection " Telescope-like. nnoremap :Vsc Edit.GoToFile nnoremap / :Vsc Edit.FindInFiles nnoremap : :Vsc View.CommandWindow nnoremap fb :Vsc Window.Windows nnoremap fr :Vsc Edit.GoToRecentFile nnoremap sw :Vsc Edit.FindInFiles nnoremap gs :Vsc Edit.GoToSymbol nnoremap ci :Vsc Edit.ListMembers nnoremap cs :Vsc Edit.CompleteWord " Call/type hierarchy, navigation bar, document outline. nnoremap ch :Vsc Edit.ViewCallHierarchy nnoremap th :Vsc View.ClassView nnoremap tt :Vsc Edit.ViewTypeHierarchy nnoremap vn :Vsc Window.MoveToNavigationBar nnoremap do :Vsc View.DocumentOutline " Collapse/expand regions. nnoremap zC :Vsc Edit.CollapseAllOutlining nnoremap zO :Vsc Edit.ExpandAllOutlining nnoremap zT :Vsc Edit.ToggleAllOutlining " Go to enclosing brace. nnoremap [{ :Vsc Edit.GotoBrace nnoremap ]} :Vsc Edit.GotoBrace vnoremap [{ :Vsc Edit.GotoBraceExtend vnoremap ]} :Vsc Edit.GotoBraceExtend " CamelCase word-part navigation. nnoremap :Vsc Edit.WordPrevious nnoremap :Vsc Edit.WordNext " Last edit location. nnoremap ge :Vsc Edit.GoToLastEditLocation " Multi-caret: the family now goes straight to Visual Studio " (Ctrl+Alt is never claimed by VsNeo). Bind the commands there instead. " Select all occurrences still goes through a mapping: vnoremap sa :Vsc Edit.InsertCaretsatAllMatching " Clipboard ring. The insert-mode chord is omitted - VS's own Ctrl+Shift+V " works natively in insert mode. nnoremap pr :Vsc Edit.CycleClipboardRing " Duplicate line/selection. nnoremap yd :Vsc Edit.Duplicate vnoremap yd :Vsc Edit.Duplicate " Task list and TODO navigation. nnoremap tl :Vsc View.TaskList nnoremap ]t :Vsc Edit.NextTask nnoremap [t :Vsc Edit.PreviousTask " NuGet, new item/class, references. nnoremap ng :Vsc Tools.ManageNuGetPackagesforSolution nnoremap na :Vsc Project.AddNewItem nnoremap nc :Vsc Project.AddClass nnoremap nr :Vsc Project.AddReference nnoremap vib :Vsc Edit.SelectContainingDeclaration " Indent with BS/TAB in normal/visual mode. nnoremap << nnoremap >> xnoremap >gv " Argument splitting. vnoremap l, :s/, /,\r/ggv=:noh nnoremap lis vi(:s/, /,\r/g:Vsc Edit.FormatSelection:noh nnoremap fas f(a:s/, /, \r/g:noh