Skip to content

Instantly share code, notes, and snippets.

@hunterwei
Created February 2, 2022 16:49
Show Gist options
  • Save hunterwei/c22b64826ee4b6169681771571409695 to your computer and use it in GitHub Desktop.
Save hunterwei/c22b64826ee4b6169681771571409695 to your computer and use it in GitHub Desktop.
IdeaVim Config file
set ideajoin
set showcmd
" integrate with system clipboard
set clipboard=unnamed,ideaput,unnamedplus
" easy tool window
nnoremap \p :action ActivateProjectToolWindow<CR>
nnoremap \c :action ActivateCommitToolWindow<CR>
nnoremap \r :action ActivateRunToolWindow<CR>
nnoremap \d :action ActivateDebugToolWindow<CR>
nnoremap \t :action ActivateTerminalToolWindow<CR>
nnoremap \b :action ActivateBuildToolWindow<CR>
nnoremap \s :action ActivateServicesToolWindow<CR>
nnoremap \o :action ActivateTodoToolWindow<CR>
nnoremap \l :action ActivateProblemsViewToolWindow<CR>
nnoremap \m :action ActivateMavenToolWindow<CR>
nnoremap \n :action ActivateSonarLintToolWindow<CR>
nnoremap \g :action ActivateVersionControlToolWindow<CR>
nnoremap \h :action HideActiveWindow<CR>
nnoremap \a :action HideAllWindows<CR>
" 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
" easy tab actions
nnoremap <space>lv :action SplitVertically<CR>
nnoremap <space>lh :action SplitHorizontally<CR>
nnoremap <space>zh :action StretchSplitToLeft<CR>
nnoremap <space>zl :action StretchSplitToRight<CR>
nnoremap <space>zj :action StretchSplitToBottom<CR>
nnoremap <space>zk :action StretchSplitToTop<CR>
nnoremap <space>us :action Unsplit<CR>
nnoremap <space>ua :action UnsplitAll<CR>
nnoremap <space>mr :action MoveTabRight<CR>
nnoremap <space>ml :action MoveTabRight<CR>
nnoremap <space>md :action MoveTabDown<CR>
nnoremap <space>mj :action MoveTabDown<CR>
nnoremap <space>mo :action MoveEditorToOppositeTabGroup<CR>
nnoremap <space>oo :action OpenEditorInOppositeTabGroup<CR>
nnoremap <space>pn :action PinActiveEditorTab<CR>
nnoremap <space>up :action PinActiveEditorTab<CR>
nnoremap <space>sip :action SelectInProjectView<CR>
nnoremap <space>x :action CloseEditor<CR>
nnoremap <space>ko :action CloseAllEditorsButActive<CR>
nnoremap <space>kk :action CloseAllEditors<CR>
nnoremap <space>kl :action CloseAllToTheLeft<CR>
nnoremap <space>kr :action CloseAllToTheRight<CR>
" Ace Plugin actions
nnoremap <space>; :action AceWordAction<CR>
" Run/Debug/Build actions
nnoremap <space>dbg :action Debug<CR>
nnoremap <space>run :action Run<CR>
nnoremap <space>con :action RunConfiguration<CR>
nnoremap <space>edc :action editRunConfigurations<CR>
nnoremap <space>bld :action BuildMenu<CR>
nnoremap <space>stp :action Stop<CR>
" code refactoring
nnoremap <space>mm :action ReformatCode<CR>
nnoremap <space>rr :action RenameElement<CR>
nnoremap <space>ii :action ShowIntentionActions<CR>
nnoremap <space>opi :action OptimizeImports<CR>
" File actions
nnoremap <space>ss :action SaveAll<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>
" 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>
" preserve ideavim search
nnoremap g/ :action Find<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment