Skip to content

Instantly share code, notes, and snippets.

@KimTrijnh
Forked from dewaka/.ideavimrc
Created July 30, 2021 06:39
Show Gist options
  • Save KimTrijnh/7afcf96ad68d45f301e2e1b25d7da07c to your computer and use it in GitHub Desktop.
Save KimTrijnh/7afcf96ad68d45f301e2e1b25d7da07c to your computer and use it in GitHub Desktop.
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
" These settings are from - https://github.com/Valloric/dotfiles/blob/master/intellij/ideavimrc
" let mapleader = ","
let mapleader = " "
" let maplocalleader = ","
" 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>
" To navigate between split panes
nmap <leader>wo :action NextSplitter<cr>
nmap <leader>wp :action PrevSplitter<cr>
nmap <leader>j :action PrevSplitter<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>h :action Back<cr>
nmap <leader>l :action Forward<cr>
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>m :action FileStructurePopup<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>
nmap <leader>a :action RecentChangedFiles<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>
" Clojure specific mappings for Cursive
nmap \c :action :cursive.repl.actions/clear-repl<cr>
nmap \l :action :cursive.repl.actions/load-file<cr>
nmap \o :action :cursive.repl.actions/jump-to-output<cr>
nmap \r :action :cursive.repl.actions/jump-to-repl<cr>
nmap \t :action :cursive.testing.actions/run-ns-tests<cr>
nmap \T :action :cursive.testing.actions/rerun-last-test<cr>
nmap \C :action :cursive.testing.actions/remove-test-markers<cr>
" Python specific mappings
" Format code with Black fomatter
nmap \p :action Tool_External Tools_Black<cr>
" :cursive.repl.actions/clojure-repl-commands-group
" :cursive.repl.actions/clojure-repl-group
" :cursive.repl.actions/interrupt
" :cursive.repl.actions/jump-to-output
" :cursive.repl.actions/jump-to-repl <C-\>
" :cursive.repl.actions/load-file <A-S-L>
" :cursive.repl.actions/macroexpansion <C-S-\>
" :cursive.repl.actions/next-history-item <C-Down>
" :cursive.repl.actions/prev-history-item <C-Up>
" :cursive.repl.actions/print-exception
" :cursive.repl.actions/run-last-sexp
" :cursive.repl.actions/run-top-sexp <A-S-P>
" :cursive.repl.actions/search-history <A-C-E>
" :cursive.repl.actions/switch-namespace <A-S-R>
" :cursive.repl.actions/sync-files <A-S-M>
" :cursive.repl.commands/add-new
" :cursive.repl.commands/edit
" :cursive.testing.actions/remove-test-markers
" :cursive.testing.actions/rerun-last-test
" :cursive.testing.actions/run-ns-tests
" :cursive.testing.actions/run-single-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment