Files
dotfiles/common/.config/ideavim/ideavimrc
Pratik Tripathy fef7c8e027 feat(prettierignore): Template for prettierigore added
- feat(prettier): More options in prettierrc
- chore(vscode): Merged changes
2024-08-08 15:35:06 +05:30

166 lines
5.8 KiB
Plaintext

" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc
" Examples to map IDE actions to IdeaVim -- https://jb.gg/abva4t
" Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" FIX: Macros does NOT work
" TODO: Add Jetbrains shortcut-config-file to dotfiles repo
" TODO: Add shortcuts for opening/closing `za`
" Resolve Shortcut conflicts with Jetbrains
sethandler <S-Tab> a:vim
sethandler <C-S-CR> a:vim
sethandler <C-6> a:vim
sethandler <C-;> a:vim
sethandler <C-S-;> a:vim
sethandler <C-A> a:vim
sethandler <C-B> a:vim
sethandler <C-C> a:vim
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:vim
sethandler <C-L> a:vim
sethandler <C-N> a:vim
sethandler <A-N> a:ide
sethandler <C-O> a:vim
sethandler <C-P> a:ide
sethandler <C-R> a:vim
sethandler <C-S> a:ide
sethandler <C-T> a:vim
sethandler <C-U> a:vim
sethandler <C-V> a:vim
sethandler <C-W> a:vim
sethandler <C-X> a:vim
sethandler <C-Y> a:vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
source ~/.vim/configs.vim
source ~/.vim/key_maps.vim
source ~/.vim/plugin_config.vim
" Common settings
"set clipboard^=unnamed,unnamedplus,ideaput " Copy to and from system clipboard
set showmode
set idearefactormode=keep
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enabled plugins
set commentary " gc [motion]
set easymotion " <leader>j
set exchange " cx[motion] 2 times, cxc <- cancel exchange
set highlightedyank
set indent-object " ai, ii, aI, iI <- Select indent
set quickscope
set paragraph-motion
set matchit
set multiple-cursors
set nerdtree " <leader>e
set repeat
set surround " ys or cs or ds [motion]
set textobj-entire " yae, cae, dae <- operates on entire file
set ReplaceWithRegister
" IdeaVIM specific plugins
set argtextobj " vaa, caa, daa <- Works on function args
let g:argtextobj_pairs="[:],(:),<:>"
set ideajoin
set ideamarks " m[A-Z] <- sets marks
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""" SHORTCUTS """""""""""""""""""""""""
" Easy Motion
map <leader>j <Plug>(easymotion-s)
" Multiple Cursors
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
nmap g<C-n> <Plug>NextOccurrence
xmap g<C-n> <Plug>NextOccurrence
xmap <C-x> <Plug>SkipOccurrence
xmap <C-p> <Plug>RemoveOccurrence
" NerdTree """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>e :NERDTreeToggle<cr>
" When in the tree use the below default keybindings
" j, k - To go down and up
" p - Go to the parent directory
" P - Go the root directory
" s - open file in vertical split
" i - open in horizontal split
" t - open in a new tab
" o - Open the selected file or Expand the selected directory.
" - Also collapse the same directory.
" - Moves the cursor to the file.
" go - Opens the file but keeps the cursor on the file tree
" A - expand the file tree
" x - close the file tree
" File Navigation """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>ls :action Switcher<cr>
nnoremap <c-p> :action GotoFile<cr>
nnoremap <c-s-enter> :action ActivateTerminalToolWindow<cr>
" Code Navigation, Formatting, Others """""""""""""""""""""""""""""""""""""""
nnoremap ]] :action GotoNextElementUnderCaretUsage<cr>
nnoremap [[ :action GotoPrevElementUnderCaretUsage<cr>
nnoremap ]f :action MethodDown<cr>
nnoremap [f :action MethodUp<cr>
nmap <c-o> :action Back<cr>
nmap <c-i> :action Forward<cr>
nnoremap <leader>cS :action GotoSymbol<cr>
noremap <leader>v :action FileStructurePopup<cr>
map == V<Action>(ReformatCode)
nnoremap <leader>cr :action RenameElement<cr>
nnoremap <leader>ca :action ShowIntentionActions<cr>
nnoremap <leader>cR :action FindUsages<cr>
map <C-s> <Action>(ReformatCode) \| <Action>(SaveAll)
" Diagnostics """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>dd :action ActivateProblemsViewToolWindow<cr>
nnoremap <leader>dw :action InspectCode<cr>
nnoremap ]d :action GotoNextError<cr>
nnoremap [d :action GotoPreviousError<cr>
" Git """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>gg :action ActivateCommitToolWindow<cr>
nnoremap <leader>gr :action Vcs.RollbackChangedLines<cr>
nnoremap <leader>gb :action Git.Branches<cr>
nnoremap <leader>gG :action ActivateVersionControlToolWindow<cr>
nnoremap <leader>ga :action Annotate<cr>
nnoremap <leader>gf :action ShowTabbedFileHistory<cr>
nnoremap ]g :action VcsShowNextChangeMarker<cr>
nnoremap [g :action VcsShowPrevChangeMarker<cr>
" List stuff """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>lt :action ActivateTODOToolWindow<cr>
nnoremap <leader>lb :action RecentFiles<cr>
nnoremap <leader>lc :action RecentLocations<cr>
" Search stuff """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>sg :action FindInPath<cr>
nnoremap <leader>sb :action TextSearchAction<cr>
nnoremap <leader>sc :action GotoClass<cr>
" Close stuff """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>xo :action CloseAllEditorsButActive<cr>
nnoremap <leader>z :action ToggleDistractionFreeMode<cr>
nnoremap <leader>/ :nohlsearch<cr>
" Run, debug & test """""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>rd :action Debug<cr>
map <leader>rx :action Run<cr>
map <leader>rs :action Stop<cr>
map <leader>rt :action RunTests<cr>
map <leader>rb :action ToggleLineBreakpoint<cr>
" Split window
nnoremap <c-w>m :action MoveEditorToOppositeTabGroup<CR>
nnoremap <c-w>x :action Unsplit<cr>