Skip to content

Instantly share code, notes, and snippets.

@ilovejs
Created April 10, 2024 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilovejs/b80d0661f961b0b9ded4ef1d7d58c6f2 to your computer and use it in GitHub Desktop.
Save ilovejs/b80d0661f961b0b9ded4ef1d7d58c6f2 to your computer and use it in GitHub Desktop.
" Docs
" https://github.com/JetBrains/ideavim/wiki/set-commands
" Make sure to click reload on the right to take into effect
" Need to install more plugins as listed here
" https://plugins.jetbrains.com/bundles/7-ideavim-bundle
""" Common settings
""" https://github.com/JetBrains/ideavim/wiki/%22set%22-commands
" Map leader can be space or ,
let mapleader=" "
""" Plugins
set commentary
set multiple-cursors
set surround
set textobj-entire
set ReplaceWithRegister
set argtextobj
let g:argtextobj_pairs="[:],(:),<:>"
set showmode
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" incremental searching
set incsearch
"print the line number in front of each line
set nu
"set relativenumber
" shift + j" to join lines from below
" https://github.com/JetBrains/ideavim/blob/master/doc/ideajoin-examples.md
set ideajoin
"refactoring mode
set idearefactormode=keep
" bookmark
set ideamarks
"set timeout
"https://github.com/TheBlob42/idea-which-key
set timeoutlen=5000
"https://plugins.jetbrains.com/plugin/9615-ideavimextension
set keep-english-in-normal
"Must install IdeaVim-EasyMotion plugin after installed ideavim
"https://github.com/AlexPl292/IdeaVim-EasyMotion
set easymotion
" global searching
map <leader>j <Plug>(easymotion-s)
" forward searching
map <leader>f <Plug>(easymotion-f)
" https://plugins.jetbrains.com/plugin/15348-ideavim-sneak
" vim-sneak is shit
"rename
map <leader>r <Action>(RenameElement)
"debug"
map <leader>b <Action>(ToggleLineBreakpoint)
map <leader>d <Action>(Debug)
map <leader>c <Action>(Stop)
"distraction free"
map <leader>z <Action>(ToggleDistractionFreeMode)
"select file like ctrl-shift-n, but when u turn on one-click preview
"it is faster"
map <leader>p <Action>(SelectInProjectView)
"git blame"
map <leader>a <Action>(Annotate)
"file history"
map <leader>h <Action>(Vcs.ShowTabbedFileHistory)
"shift space"
map <S-Space> <Action>(GotoNextError)
"file structure"
map <leader>o <Action>(FileStructurePopup)
" Leave insertion mode by quickly type jk"
"https://stackoverflow.com/questions/9221769/whats-the-meaning-of-inoremap-in-vimrc
"inoremap jk <ESC>
"inoremap jj <Esc>
" unset navigation facility so can use f+char for brackets match
map ( <Nop>
map ) <Nop>
" resolve shortcut conflicts, you can view them in vim status icon - settings"
sethandler <C-2> a:ide
sethandler <C-S-2> a:vim
sethandler <C-6> a:vim
sethandler <C-S-6> a:vim
sethandler <C-A> a:ide
sethandler <C-B> a:ide
sethandler <C-C> a:ide
sethandler <C-D> a:vim
sethandler <C-E> a:vim
sethandler <C-F> a:ide
sethandler <C-G> a:vim
sethandler <C-H> a:vim
sethandler <C-I> a:vim
sethandler <C-J> a:vim
sethandler <C-K> a:ide
sethandler <C-L> a:vim
sethandler <C-M> a:vim
sethandler <C-N> a:vim
sethandler <C-O> a:vim
sethandler <C-P> a:vim
sethandler <C-Q> a:vim
sethandler <C-R> a:ide
sethandler <C-S> a:ide
sethandler <C-T> a:vim
sethandler <C-U> a:vim
sethandler <C-V> a:ide
sethandler <C-W> a:vim
sethandler <C-X> a:ide
sethandler <C-Y> a:vim
sethandler <C-[> a:ide
sethandler <C-]> a:ide
sethandler <S- > a:vim
sethandler <C-;> a:vim
sethandler <C-S-;> a:vim
" alter-enter put parameter in separate line
" shift+k on struct shows fields
" easymotion can be replaced by find command /, due to speed of triggering"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment