Files
dotfiles/common/.config/ideavim/ideavimrc
Pratik Tripathy e85d1170bc IdeaVim
- Fix: <ctrl-backspace> was leaving a "u" insert keymap was fixed
- Added keymaps for moving line(s) up/down with <alt>j,k
- Minor quote lints
2024-03-09 22:24:07 +05:30

123 lines
3.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
"source ~/.vimrc
" FIX: "u" appears randomly when deleting words and other times
" TODO: Keep the mappings same across Neovim & Idea
" Keymap structure:
" b+: [B]buffer Operations
" c+: [C]oding Stuff
" d+: [D]iagnostics
" f+: [F]ile Operations
" g+: [G]it Operations
" l+: [L]ist Things
" n+: [N]eoVim Stuff
" s+: Grep/[S]earch Things
" t+: [T]est runner stuff
" x+: close/dismiss something
" e: explorer
" j: EasyMotion jump
" p: Paste from system clipboard
" y: Copy selected stuff to system clipboard
" u: Open undo-tree side-panel
" v: Open document symbol explorer
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
source ~/.vim/configs.vim
source ~/.vim/key_maps.vim
source ~/.vim/plugin_config.vim
" Because :noh does not work in Jetbrains
nnoremap <esc> <esc>
inoremap <esc> <esc>
" Set Tabs to 4 characters
set expandtab
set tabstop=4
set shiftwidth=4
" Searches
set hlsearch ignorecase smartcase incsearch wrapscan
" Common settings
set gdefault " substitute all occurrences in line
set clipboard^=unnamed,unnamedplus,ideaput " Copy to and from system clipboard
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enabled plugins
set ideajoin quickscope
Plug "easymotion/vim-easymotion" " <leader>j or J [2 characters]
Plug "preservim/nerdtree" " <leader>e
Plug "tpope/vim-surround" " ys or cs or ds [motion]
Plug "tpope/vim-commentary" " gc [motion]
Plug "machakann/vim-highlightedyank"
Plug "dbakker/vim-paragraph-motion"
Plug "chrisbra/matchit"
Plug "tpope/vim-repeat" " Repeat for Surround
Plug "vim-indent-object" " Select indent with ai, ii, aI, iI
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
" Map \b to toggle breakpoint
"map \b <Action>(ToggleLineBreakpoint)
" Multiple Cursors
map mc <A-n>
map mx <A-x>
map mp <A-p>
" Find/Open file
nmap <leader>of :action GotoFile<CR>
nmap <leader>or :action RecentFiles<CR>
" Find/Navigate to different parts of code
nmap <leader>gf :action FindInPath<CR>
nmap <leader>gr :action ShowUsages<CR>
nmap <leader>gi :action GotoImplementation<CR>
nmap <leader>gs :action GotoSuperMethod<CR>
" Tabs
nmap <leader>tn :action NextTab<CR>
nmap <leader>tp :action PreviousTab<CR>
" NerdTree
nmap <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
nmap <C-p> :action ParameterInfo<CR>
imap <C-p> <C-o>:action ParameterInfo<CR>
nmap <leader>n :action GotoNextError<CR>
map gh <Action>(ShowErrorDescription)
" Code refactoring
nmap <leader>ri :action Inline<CR>
nmap <leader>rr :action RenameElement<CR>
nmap <leader>rev :action IntroduceVariable<CR>
vmap <leader>rev :action IntroduceVariable<CR>
nmap <leader>rem :action ExtractMethod<CR>
vmap <leader>rem :action ExtractMethod<CR>
nmap <leader>rm :action Move<CR>
nmap <leader>ro :action OptimizeImports<CR>
nmap <leader>rG :action Generate<CR>
nmap <leader>rf :action ReformatCode<CR>
" Easy motion
map <leader>j <Plug>(easymotion-s)
nmap <leader>gr :action Vcs.RollbackChangedLines<CR>