" [ReSharper Documentation](https://www.jetbrains.com/help/resharper/) " 避免 key mapping 覆蓋 `"` 與 `/` 暫存器, 分別採用 `z` 與 `s` 暫存器替代 " Not support InsertLeave autocmd 自動切換回英文輸入法 "autocmd InsertLeave * !%USERPROFILE%\\.vscode\\extensions\\im-select.exe 1033 inoremap :!%USERPROFILE%\\.vscode\\extensions\\im-select.exe 1033 " 清除 key mapping mapc nmapc vmapc set visualbell set number set relativenumber set clipboard=unnamed set hlsearch set ignorecase set incsearch set scrolloff=5 nnoremap % :vsc Edit.GoToBrace let mapleader="," nnoremap so :source ~/vimfiles/.vsvimrc " 離開這個超級討厭的 "-- VISUAL -- 和 External edit detected (hit to return to previous mode, to cancel external edit) 的輪迴" " v_CTRL-C: In Visual mode: Stop Visual mode. When insert mode is pending (the mode message shows "-- (insert) VISUAL --"), it is also stopped. vnoremap " # Folding # " zf, zF: create " zd: delete " zo, zO: open / open recursively " zc, zC: close / close recursively " zR: open all folds " zM: Close all folds nnoremap zd :vsc Edit.CollapsetoDefinitions " " # Search # " " /: Search forward for the [count]'th occurrence of {pattern} " " ?: Search backward for the [count]'th previous occurrence of {pattern} " " *: Search forward for the [count]'th occurrence of the word nearest to the cursor. " " #: Same as "*", but search backward. " " n: Repeat the latest "/" or "?" [count] times. " " N: Repeat the latest "/" or "?" [count] times in opposite direction. " nnoremap / :vsc Edit.Find " " nnoremap * :vsc Edit.FindNextSelected " vnoremap * :vsc Edit.FindNextSelected " nnoremap # :vsc Edit.FindPreviousSelected " vnoremap # :vsc Edit.FindPreviousSelected " nnoremap n :vsc Edit.FindNextSelected " vnoremap n :vsc Edit.FindNextSelected " nnoremap N :vsc Edit.FindPreviousSelected " vnoremap N :vsc Edit.FindPreviousSelected nnoremap , A, nnoremap ; A; nnoremap h ^ vnoremap h ^ onoremap h ^ nnoremap l $ vnoremap l $ onoremap l $ " [Consider implementing tpope/vim-surround · Issue #1474 · VsVim/VsVim](https://github.com/VsVim/VsVim/issues/1474) " - created by jborn " Surround simulating bindings nnoremap s( ciw(") nnoremap s) ciw(") nnoremap s[ ciw["] nnoremap s] ciw["] 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{"} nnoremap sw< ciW"> nnoremap sw> ciW"> nnoremap sw" ciW""" nnoremap sw' ciW'"' " Surround delete bindings nnoremap ds( vi(dvhp nnoremap ds) vi(dvhp nnoremap ds[ vi[dvhp nnoremap ds] vi[dvhp nnoremap ds{ vi{dvhp nnoremap ds} vi{dvhp nnoremap ds< vi vimsvi"lcl'`scl' nnoremap cs'" vi'ohmsvi'lcl"`scl" " Surround visual selected text vnoremap S" c""" vnoremap S' c""' vnoremap S( c(") vnoremap S) c(") vnoremap S[ c["] vnoremap S] c["] vnoremap S{ c{"} vnoremap S} c{"} vnoremap S< c"> vnoremap S> c"> vnoremap S* c/*"*/ "vnoremap St cdiv>" " Surround in div tag and edit tag vnoremap St cdiv>"`lcw " # ReSharper # " == Code Analysis == " (x) Toggle code analysis in the current file | Ctrl+Alt+Shift+8 | ReSharper_EnableDaemon " nnoremap gh :vsc ReSharper.ReSharper_GotoNextHighlight " nnoremap gH :vsc ReSharper.ReSharper_GotoPrevHighlight nnoremap ge :vsc ReSharper.ReSharper_GotoNextErrorInSolution nnoremap gE :vsc ReSharper.ReSharper_GotoPrevErrorInSolution " Inspect this: Ctrl+Shift+Alt+A " nnoremap si :vsc ReSharper.ReSharper_InspectThis " (x) Inspection Results window | Ctrl+Alt+, | ReSharper_ShowInspectionWindow " View hierarchy: Ctrl+Alt+H " nnoremap ih :vsc ReSharper.ReSharper_TypeHierarchyBrowse " == Coding Assistance == " Show action list: Alt+Enter nnoremap a :vsc ReSharper_AltEnter vnoremap a :vsc ReSharper_AltEnter " Go to Action: Ctrl+Shift+A nnoremap A :vsc ReSharper.ReSharper_GotoAction vnoremap A o:vsc ReSharper.ReSharper_GotoAction " (x) Paste from clipboard history | Ctrl+Shift+V | ReSharper_PasteMultiple " (x) Code cleanup | Ctrl+Alt+F | ReSharper_CleanupCode " Silent code cleanup: Ctrl+Shift+Alt+F nnoremap F :vsc ReSharper.ReSharper_SilentCleanupCode " Reformat code (Formatting Style): Ctrl+Alt+L nnoremap f :vsc ReSharper.ReSharper_ReformatCode " nnoremap f :vsc Edit.FormatDocument " (x) Apply Syntax Style | Ctrl+Alt+S | ReSharper_ApplyCodeStyle " (x) Basic code completion | Ctrl+Space | ReSharper_CompleteCodeBasic " (x) Smart code completion | Ctrl+Shift+Space | ReSharper_CompleteCodeSmart " (x) Import symbol completion | Ctrl+Alt+Space | ReSharper_CompleteCodeTypeName " (x) Force completion for non-preselected item | Ctrl+Enter | ReSharper_ForceCompleteItem " (x) Complete statement | Ctrl+Shift+Enter | ReSharper_CompleteStatement 補上 () {} ; " Parameter information: show/go to the next signature: Ctrl+P nnoremap p :vsc ReSharper.ReSharper_ParameterInfoShow " (x) Parameter information: go to the previous signature: | Ctrl+Alt+Shift+Space | ReSharper_ParameterInfoGoToPreviousSignature " Dispaly Quick Info: Ctrl+K, Ctrl+I (使用 code completion 也能達到同樣功能) nnoremap q :vsc Edit.QuickInfo " Quick documentation: Ctrl+Q, Ctrl+D nnoremap Q :vsc ReSharper.ReSharper_QuickDoc " (x) Toggle Inlay Hints | Ctrl+Alt+Shift+5 | ReSharper_ToggleInlayHints " Copy code reference: Ctrl+Alt+Shift+C nnoremap c :vsc ReSharper.ReSharper_CopyFqn " 複製 member 含 [attribute] (游標在 member 內, 或 member 的下方) nnoremap cm :let @s=@/:vsc ReSharper.ReSharper_GotoPrevMember?[};{]\+j0/[;{]\+%"zy"zP/\w\+\(\ *\|\_.$* *\)[({;]v$"zy/z:let @/=@s " 複製 statement (Select statement: [s) " 加上 , , ...等, 才有作用, why? nmap cs [s"zy"zPf(l " Generate code: Alt+Insert nnoremap ng :vsc ReSharper.ReSharper_Generate " Insert live template: Ctrl+J nnoremap ni :vsc ReSharper.ReSharper_LiveTemplatesInserti " Surround with template: Alt+Ctrl+J nnoremap ns :vsc ReSharper.ReSharper_SurroundWith vnoremap ns o:vsc ReSharper.ReSharper_SurroundWith " Generate a SetUp method of NUnit nnoremap nts :let @s=@/"zdd?classjo[SetUp]publicvoidSetUp(){}"zP:vsc ReSharper.ReSharper_SilentCleanupCode:let @/=@s " Create file from template: Alt+Ctrl+Insert " nnoremap nf :vsc ReSharper.ReSharper_GenerateFileBesides nnoremap nf :vsc Project.AddNewItem nnoremap np :vsc File.AddNewProject nnoremap k :vsc Edit.MoveSelectedLinesUp vnoremap k :vsc Edit.MoveSelectedLinesUp nnoremap j :vsc Edit.MoveSelectedLinesDown vnoremap j :vsc Edit.MoveSelectedLinesDown nnoremap rk :vsc ReSharper.ReSharper_MoveUp vnoremap rk :vsc ReSharper.ReSharper_MoveUp nnoremap rj :vsc ReSharper.ReSharper_MoveDown vnoremap rj :vsc ReSharper.ReSharper_MoveDown nnoremap rh :vsc ReSharper.ReSharper_MoveLeft vnoremap rh :vsc ReSharper.ReSharper_MoveLeft nnoremap rl :vsc ReSharper.ReSharper_MoveRight vnoremap rl :vsc ReSharper.ReSharper_MoveRight " VsVim: " - select word or token at caret (normal) " (single-line selection) - add next occurrence of primary selection (visual, select) " (multi-line selection) - split selection into carets (visual, select) " VSCodeVim: " gb - adds another cursor on the next word it finds which is the same as the word under the cursor. nnoremap gb :vsc Edit.InsertNextMatchingCaret vnoremap gb o:vsc Edit.InsertNextMatchingCaret " gh - equivalent to hovering your mouse over wherever the cursor is. Handy for seeing types and error messages without reaching for the mouse! nnoremap gh :vsc Edit.QuickInfo nnoremap gB :vsc Edit.InsertCaretsatAllMatching " Extend selection: Ctrl+W nnoremap w :vsc ReSharper.ReSharper_ExtendSelection vnoremap w :vsc ReSharper.ReSharper_ExtendSelection " Shrink selection: Ctrl+Shift+W nnoremap W :vsc ReSharper.ReSharper_ShrinkSelection vnoremap W :vsc ReSharper.ReSharper_ShrinkSelection " Select containing declaration: Ctrl+Shift+[ vnoremap [[ :vsc ReSharper_SelectContainingDeclaration " Select statement nnoremap [s :let @s=@/+?}va{$o?\<\(if\|switch\|while\|do\|for\|foreach\|using\):let @/=@sgv " <--- statements ---> " Duplicate current line or selection: Ctrl+D nnoremap d :vsc ReSharper.ReSharper_DuplicateText vnoremap d V:vsc ReSharper.ReSharper_DuplicateText " nnoremap d :vsc Edit.Duplicate " vnoremap d V:vsc Edit.Duplicate " (x) Join lines | Ctrl+Shift+J | ReSharper_JoinLines " (x) Comment with line comment | Ctrl+/ | ReSharper_LineComment " (x) Comment with block comment | Ctrl+Shift+/ | ReSharper_BlockComment " (x) Run configurations popup | Ctrl+Shift+Alt+R | ReSharper_RunConfigSettings " (x) Run with/without building | Ctrl+Alt+F5 | ReSharper_CurrentConfigRunAlt " (x) Debug with/without building | Alt+F5 | ReSharper_CurrentConfigDebugAlt " == Navigation and Search == " Search Everywhere/Go to Type: Ctrl+N nnoremap gn :vsc ReSharper.ReSharper_GotoType " Go To File: Shift+Ctrl+N nnoremap gf :vsc ReSharper.ReSharper_GotoFile " Go to file member: Ctrl+F12 nnoremap gm :vsc ReSharper.ReSharper_GotoFileMember " (x) Go to symbol | Shift+Ctrl+Alt+N | ReSharper_GotoSymbol " (x) Go to text | Ctrl+N,N,N | ReSharper_GotoText " Navigate To: Ctrl+Shift+G nnoremap sg :vsc ReSharper.ReSharper_NavigateTo " Go to type of symbol: Ctrl+Shift+T nnoremap gt :vsc ReSharper.ReSharper_GotoTypeDeclaration " Goto local Declaration: gd " Go to declaration: Ctrl+B nnoremap gd :vsc ReSharper.ReSharper_GotoDeclaration " Go to implementation: Ctrl+Shift+Alt+B nnoremap gi :vsc ReSharper.ReSharper_GotoImplementations " Go to parameter declaration nnoremap gp :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToParameter " nnoremap gp :vsc ReSharper.ReSharper_NavigateToParameter " Go to base symbols: Ctrl+U nnoremap gb :vsc ReSharper.ReSharper_GotoBase " Go to derived symbols: Alt+Ctrl+B nnoremap gB :vsc ReSharper.ReSharper_GotoInheritors " Go to usage: Ctrl+Alt+F7 nnoremap gu :vsc ReSharper.ReSharper_ShowUsages " Find usages: Alt+F7 nnoremap gU :vsc ReSharper.ReSharper_FindUsages " (x) Find usages of related entities | Shift+Alt+F7 | ReSharper_FindUsagesAdvanced nnoremap gx :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToFunctionExits " Navigate To Metadata View " nnoremap gs :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToMetadataView " Navigate To Sources from Symbol Files " nnoremap gs :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToPdb " Navigate To Decompiled Sources nnoremap gs :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToDecompiledSources " Go to containing declaration: Ctrl+[ nnoremap [[ :vsc ReSharper.ReSharper_GotoContainingDeclaration nnoremap [m :vsc ReSharper.ReSharper_GotoPrevMember nnoremap ]m :vsc ReSharper.ReSharper_GotoNextMember " nnoremap [[ 0?{:nohl " nnoremap ]] $/{:nohl " nnoremap [[ :vsc ReSharper.ReSharper_GotoPrevMember:vsc ReSharper.ReSharper_GotoPrevMember/[={;]:nohl " nnoremap ]] :vsc ReSharper.ReSharper_GotoNextMember/[={;]:nohl nnoremap [[ :let @s=@/:vsc Edit.PreviousMethod:vsc Edit.PreviousMethod/[={;]:nohl:let @/=@s+ nnoremap ]] :let @s=@/:vsc Edit.NextMethod/[={;]:nohl:let @/=@s+ " (x) Structural navigation: forwards | Tab | ReSharper_StructuralNavigationForward " (x) Structural navigation: backwards | Shift+Tab | ReSharper_StructuralNavigationBackward " (x) Highlight usages in file | Ctrl+Shift+F7 | ReSharper_HighlightUsages " (x) Go to previous location/highlight | Ctrl+Alt+PageUp | ReSharper_ResultListGoToPrevLocation " (x) Go to next location/highlight | Ctrl+Alt+PageDown | ReSharper_ResultListGoToNextLocation " (x) Remove highlighting of usages | Esc | " (x) View recent files | Ctrl+E | ReSharper_GotoRecentFiles " (x) View recent edits | Alt+Shift+Ctrl+Backspace | ReSharper_GotoRecentEdits " (x) Go to related files | Ctrl+Alt+Shift+G | ReSharper_GotoRelatedFiles " Locate in Solution/Assembly Explorer: Alt+Shift+L nnoremap gl :vsc ReSharper.ReSharper_LocateInSolutionOrAssemblyExplorer " Navigate to Windows Explorer nnoremap gw :vsc EditorContextMenus.CodeWindow.Navigate.ReSharper_NavigateToWindowsExplorer " (x) Optimize References | Ctrl+Alt+Y | ReSharper_OptimizeReferences " Navigation history " Go to previous edit: Shift+Ctrl+Backspace nnoremap :vsc ReSharper.ReSharper_GotoLastEditLocation " Backward: ReSharper_NavigateBackward nnoremap :vsc View.NavigateBackward " Forward: ReSharper_NavigateForward nnoremap :vsc View.NavigateForward " == Refactorings == nnoremap sr :vsc ReSharper.ReSharper_RefactorThis vnoremap sr :vsc ReSharper.ReSharper_RefactorThis nnoremap rR :vsc ReSharper.ReSharper_Rename vnoremap rR :vsc ReSharper.ReSharper_Rename nnoremap rr :vsc Refactor.Rename vnoremap rr :vsc Refactor.Rename " --- Encapsulate --- nnoremap rc :vsc ReSharper.ReSharper_ExtractClass vnoremap rc :vsc ReSharper.ReSharper_ExtractClass nnoremap ri :vsc ReSharper.ReSharper_ExtractInterface vnoremap ri :vsc ReSharper.ReSharper_ExtractInterface nnoremap rm :vsc ReSharper.ReSharper_ExtractMethod vnoremap rm :vsc ReSharper.ReSharper_ExtractMethod nnoremap re :vsc ReSharper.ReSharper_EncapsulateField vnoremap re :vsc ReSharper.ReSharper_EncapsulateField " --- Introduce --- nnoremap rv :vsc ReSharper.ReSharper_IntroVariable vnoremap rv :vsc ReSharper.ReSharper_IntroVariable nnoremap rp :vsc ReSharper.ReSharper_IntroduceParameter vnoremap rp :vsc ReSharper.ReSharper_IntroduceParameter " Replace a string with a parameter nnoremap rsp vi":vsc ReSharper.ReSharper_IntroduceParameter nnoremap rf ^t=B:vsc ReSharper.ReSharper_IntroduceField vnoremap rf :vsc ReSharper.ReSharper_IntroduceField " --- Inline --- nnoremap rn ^t=B:vsc ReSharper.ReSharper_InlineVariable vnoremap rn :vsc ReSharper.ReSharper_InlineVariable " --- Others --- nnoremap ro :vsc ReSharper.ReSharper_Move vnoremap ro :vsc ReSharper.ReSharper_Move nnoremap rcs :vsc ReSharper.ReSharper_ChangeSignature vnoremap rcs :vsc ReSharper.ReSharper_ChangeSignature nnoremap rd :vsc ReSharper.ReSharper_SafeDelete vnoremap rd :vsc ReSharper.ReSharper_SafeDelete " == Unit Testing == nnoremap nt :vsc EditorContextMenus.CodeWindow.CreateUnitTests " Unit Test Explorer: Ctrl+Alt+T nnoremap vU :vsc ReSharper.ReSharper_ShowUnitTestExplorer " Repeat previous test run: Ctrl+T T nnoremap ut :vsc ReSharper.ReSharper_UnitTestSessionRepeatPreviousRun " Run tests under dotMemory Unit: Ctrl+T M " nnoremap v :vsc ReSharper.ReSharper_ProfileAllTestsInCurrentContextWithMemoryUnit " --- Session --- " Unit Test Sessions: Ctrl+Alt+R nnoremap vu :vsc ReSharper.ReSharper_ShowUnitTestSessions " Append to test session: Ctrl+T A " nnoremap u :vsc ReSharper.ReSharper_UnitTestSessionAppendTests " Create new test session: Ctrl+T N " nnoremap u :vsc ReSharper.ReSharper_UnitTestSessionNewSession " --- Run --- " Run unit tests: Ctrl+T R nnoremap ur :vsc ReSharper.ReSharper_SilentCleanupCode:vsc ReSharper.ReSharper_UnitTestRunFromContext " Run all tests in solution: Ctrl+T L nnoremap ua :vsc ReSharper.ReSharper_SilentCleanupCode:vsc ReSharper.ReSharper_UnitTestRunSolution " Run current test session: Ctrl+T Y nnoremap us :vsc ReSharper.ReSharper_SilentCleanupCode:vsc ReSharper.ReSharper_UnitTestRunCurrentSession " --- Debug --- " Debug unit tests: Ctrl+T D nnoremap ud :vsc ReSharper.ReSharper_UnitTestDebugContext " == Tool Windows == " (x) Go to breakpoints | Ctrl+Alt+F9 | ReSharper_GotoBreakpoints " (x) View bookmarks | Ctrl+` | ReSharper_BookmarksBookmarksMenu " (x) Go to numbered bookmark | Ctrl+[digit] | ReSharper_BookmarksGoToBookmarkX " (x) Toggle numbered bookmark | Ctrl+Shift+[digit] | ReSharper_BookmarksToggleBookmarkX " nnoremap m :vsc " (x) File structure | Ctrl+F11 | ReSharper_ShowCodeStructure " (x) Find Results window | Ctrl+Alt+U | ReSharper_ShowFindResults " (x) Stack Trace Explorer | Ctrl+Shift+E | ReSharper_ExploreStackTrace " (x) To-do items | Ctrl+Alt+. | ReSharper_ShowTodoExplorer " # View # nnoremap :vsc View.Terminal nnoremap vs :vsc View.SolutionExplorer nnoremap vv :vsc View.GitWindow nnoremap vV :vsc View.GitRepositoryWindow " nnoremap v :vsc View.TaskList nnoremap ve :vsc View.ErrorList nnoremap vp :vsc View.PackageManagerConsole " nnoremap vb :vsc " # Copilot # nnoremap i :vsc Ask.Copilot vnoremap i :vsc Ask.Copilot nnoremap vi :vsc View.GitHub.Copilot.Chat " # Tab # nnoremap ta :vsc Window.CloseAllDocuments nnoremap to :tabo " switch between tabs nnoremap ts :vsc Window.NextDocumentWindowNav " # Build # "Cancel: Ctrl+Break nnoremap bb :vsc Build.Cancel " == Solution == nnoremap bS :vsc Build.BuildSolution nnoremap bC :vsc Build.CleanSolution nnoremap bR :vsc Build.RebuildSolution " == Project == nnoremap bs :vsc Build.BuildSelection nnoremap bc :vsc Build.CleanSelection nnoremap br :vsc Build.RebuildSelection " # ASP.NET MVC # " Go to controller: Ctrl+M, Ctrl+G nnoremap gc :vsc OtherContextMenus.HTMLContext.GoToController " Go to view: Ctrl+M, Ctrl+G nnoremap gv :vsc EditorContextMenus.CodeWindow.GoToView " Add view nnoremap nv :vsc EditorContextMenus.CodeWindow.AddView " " # Debug # " " where " nnoremap ;w :vsc Debug.ShowNextStatement " " nnoremap ;s :vsc Debug.StepInto " nnoremap ;S :vsc Debug.StepIntoSpecific " " nnoremap ;n :vsc Debug.StepOver " nnoremap ;q :vsc Debug.StepOut " " nnoremap ;r :vsc Debug.RunToCursor " nnoremap ;R :vsc Debug.SetNextStatement " " nnoremap ;c :vsc Debug.Start " " nnoremap ;aw :vsc Debug.AddWatch " # PeasyMotion # " Two char search mode: " nnoremap m :vsc Tools.InvokePeasyMotionTwoCharJump nnoremap :vsc Tools.InvokePeasyMotionTwoCharJump " Whole viewport jump-to-word beginning mode: " nnoremap M :vsc Tools.InvokePeasyMotion " Jump to any open document tab " nnoremap mt :vsc Tools.InvokePeasyMotionJumpToDocumentTab " Select text from current caret position to desired jump label (fwd and reverse directions supported) " nnoremap s :vsc Tools.InvokePeasyMotionTextSelect " Jump to word beginning in current line " nnoremap b :vsc Tools.InvokePeasyMotionLineJumpToWordBegining " Jump to word ending in current line " nnoremap e :vsc Tools.InvokePeasyMotionLineJumpToWordEnding " Jump to line beginning: " nnoremap l :vsc Tools.InvokePeasyMotionJumpToLineBegining