Skip to content

Instantly share code, notes, and snippets.

@engalar
Forked from dewaka/.ideavimrc
Last active October 9, 2020 06:45
Show Gist options
  • Save engalar/6779c7f35ec38b6d4863e74053ba388b to your computer and use it in GitHub Desktop.
Save engalar/6779c7f35ec38b6d4863e74053ba388b to your computer and use it in GitHub Desktop.
inoremap jk <ESC>
:map \r :action ReformatCode<CR>
:map gb :action Back<CR>
:map gw :action Forward<CR>
set rnu
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" Copy to system clipboard as well
set clipboard+=unnamed
" Use Idea to join lines smartly
set ideajoin
" Multiple cursors support
set multiple-cursors
let mapleader = " "
" Use Q for formatting the current paragraph (or visual selection)
vmap Q gq
nmap Q gqap
" These create newlines like o and O but stay in normal mode
nmap zj o<Esc>k
nmap zk O<Esc>j
" key bindings for quickly moving between windows
" h left, l right, k up, j down
nmap <leader>h <c-w>h
nmap <leader>l <c-w>l
nmap <leader>k <c-w>k
nmap <leader>j <c-w>j
" Closing tabs
nmap <leader>q :action CloseContent<cr>
nmap <leader>Q :action ReopenClosedTab<cr>
" Splits manipulation
nmap <leader>ws :action SplitHorizontally<cr>
nmap <leader>wv :action SplitVertically<cr>
nmap <leader>wc :action Unsplit<cr>
nmap <leader>wC :action UnsplitAll<cr>
nmap <leader>wd :action OpenEditorInOppositeTabGroup<cr>
nmap <leader><leader> :action VimFilePrevious<cr>
" nmap <leader>ww :action JumpToLastWindow<cr>
" Navigation
nmap <leader>L :action RecentLocations<cr>
nmap <leader>g :action GotoDeclaration<cr>
nmap <leader>u :action FindUsages<cr>
nmap <leader>f :action GotoFile<cr>
nmap <leader>c :action GotoClass<cr>
nmap <leader>s :action GotoSymbol<cr>
nmap <leader>; :action FileStructurePopup<cr>
nmap <leader>M :action ActivateStructureToolWindow<cr>
nmap <leader>d :action ShowErrorDescription<cr>
nmap <leader>i :action GotoImplementation<cr>
nmap <leader>I :action SelectIn<cr>
nmap <leader>e :action RecentFiles<cr>
nmap <leader>t :action GotoTest<cr>
nmap <leader>p :action JumpToLastWindow<cr>
nmap <leader>b :action ShowBookmarks<cr>
nmap <leader>a :action Switcher<cr>
" Errors
nmap <leader>x :action GotoNextError<cr>
nmap <leader>X :action GotoPreviousError<cr>
" Refactorings
vmap T :action Refactorings.QuickListPopupAction<cr>
nmap <leader>rr :action RenameElement<cr>
nmap <leader>rg :action Generate<cr>
nmap <leader>rI :action OptimizeImports<cr>
" Inspection
nmap <leader>rc :action InspectCode<cr>
" VCS operations
nmap <leader>yy :action Vcs.Show.Local.Changes<cr>
nmap <leader>yp :action Vcs.QuickListPopupAction<cr>
nmap <leader>ya :action Annotate<cr>
nmap <leader>yl :action Vcs.Show.Log<cr>
nmap <leader>yd :action Compare.LastVersion<cr>
" nmap <leader>yr :action Git.ResolveConflicts<cr>
" Terminal
nmap <leader>T :action ActivateTerminalToolWindow<cr>
" External GVim
nmap <leader>v :action Tool_External Tools_gvim<cr>
" External Emacs
nmap <leader>E :action Tool_External Tools_emacsclient<cr>
" External Sublime Text
nmap <leader>S :action Tool_External Tools_sublime_text<cr>
" IdeaVim uses 'a' for alt instead of Vim's 'm'
nmap <a-j> 15gj
nmap <a-k> 15gk
" Won't work in visual mode (with vmap) for some reason.
" Use default map of <c-/> for that.
nmap gcc :action CommentByLineComment<cr>
" unimpaired mappings - from https://github.com/saaguero/ideavimrc/blob/master/.ideavimrc
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>
" Tabs
nnoremap [b :action PreviousTab<cr>
nnoremap ]b :action NextTab<cr>
" Search
nmap <leader>/ :action Find<cr>
nmap <leader>\ :action FindInPath<cr>
" Moving lines
nmap [e :action MoveLineUp<cr>
nmap ]e :action MoveLineDown<cr>
" Moving statements
nmap [s :action MoveStatementUp<cr>
nmap ]s :action MoveStatementDown<cr>
" Building, Running and Debugging
nmap ,c :action CompileDirty<cr>
nmap ,r :action Run<cr>
nmap ,R :action RunAnything<cr>
nmap ,b :action Debug<cr>
nmap ,c :action RunClass<cr>
nmap ,d :action DebugClass<cr>
nmap ,t :action RerunTests<cr>
nmap ,T :action RerunFailedTests<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment