参考一
""" Add source vimrc source C:/Users/jaime/.vimrc set idearefactormode=keep set visualbell set noerrorbells set noideadelaymacro set clipboard+=ideaput """ Reload ideavimrv and edit vimrc and ideavimrc nnoremap <leader>vr :action IdeaVim.ReloadVimRc.reload<CR> nnoremap <leader>vi :e C:/Users/jaime/.ideavimrc<CR> nnoremap <leader>vv :e C:/Users/jaime/.vimrc<CR> """ Open Terminal in Path of current file nnoremap <leader>ot :action Terminal.OpenInTerminal<CR> """ Navigation and move between tabs and windows nnoremap <leader>sv :action SplitVertically<CR> nnoremap <leader>sh :action SplitHorizontally<CR> nnoremap <leader>su :action Unsplit<CR> nnoremap <leader>sU :action UnsplitAll<CR> nnoremap <leader>tp :action PreviousTab<CR> nnoremap <leader>tn :action NextTab<CR> nnoremap <TAB> : action NextTab<CR> nnoremap <leader>tq :action CloseContent<CR> nnoremap <leader>to :action ReopenClosedTab<CR> nnoremap <leader>wh <c-w>h nnoremap <leader>wl <c-w>l nnoremap <leader>wj <c-w>j nnoremap <leader>wk <c-w>k nnoremap <leader>wq :action HideAllWindows<CR> """ Gotos nnoremap <leader>gE :action GotoPreviousError<CR> nnoremap <leader>ge :action GotoNextError<CR> nnoremap <leader>gi :action GotoImplementation<CR> nnoremap <leader>gp :action GotToSuperMethod<CR> nnoremap <leader>gt :action GotoTest<CR> nnoremap <leader>gb :action Back<CR> nnoremap <leader>gf :action GotoFile<CR> vnoremap <leader>ga :action GotoAction<CR> nnoremap <leader>ga :action GotoAction<CR> nnoremap <leader>gc :action JumpToLastChange<CR> """ Bookmarks nnoremap <leader>bt :<C-u>action ToggleBookmark<CR> nnoremap <leader>bn :<C-u>action GotoNextBookmark<CR> nnoremap <leader>bp :<C-u>action GotoPreviousBookmark<CR> nnoremap <leader>bs :<C-u>action ShowBookmarks<CR> """ Quick Help nnoremap <leader>qf :action QuickImplementations<CR> nnoremap <leader>qt :action QuickTypeDefinition<CR> nnoremap <leader>qd :action QuickJavaDoc<CR> """ Expand and Collapse nnoremap <leader>er :action ExpandRegion<CR> nnoremap <leader>ea :action ExpandAllRegions<CR> nnoremap <leader>cr :action CollapseRegion<CR> nnoremap <leader>ca :action CollapseAllRegions<CR> """ Find and Replace nnoremap <leader>fu :action FindUsages<CR> nnoremap <leader>fF :action FindInPath<CR> nnoremap <leader>ff :action Find<CR> nnoremap <leader>fR :action ReplaceInPath<CR> nnoremap <leader>fr :action Replace<CR> """ Refactorings vnoremap <leader>rf :action ReformatCode<CR> nnoremap <leader>rf :action ReformatCode<CR> nnoremap <leader>ra :action ShowReformatFileDialog<CR> nnoremap <leader>rn :action RenameElement<CR> nnoremap <leader>rp :action Refactorings.QuickListPopupAction<CR> vnoremap <leader>rp :action Refactorings.QuickListPopupAction<CR> nnoremap <leader>ri :action ShowIntentionActions<CR> vnoremap <leader>ri :action ShowIntentionActions<CR> nnoremap <leader>ro :action OptimizeImports<CR> nnoremap <leader>rg :action Generate<CR> """ Running and Debugging nnoremap <leader>ir :action ContextRun<CR> nnoremap <leader>ic :action ChooseRunConfiguration<CR> nnoremap <leader>it :action RerunTests<CR> nnoremap <leader>iT :action RerunFailedTests<CR> nnoremap <leader>dr :action Debug<CR> nnoremap <leader>db :action ToggleLineBreakpoint<CR> """ Others nnoremap <leader>yp :action CopyAbsolutePath<CR> """ Plugins Plug 'easymotion/vim-easymotion' map , <Plug>(easymotion-prefix) Plug 'tpope/vim-surround' """ It does not work very well, only use with visual model and A-n set multiple-cursors Plug 'terryma/vim-multiple-cursors' let g:multi_cursor_start_word_key = ',cs' let g:multi_cursor_select_all_word_key = ',ca' let g:multi_cursor_next_key = ',cs' let g:multi_cursor_prev_key = ',cr' let g:multi_cursor_skip_key = ',ce' nmap ,cs <Plug>NextWholeOccurrence xmap ,cs <Plug>NextWholeOccurrence nmap ,ce <Plug>SkipOccurrence xmap ,ce <Plug>SkipOccurrence nmap ,cr <Plug>RemoveOccurrence xmap ,cr <Plug>RemoveOccurrence nmap ,ca <Plug>AllWholeOccurrences xmap ,ca <Plug>AllWholeOccurrences Plug 'tpope/vim-commentary' Plug 'michaeljsmith/vim-indent-object' Plug 'machakann/vim-highlightedyank' Plug 'preservim/nerdtree' Plug 'tommcdo/vim-exchange' Plug 'vim-scripts/ReplaceWithRegister' Plug 'vim-scripts/argtextobj.vim' Plug 'dbakker/vim-paragraph-motion' Plug 'kana/vim-textobj-entire' set ideajoin
参考二
" M->cmd, A->option, C->control " <ESC> - escape, <BS> - backspace, <CR> - return " leader let mapleader = " " " 启用vim surround功能 set surround " 启用multi cursor set multiple-cursors " 显示行号 set nu " 显示相对行号 set rnu " 高亮搜索 set hlsearch " 自动定位到输入中的字符串,不需要回车搜索 set incsearch " 显示当前的模式 set showmode " 共享系统粘贴板 set clipboard=unnamed set clipboard+=ideaput " 搜索时智能匹配大小写 set ignorecase smartcase " Insert inoremap jk <Esc> " Normal nnoremap dd ddzz " Visual vnoremap d dzz " Normal + Visual noremap # #zz noremap * *zz noremap w wzz noremap W Wzz noremap e ezz noremap E Ezz noremap b bzz noremap B Bzz noremap H Hzz noremap L Lzz noremap 0 0zz noremap $ $zz noremap ^ ^zz noremap j jzz noremap k kzz noremap G Gzz noremap u uzz noremap ( (zz noremap ) )zz noremap { {zz noremap } }zz noremap [{ [{zz noremap ]} ]}zz noremap gd gdzz noremap <C-O> <ESC>:action Back<CR> noremap <C-I> <ESC>:action Forward<CR> noremap <C-D> <C-D>zz noremap <C-U> <C-U>zz " E和R是为了保持与Chrome中的SurfingKeys的键位一致 noremap E gT noremap R gt noremap J <ESC>:action EditorJoinLines<CR> " 个人习惯 noremap <leader>` <ESC>:action SelectInProjectView<CR> " Leader key relevant " quit noremap <leader>q :wq<CR> " write to favorite noremap <leader>w <ESC>:action AddToFavoritesPopup<CR> " error description noremap <leader>e <ESC>:action ShowErrorDescription<CR> " return noremap <leader>r <ESC>:action Rerun<CR> " Windows或者MacOS的快捷键都与t相关, 所以选择t作为键 noremap <leader>t <ESC>:action Refactorings.QuickListPopupAction<CR> " y "noremap <leader>y <ESC>:action <CR> " usage noremap <leader>u <ESC>:action ShowUsages<CR> " import noremap <leader>i <ESC>:action Maven.Reimport<CR> " open file path noremap <leader>o <ESC>:action ShowFilePath<CR> " show projects noremap <leader>p <ESC>:action ManageRecentProjects<CR> " ace jump noremap <leader>a <ESC>:action emacsIDEAs.AceJumpWord<CR> " structure noremap <leader>s <ESC>:action FileStructurePopup<CR> " debug option noremap <leader>d <ESC>:action ChooseDebugConfiguration<CR> " 同样也是debug,因为d已经被ChooseDebugConfiguration占领, 所以就放在了d键隔壁. noremap <leader>f <ESC>:action DebugClass<CR> " g noremap <leader>g <ESC>:action Generate<CR> " hide all noremap <leader>h <ESC>:action HideAllWindows<CR> " jump to next error noremap <leader>j <ESC>:action GotoNextError<CR> " jump to previous error,就近原则 noremap <leader>k <ESC>:action GotoPreviousError<CR> " light up noremap <leader>l <ESC>:action HighlightUsagesInFile<CR> " 粘贴最近复制寄存器 noremap <leader>; "0p " 本行皆为debug所用 " resume - z noremap <leader>z <ESC>:action Resume<CR> " step over noremap <leader>x <ESC>:action StepOver<CR> " step into noremap <leader>c <ESC>:action SmartStepInto<CR> " evaluate expression - v noremap <leader>v <ESC>:action EvaluateExpression<CR> " breakpoints noremap <leader>b <ESC>:action ViewBreakpoints<CR> " 因为属于breakpoint范畴的功能, 所以就选择了b和m的隔壁 noremap <leader>n <ESC>:action ToggleLineBreakpoint<CR> " mute breakpoints noremap <leader>m <ESC>:action XDebugger.MuteBreakpoints<CR> " g key relevant " " q "noremap gq <ESC>:action <CR> " switcher noremap gw <ESC>:action RecentFiles<CR> " e "noremap ge <ESC>:action <CR> " r "noremap gr <ESC>:action <CR> " translator(third party plugin) noremap gt <ESC>:action $EditorTranslateAction<CR> " y noremap gy <ESC>:action CopyReference<CR> " u "noremap gu <ESC>:action <CR> " intention noremap gi <ESC>:action ShowIntentionActions<CR> " o "noremap go <ESC>:action <CR> " param info noremap gp <ESC>:action ParameterInfo<CR> " a "noremap ga <ESC>:action <CR> " goto source noremap gs <ESC>:action GotoImplementation<CR> " goto declaration noremap gd <ESC>:action GotoDeclaration<CR> " goto file noremap gf <ESC>:action GotoFile<CR> " g "noremap gg <ESC>:action MUST_NOT_BE_CHANGED!!!<CR> " hierarchy noremap ghc <ESC>:action CallHierarchy<CR> noremap ght <ESC>:action TypeHierarchy<CR> noremap ghm <ESC>:action MethodHierarchy<CR> " j analyze data flow in noremap gj <ESC>:action SliceBackward<CR> " k analyze data flow out noremap gk <ESC>:action SliceForward<CR> " l "noremap gl <ESC>:action <CR> " z "noremap gz <ESC>:action <CR> " close all but this noremap gx <ESC>:action CloseAllEditorsButActive<CR> " compile noremap gc <ESC>:action CompileDirty<CR> " v "noremap gv <ESC>:action <CR> " b noremap gb <ESC>:action FindBugs.CurrentFileAction<CR> " goto class noremap gn <ESC>:action GotoClass<CR> " goto method noremap gm <ESC>:action GotoSymbol<CR> " \ also works "noremap \q <ESC>:action <CR> " refresh noremap \r <ESC>:source ~/.ideavimrc<CR> " uml popup noremap \u <ESC>:action ShowUmlDiagramPopup<CR> " git flow noremap \[ <ESC>:action Gitflow.OpenGitflowPopup<CR> " Vcs noremap \] <ESC>:action Vcs.QuickListPopupAction<CR> " global find noremap g/ <ESC>:action FindInPath<CR> " gloaal replace noremap g' <ESC>:action ReplaceInPath<CR> " find noremap / <ESC>:action Find<CR> " replace noremap ' <ESC>:action Replace<CR> " previous method noremap [[ <ESC>:action MethodUp<CR> " next method noremap ]] <ESC>:action MethodDown<CR> " multiple cursors map <A-M> <A-N> set clipboard+=ideaput
参考三
set hlsearch set scrolloff=3 set ignorecase smartcase set showmode set history=1000 " easy system clipboard copy/paste noremap <space>y "*y noremap <space>Y "*Y noremap <space>p "*p noremap <space>P "*P " easy window navigation nnoremap <c-l> <c-w>l nnoremap <c-j> <c-w>j nnoremap <c-h> <c-w>h nnoremap <c-k> <c-w>k nnoremap <a-h> gT nnoremap <a-l> gt nnoremap <c-s-tab> gT nnoremap <c-tab> gt " clear the search buffer when hitting return nnoremap <space><cr> :nohlsearch<cr> " options nnoremap cow :action EditorToggleUseSoftWraps<cr> nnoremap col :action EditorToggleShowWhitespaces<cr> " actions nnoremap <space>q :action CloseContent<cr> nnoremap <space>Q :action ReopenClosedTab<cr> nnoremap <space>\ :action VimFilePrevious<cr> nnoremap <space>e :action SearchEverywhere<cr> nnoremap <space>E :action Switcher<cr> nnoremap <space>t :action FileStructurePopup<cr> nnoremap <space>T :action GotoSymbol<cr> nnoremap <space>a :action GotoAction<cr> nnoremap <space>b :action ToggleLineBreakpoint<cr> " code navigation nnoremap <space>] :action GotoImplementation<cr> nnoremap <space>[ :action GotoSuperMethod<cr> nnoremap <space>u :action FindUsages<cr> nnoremap <space>gt :action GotoTest<cr> nnoremap <space>k :action HighlightUsagesInFile<cr> nnoremap \r :action RunClass<cr> nnoremap \R :action Run<cr> nnoremap \d :action DebugClass<cr> nnoremap \D :action Debug<cr> nnoremap \c :action CheckStyleCurrentFileAction<cr> " code refactoring nnoremap <space>rr :action RenameElement<cr> " unimpaired mappings nnoremap [<space> O<esc>j nnoremap ]<space> o<esc>k nnoremap [q :action PreviousOccurence<cr> nnoremap ]q :action NextOccurence<cr> nnoremap [m :action MethodUp<cr> nnoremap ]m :action MethodDown<cr> nnoremap [c :action VcsShowPrevChangeMarker<cr> nnoremap ]c :action VcsShowNextChangeMarker<cr> " built-in navigation to navigated items works better nnoremap <c-o> :action Back<cr> nnoremap <c-i> :action Forward<cr> " but preserve ideavim defaults nnoremap g<c-o> <c-o> nnoremap g<c-i> <c-i> " built in search looks better nnoremap / :action Find<cr> " but preserve ideavim search nnoremap g/ /
参考四
" _____ _____ _____ _____ " /\ \ /\ \ /\ \ /\ \ " /::\ \ /::\____\ /::\____\ /::\ \ " \:::\ \ /:::| | /:::| | /::::\ \ " \:::\ \ /::::| | /::::| | /::::::\ \ " \:::\ \ /:::::| | /:::::| | /:::/\:::\ \ " \:::\ \ /:::|::| | /:::|::| | /:::/ \:::\ \ " /::::\ \ /:::/|::| | /:::/|::| | /:::/ /\:::\ \ " /::::::\ \ /:::/ |::| | /:::/ |::| | _____ /:::/ /__\:::\ \ " /:::/\:::\ \ /::::\ |::| | /:::/ |::| |/\ \ /:::/ /\ \:::\ \ " /:::/ \:::\ \ /::::::V|::| |/:::/ |::| /::\____\/:::/___/::\ \:::\____\ " /:::/ \:::\____\/:::/\:::\::| |\::/ |::| /:::/ /\:::\ \:::\ \::/ / " /:::/ / \::/ /\::/ \:::::| | \/____/|::| /:::/ / \:::\ \:::\ \/____/ " /:::/ / \/____/ \/___/\::::| | |::| /:::/ / \:::\ \:::\ \ " /:::/ / \:::| | |::|/:::/ / \:::\ \:::\____\ " /:::/ / |::| | |::|:::/ / \:::\__/:::/ / " /:::/ / |::| | |:::::/ / \::::::::/ / " /:::/ / |::| | |::::/ / \_:::::/ / "/:::/ / \::| | |:::/ / /:::/ / "\::/ / \:| | \::/ / \::/ / " \/____/ \|____| \/____/ \/____/ " ---------------------- " |用此vim配置撸代码无BUG!| " ---------------------- " ================================================== ” 键位说明 " ================================================== " M->cmd, A->option, C->control " <ESC> - escape, <BS> - backspace, <CR> - return " 设置leader 键位 let mapleader= " " " ================================================== ” 基础设置 " ================================================== " 高亮搜索 set hlsearch " 自动定位到输入中的字符串,不需要回车搜索 set incsearch " 搜索时智能匹配大小写 set ignorecase smartcase " 显示当前的模式 set showmode " 显示行号 set number " 显示相对行号 set relativenumber " 光标临界行 set scrolloff=3 " 共享剪贴板 set clipboard=unnamed " ================================================== " 个人习惯 " ================================================== " tab切换 下一个 nnoremap <C-m>n gt " tab切换 上一个 nnoremap <C-m>b gT " 格式化代码 nnoremap <C-j>f :action ReformatCode<CR> " 移动到行首第一个字母 nnoremap H ^ " 移动到行尾最后一个字母 nnoremap L $ " 代码展开 nnoremap zi zo " ================================================== " 插入模式光标移动 " ================================================== " 上下左右不需要 若要使用注意C-k与git提交快捷冲突 " inoremap <C-h> <Left> " inoremap <C-j> <Down> " inoremap <C-k> <Up> " inoremap <C-l> <Right> inoremap <C-e> <End> inoremap <C-d> <Delete> " ================================================== " 多窗口操作 " ================================================== " 清除窗口 nnoremap <Leader>wd <C-W>c " 光标窗口切换 nnoremap <Leader>ww <C-W>w nnoremap <Leader>wj <C-W>j nnoremap <Leader>wk <C-W>k nnoremap <Leader>wh <C-W>h nnoremap <Leader>wl <C-W>l " 纵向新增窗口 nnoremap <Leader>ws <C-W>s " 横向新增串口 nnoremap <Leader>wv <C-W>v " ================================================== " IDEA预定义方法自定义快捷键 " 查看预定义方法命令 `:actionlist` 请取需要的命令设为组合键 " ================================================== nnoremap <Leader>ga :action GotoAction<CR> nnoremap <Leader>gc :action GotoClass<CR> nnoremap <Leader>gd :action GotoDeclaration<CR> nnoremap <Leader>gf :action GotoFile<CR> nnoremap <Leader>gi :action GotoImplementation<CR> nnoremap <Leader>gs :action GotoSymbol<CR> nnoremap <Leader>gt :action GotoTest<CR> nnoremap <Leader>fp :action ShowFilePath<CR> nnoremap <Leader>rf :action RenameFile<CR> nnoremap <Leader>se :action SearchEverywhere<CR> nnoremap <Leader>tc :action CloseActiveTab<CR> nnoremap <Leader>tl Vy<CR>:action ActivateTerminalToolWindow<CR> nnoremap <Leader>? :action GotoAction<CR> nnoremap gd :action GotoDeclaration<CR> nnoremap gi :action GotoImplementation<CR> " 项目搜索 nnoremap <Leader>ps :action SearchEverywhere<CR> nnoremap <Leader>pf :action GotoFile<CR> nnoremap <Leader>fu :action FindUsages<CR>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战