diff --git a/ideavimrc b/ideavimrc new file mode 100644 index 0000000..3c80ce9 --- /dev/null +++ b/ideavimrc @@ -0,0 +1,243 @@ +" ================================================================================================ +" = Extensions ===================================== +" ================================================================================================ +Plug 'tpope/vim-surround' +Plug 'preservim/nerdtree' + +" ================================================================================================ +" = Basic settings ===================================== +" ================================================================================================ +# set clipboard+=unnamed +set ignorecase +set scrolloff=30 +set history=200 +set easymotion + +set number +set relativenumber + +set incsearch +set hlsearch +set smartcase + +set keep-english-in-normal + +inoremap +inoremap + +inoremap jj +" ================================================================================================ +" = Ctrl开头 ==================================== +" ================================================================================================ +" 可视化模式下,选中行可以上下移动 +vmap (MoveLineDown) +vmap (MoveLineUp) + +" 切换spliter +nmap (PrevSplitter) +nmap (NextSplitter) +" 切换tab +nmap (PreviousTab) +nmap (NextTab) + +nmap L g_ +nmap H ^ + +" ================================================================================================ +" = No Leader Keymaps ===================================== +" ================================================================================================ +" 寻找下一个错误 +nmap ge (GotoNextError) +" 回到上一个错误 +nmap gp (GotoPreviousError) +" 进入测试方法 +nmap gt (GotoTest) +" 回到函数方法上 +nmap gm (MethodUp) +" 寻找接口实现的 +nmap gi (GotoImplementation) +" 寻找函数使用的地方 +nmap gd (GotoDeclaration) +" 后退 +nmap gb (Back) +" 前进 +nmap gf (Forward) +" 回到上一次修改的地方 +nmap ga '. +" 查找使用过的地方 +nmap gu (FindUsages) + +" bookmark in whole program +nmap ma (ToggleBookmark) +nmap ms mS +nmap 's 'S +nmap md mD +nmap 'd 'D +nmap mf mF +nmap 'f 'F + +nmap L (NextTab) +nmap H (PreviousTab) + +" ================================================================================================ +" = Leader Keymaps ===================================== +" ================================================================================================ +nmap +let mapleader=" " +let g:mapleader=" " +set timeoutlen=2000 + +" 格式化代码 +nmap fm (ReformatCode) \| (OptimizeImports) + +" lsp: 重命名 +nmap lr (RenameElement) +" 展示目的 +nmap li (ShowIntentionActions) +" 展示错误提示 +nmap le (ShowErrorDescription) +" 查看文件的structure +nmap ls (FileStructurePopup) +" 查看参数 +nmap lp (ParameterInfo) +" 查看类型 +nmap lt (ExpressionTypeInfo) +" 查看java doc 一般用来查看数据类型 +nmap lj (QuickJavaDoc) +" 代码包裹一层 +vmap lw (SurroundWith) +" 代码去掉包裹 +vmap lu (Unwrap) + +" s开头还没用 + +" 关闭搜索高亮 +nmap nh :nohlsearch + +" 快速关闭当前窗口 +nmap c :q! + +" 打开project目录 +nmap e :NERDTree +" 关闭project目录 +nmap E :NERDTreeClose + +" 搜索全局 +nmap fg (FindInPath) +" ================================================================================================ +" 👻👻👻 Which-Key 👻👻👻 +" ================================================================================================ +set which-key +set notimeout + +" d: diff +nmap dd (Vcs.ShowTabbedFileHistory) + +" f: Find/Format ⭐️ +let g:WhichKeyDesc_FindOrFormat = "f FindOrFormat" +let g:WhichKeyDesc_FindOrFormat_FindFile = "ff FindFile" +nmap ff (GotoFile) + +let g:WhichKeyDesc_FindOrFormat_FindFileLocation = "fl FindFileLocation" +nmap fl (SelectInProjectView) + +let g:WhichKeyDesc_FindOrFormat_FindText = "ft FindText" +nmap ft (FindInPath) + +let g:WhichKeyDesc_FindOrFormat_Commands = "fc Commands" +nmap fc (GotoAction) + +let g:WhichKeyDesc_FindOrFormat_OpenedProject = "fp OpenedProject" +nmap fp (OpenProjectWindows) + +let g:WhichKeyDesc_FindOrFormat_Format = "fm Format" +nmap fm (ReformatCode) \| (OptimizeImports) + +" g: Git ⭐️ +let g:WhichKeyDesc_Git = "g Git" +let g:WhichKeyDesc_Git_RollbackHunk = "gr RollbackHunk" +nmap gr :action Vcs.RollbackChangedLines + +" i: Insert ⭐️ +let g:WhichKeyDesc_InsertAfterBrackets = "i InsertAfterBrackets" +nmap i f(a + +" j: add Semicolon and goto nextline⭐️ +let g:WhichKeyDesc_InsertSemicolon = "j InsertSemicolon" +nmap j A;o + +" l: lsp: Language server protocol (align with neovim)⭐️ +let g:WhichKeyDesc_LSP = "l LSP" +let g:WhichKeyDesc_LSP_Rename = "lr Rename" +nmap lr (RenameElement) + + +" n: No ⭐️ +let g:WhichKeyDesc_No_Highlight = "nl NoHighlight" +nmap nl :nohlsearch + + +" s: Show ⭐️ +let g:WhichKeyDesc_Show = "s Show" +let g:WhichKeyDesc_Show_FileStructure = "ss ShowFileStructure" +nmap ss (FileStructurePopup) +let g:WhichKeyDesc_Show_Bookmarks = "sb ShowBookmarks" +nmap sb (ShowBookmarks) +let g:WhichKeyDesc_Show_ParameterInfo = "sb ShowParameterInfo" +nmap sp (ParameterInfo) + +" r: Run/Re ⭐️ +let g:WhichKeyDesc_RunOrRe = "r RunOrRe" +let g:WhichKeyDesc_RunOrRe_ReRun = "rr ReRun" +nmap rr (Rerun) +let g:WhichKeyDesc_RunOrRe_ReRunTests = "rt ReRunTests" +nmap rt (RerunTests) +let g:WhichKeyDesc_RunOrRe_Rename = "rn Rename" +map rn (RenameElement) + +" w: Window ⭐️ +let g:WhichKeyDesc_Windows = "w Windows" +let g:WhichKeyDesc_Windows_maximize = "wo maximize" +nmap wo (UnsplitAll) \| (HideAllWindows) +let g:WhichKeyDesc_Windows_splitWindowVertically = "wl splitWindowVertically" +nmap wl (Macro.SplitVertically) +let g:WhichKeyDesc_Windows_closeActiveWindow = "wc closeActiveWindow" +nmap wc c + +" ================================================================================================ +" = w开头,窗口相关==================================== +" ================================================================================================ +" 关闭所有窗口 ️ +nmap wa (CloseAllEditors) +" 关闭除了激活窗口以外的窗口 +nmap wo (CloseAllEditorsButActive) +" 窗口最大化,并且隐藏其他窗口 +nmap wm (UnsplitAll) \| (HideAllWindows) +" 分离出一个竖直的窗口 +nmap wv (SplitVertically) +" 分离出一个水平的窗口 +nmap wh (SplitHorizontally) + +" z: zip(fold) ⭐️ +let g:WhichKeyDesc_Zip = "z Zip" +let g:WhichKeyDesc_Zip_unZipAll = "zo unZipAll" +nmap zo (ExpandAllRegions) +let g:WhichKeyDesc_Zip_ZipAll = "zc ZipAll" +nmap zc (CollapseAllRegions) + +" c: Close ⭐️; +let g:WhichKeyDesc_CloseBuffer = "c CloseBuffer" +nmap c :q! + +" e: Toggle Explorer ⭐️ +let g:WhichKeyDesc_ToggleExplorerOrExtract = "e ToggleExplorer" +nmap e (ActivateProjectToolWindow) +" e: Extract +" extract method/function +vmap em (ExtractMethod) +" extract constant +vmap ec (IntroduceConstant) +" extract field +vmap ef (IntroduceField) +" extract variable +vmap ev (IntroduceVariable)