Skip to content

Instantly share code, notes, and snippets.

@dewaka
Last active April 6, 2024 20:27
Show Gist options
  • Star 89 You must be signed in to star a gist
  • Fork 40 You must be signed in to fork a gist
  • Save dewaka/ef947e52767bf453eaf77c852051eb7e to your computer and use it in GitHub Desktop.
Save dewaka/ef947e52767bf453eaf77c852051eb7e 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
" set easymotion
set NERDTree
" 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 = ","
" Create new vertical splits on right and horizontals on below
" set splitright
" set splitbelow
" 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>hce
" 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>
" Switch projects
nmap <leader>ww :action NextProjectWindow<cr>
" To navigate between split panes
nmap <leader>wo :action NextSplitter<cr>
nmap <leader>wp :action PrevSplitter<cr>
" Alt+Tab is quite good for this action
" nmap <leader>j :action PrevSplitter<cr>
nmap ,s :action PrevSplitter<cr>
" Full screen window
nmap <leader>wf :action HideAllWindows<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>, :action VimFilePrevious<cr>
" nmap <leader>ww :action JumpToLastWindow<cr>
" NERDTree
map <leader>nn :NERDTree<CR>
map <leader>nf :NERDTreeFind<CR>
" Navigation
nmap <leader>h :action Back<cr>
nmap <leader>l :action Forward<cr>
nmap <leader>L :action RecentLocations<cr>
nmap <leader>u :action FindUsages<cr>
nmap <leader>C :action CallHierarchy<cr>
nmap <leader>f :action GotoFile<cr>
nmap <leader>c :action GotoClass<cr>
nmap <leader>s :action GotoSymbol<cr>
nmap <leader>m :action ToggleBookmark<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>U :action GotoSuperMethod<cr>
nmap <leader>I :action SelectIn<cr>
nmap <leader>e :action RecentFiles<cr>
nmap <leader>a :action RecentChangedFiles<cr>
nmap <leader>t :action GotoTest<cr>
nmap <leader>p :action JumpToLastWindow<cr>
nmap <leader>b :action ShowBookmarks<cr>
" Useful Git actions
nmap <leader>gb :action Git.Branches<cr>
nmap <leader>gp :action Git.Pull<cr>
nmap <leader>gu :action Git.Push<cr>
nmap <leader>gr :action Git.Rebase<cr>
nmap <leader>gm :action Git.Merge<cr>
" nmap <leader>a :action Switcher<cr>
nmap ,a :action GotoAction<cr>
" Errors
nmap <leader>x :action GotoNextError<cr>
nmap <leader>X :action GotoPreviousError<cr>
" Refactorings
vmap T :action Refactorings.QuickListPopupAction<cr>
vmap <leader>rm :action ExtractMethod<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>yP :action Git.Pull<cr>
nmap <leader>yr :action Git.ResolveConflicts<cr>
nmap <leader>yo :action Github.Open.In.Browser<cr>
" Terminal
nmap <leader>T :action ActivateTerminalToolWindow<cr>
" Gradle
nmap <leader>G :action ActivateGradleToolWindow<cr>
" External GVim
nmap <leader>v :action Tool_External Tools_mvim<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>
nmap ,p :action ToggleLineBreakpoint<cr>
nmap ,i :action ParameterInfo<cr>
" Useful Quick actions
nmap ,, :action QuickJavaDoc<cr>
nmap ,H :action LocalHistory.ShowHistory<cr>
nmap ,e :action JumpToLastChange<cr>
" AceJump shortcut
nmap <leader>j :action AceAction<cr>
nmap ,yy :action CopySourceRootPath<cr>
nmap ,ya :action CopyAbsolutePath<cr>
nmap ,l :action RecentLocations<cr>
nmap ,S :action ShowProjectStructureSettings<cr>
" Pin/Unpin active tab
nmap \p :action PinActiveTabToggle<cr>
" JumpToLastChange <M-S-BS>
" JumpToLastWindow <F12>
" QuickActionPopup <M-A-CR>
" QuickActions
" QuickChangeScheme <C-À>
" QuickDocCopy <M-C>
" QuickEvaluateExpression <M-A-F8> button=1 clickCount=1 modifiers=512
" QuickFixes
" QuickImplementations <A- > <M-Y>
" QuickJavaDoc <F1> <C-J> button=2 clickCount=1 modifiers=128
" Clojure specific mappings for Cursive
" nmap \a :action ActivateREPLToolWindow<cr>
"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>
" https://youtrack.jetbrains.com/issue/VIM-1846
nnoremap <BS> <C-S-6>
nnoremap <leader><leader> <C-S-6>
" nnoremap <leader><leader> :action Switcher<cr>
" Increase or decrease font size
nnoremap <C-=> :action EditorIncreaseFontSize<cr>
nnoremap <C--> :action EditorDecreaseFontSize<cr>
@KonstiTheProgrammer
Copy link

nice

@alex-gunning
Copy link

Nice!

@iceadobe
Copy link

iceadobe commented Dec 9, 2023

thanks a lot! ♥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment