" ============================================================================ " Emulated plugins " ============================================================================ " https://github.com/JetBrains/ideavim/blob/master/doc/emulated-plugins.md set exchange " [exchange](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#exchange) " Emulates: [vim-exchange](https://github.com/tommcdo/vim-exchange) " Commands: cx, cxx, X, cxc set surround " [surround](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#surround) " Emulates: [vim-surround](https://github.com/tpope/vim-surround) " Commands: ys, cs, ds, S " set multiple-cursors " Emulates: [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors) " Commands: , , , g set commentary " [commentary](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#commentary) " Emulates: [commentary.vim](https://github.com/tpope/vim-commentary) " Commands: gcc, gc + motion, v_gc set argtextobj " [argtextobj](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#argtextobj) " Emulates: [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699) " Additional text objects: aa, ia set textobj-indent " [vim-indent-object](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#vim-indent-object) " Emulates:  [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object) " Additional text objects: ai, ii set highlightedyank " [highlightedyank](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#highlightedyank) " Emulates: [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank) " set sneak " [sneak](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#sneak) " Emulates: [vim-sneak](https://github.com/justinmk/vim-sneak) set quickscope " [IdeaVim-Quickscope](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#ideavim-quickscope) " Emulates: [quick-scope](https://github.com/unblevable/quick-scope) set easymotion " [easymotion](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#easymotion) " Emulates:  [vim-easymotion](https://github.com/easymotion/vim-easymotion) set ReplaceWithRegister " [ReplaceWithRegister](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#replacewithregister) " Emulates: [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister) Plug 'preservim/nerdtree' " [NERDTree](https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins#nerdtree) " Emulates: [NERDTree](https://github.com/preservim/nerdtree) " ============================================================================ " Set commands " ============================================================================ " https://github.com/JetBrains/ideavim/blob/master/doc/set-commands.md " Integrate with system clipboard " set clipboard=unnamedplus,unnamed " Add ideaput to clipboard option to perform a put via the IDE " set clipboard+=ideaput set clipboard=unnamedplus,unnamed,ideaput " If set, creation of global mark will trigger creation of IDE's bookmark and vice versa. set ideamarks " If set, join command will be performed via IDE set ideajoin " The ":substitute" flag 'g' is default on " the ":substitute" flag 'g' is by default " No need to add g at the end substitution command " set gdefault " Highlight matches with the current search pattern set hlsearch " Ignore case when searching set ignorecase " Makes search act like search in modern browsers " Show where search pattern typed so far matches set incsearch " Pairs of characters that "%" can match set matchpairs=(:),[:],{:},<:> " number formats recognized for CTRL-A command set nrformats+=alpha set nrformats-=octal " Use hybrid (absolute and relative) numbers set number relativenumber " message on status line to show current mode set showmode " When searching try to be smart about cases set smartcase " time that is waited for a mapped key sequence set timeoutlen=500 " use visual bell instead of beeping set visualbell " searches wrap around the end of the file set wrapscan " ============================================================================ " Plugin settings " ============================================================================ " https://github.com/unblevable/quick-scope#highlight-on-key-press " let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] let g:EasyMotion_startofline = 0 " keep cursor column when JK motion let g:EasyMotion_smartcase = 1 let g:EasyMotion_use_smartsign_us = 1 vmap gy (Exchange) nmap gy (Exchange) " make vim-easymotion match spacemacs and doom emacs nmap gs (easymotion-prefix) " there is no gsl in the default mappings nmap gsl (easymotion-bd-line) " The above mapping is bidirectional " All of the remaining are unidirectional: " f, F, t, T, w, W, b, B, e, E, ge, gE, j, k, n, N, s, S xmap gsf (easymotion-f) omap gsf (easymotion-f) xmap gsF (easymotion-F) omap gsF (easymotion-F) xmap gst (easymotion-t) omap gst (easymotion-t) xmap gsT (easymotion-T) omap gsT (easymotion-T) xmap gsw (easymotion-w) omap gsw (easymotion-w) xmap gsW (easymotion-W) omap gsW (easymotion-W) xmap gsb (easymotion-b) omap gsb (easymotion-b) xmap gsB (easymotion-B) omap gsB (easymotion-B) xmap gse (easymotion-e) omap gse (easymotion-e) xmap gsE (easymotion-E) omap gsE (easymotion-E) xmap gsge (easymotion-ge) omap gsge (easymotion-ge) xmap gsgE (easymotion-gE) omap gsgE (easymotion-gE) xmap gsj (easymotion-j) omap gsj (easymotion-j) xmap gsk (easymotion-k) omap gsk (easymotion-k) xmap gsn (easymotion-n) omap gsn (easymotion-n) xmap gsN (easymotion-N) omap gsN (easymotion-N) nmap gss (easymotion-f2) xmap gss (easymotion-f2) omap gss (easymotion-f2) nmap gsS (easymotion-F2) xmap gsS (easymotion-F2) omap gsS (easymotion-F2) " https://github.com/Mishkun/ideavim-sneak/issues/15 " 2-character Sneak (default) " nmap (sneak-s) " nmap (sneak-S) " visual-mode " xmap (sneak-s) " xmap (sneak-S) " operator-pending-mode " omap (sneak-s) " omap (sneak-S) " repeat motion " map ; (sneak-;) " map , (sneak-,) " 1-character enhanced 'f' " nmap f (sneak-f) " nmap F (sneak-F) " visual-mode " xmap f (sneak-f) " xmap F (sneak-F) " operator-pending-mode " omap f (sneak-f) " omap F (sneak-F) " 1-character enhanced 't' " nmap t (sneak-t) " nmap T (sneak-T) " visual-mode " xmap t (sneak-t) " xmap T (sneak-T) " operator-pending-mode " omap t (sneak-t) " omap T (sneak-T) " ============================================================================ " IDE actions " ============================================================================ nnoremap ga :action GotoAction nnoremap gd :action GotoDeclaration nnoremap gf :action GotoFile " go is normally like gg, " instead remap go as Go to Class " Mnemonic: 'Go Object' nnoremap go :action GotoClass " nnoremap gr :action GotoRelated " nnoremap gs :action GotoSymbol nnoremap g; :action JumpToLastChange nnoremap g, :action JumpToNextChange " unimpaired-style mappings nnoremap [ Oj nnoremap ] ok nnoremap ]b :action GotoNextBookmark nnoremap [b :action GotoPreviousBookmark nnoremap [c :action VcsShowPrevChangeMarker nnoremap ]c :action VcsShowNextChangeMarker nnoremap ]e :action GotoNextError nnoremap [e :action GotoPreviousError nnoremap ]m :action MethodDown nnoremap [m :action MethodUp nnoremap ]o :action SelectNextOccurrence nnoremap [o :action SelectPreviousOccurrence nnoremap ]u :action GotoNextElementUnderCaretUsage nnoremap [u :action GotoPrevElementUnderCaretUsage nnoremap ]p :action org.intellij.plugins.markdown.ui.actions.editorLayout.EditorOnlyLayoutChangeAction nnoremap [p :action org.intellij.plugins.markdown.ui.actions.editorLayout.EditorAndPreviewLayoutChangeAction nnoremap ]P :action org.intellij.plugins.markdown.ui.actions.editorLayout.EditorOnlyLayoutChangeAction nnoremap [P :action org.intellij.plugins.markdown.ui.actions.editorLayout.PreviewOnlyLayoutChangeAction " Listed by Active Editor (EditorToggleActions) nnoremap yoa :action ViewToolButtons nnoremap yob :action EditorToggleShowBreadcrumbs nnoremap yod :action ToggleDistractionFreeMode nnoremap yog :action EditorToggleShowGutterIcons nnoremap yoi :action EditorToggleShowIndentLines nnoremap yom :action ToggleMinimap nnoremap yon :action EditorToggleShowLineNumbers nnoremap yop :action TogglePresentationMode nnoremap yos :action ViewStatusBar nnoremap yot :action ViewToolBar nnoremap yow :action EditorToggleUseSoftWraps nnoremap yoz :action ToggleZenMode " Backslash as leader key mappings " Instead of ActivateCommitToolWindow, use Cmd+k and Cmd+w " Set up external tool "black": " https://black.readthedocs.io/en/stable/editor_integration.html " Arguments: "$FilePath$" -l 79 nmap nnoremap a :action EditorActions nnoremap b :action Tool_External Tools_Black nnoremap c :action ShowIntentionActions nnoremap d :action ActivateDatabaseToolWindow nnoremap e :action ActivateEventLogToolWindow nnoremap f :action RenameFile nnoremap g :action EditorPopupMenu.GoTo nnoremap h :action LocalHistory.ShowHistory nnoremap i :action GotoImplementation nnoremap j :action JumpToLastWindow nnoremap k :action Help.KeymapReference " Reformat Code is M-A-L nnoremap l :action ReformatCode nnoremap m :action Move nnoremap n :action ShowNavBar nnoremap o :action OptimizeImports nnoremap p :action ActivatePythonConsoleToolWindow nnoremap q :action CloseProject nnoremap r :action ActivateRConsoleToolWindow nnoremap s :action ActivateSciViewToolWindow nnoremap t :action ActivateTerminalToolWindow nnoremap u :action FindUsagesInFile " Introduce Variable is M-A-V nnoremap v :action IntroduceVariable nnoremap w :action HideAllWindows nnoremap x :action ChangeSplitOrientation " Reload All from Disk is M-A-Y nnoremap y :action Synchronize " Rollback is M-A-Z nnoremap z :action Vcs.RollbackChangedLines " Clear search highlighting when hitting backslash twice nnoremap :nohlsearch " These work, you just have to do the combo very fast nnoremap + :action StretchEditorToBottom nnoremap - :action StretchEditorToTop nnoremap > :action StretchEditorToRight nnoremap < :action StretchEditorToLeft " = Refactor this... now only works in normal mode " so can indent line in insert mode nnoremap :action Refactorings.QuickListPopupAction " Emacs and bash style insert mode CTRL shortcuts " = Move to start of the line; like in vim command mode: c_ctrl-b; To insert previously inserted text, use . or (below) inoremap " = Move one character backward inoremap " = Delete one character forward; the opposite of inoremap " = Move to end of the line; the opposite of ; already exists in command mode: c_ctrl-e inoremap " = Move one character forward; the opposite of inoremap " = Cancel completion inoremap pumvisible() ? "\" : "" " = Delete one character backward; the opposite of ; already exists in command mode: c_ctrl-h " = Delete to end of line; the opposite of inoremap :action EditorDeleteToLineEnd " = Complete word using matches that come next; the opposite of inoremap :action HippieBackwardCompletion inoremap n :action HippieBackwardCompletion " inoremap :action HippieBackwardCompletion " = Complete word using previous matches; the opposite of inoremap :action HippieCompletion inoremap p :action HippieCompletion " inoremap :action HippieCompletion " = Delete to start of line; the opposite of ; already exists in command mode: c_ctrl-u " = Delete word backward; opposite of ; same as ; already exists in command mode: c_ctrl-w " = Paste from system clipboard (not from killring like in bash/emacs) inoremap + " = Undo like in bash/emacs (this works really well) inoremap u " Emacs and bash style insert mode ALT shortcuts " = Move one word backward; opposite of inoremap " = Capitalize letter and move forward inoremap gUllguwea " = Delete word forward; opposite of and inoremap :action EditorKillToWordEnd " = Move one word forward; opposite of inoremap " = Delete word backward; opposite of , same as inoremap " = Move down; opposite of inoremap " = Move up; opposite of inoremap " = Lowercase to word end; opposite of (works) inoremap gueea " = Swap current word with previous word (works) inoremap diwbPldepa inoremap dawbhpi " = Uppercase to WORD end; opposite of (does not work) inoremap gUeea " " = Insert previously inserted text (if any) inoremap a. cnoremap . " " = Undo inoremap ugi " inoremap u " Multiple cursors mappings " inoremap :action EditorCloneCaretBelow " inoremap :action EditorCloneCaretAbove " remap Y to y$ to make it easier to yank to the end of the line nnoremap Y y$