Skip to content

Instantly share code, notes, and snippets.

@rdanilin
Created February 12, 2025 14:16
Show Gist options
  • Save rdanilin/17b740e54d394359863c278454e5dd5c to your computer and use it in GitHub Desktop.
Save rdanilin/17b740e54d394359863c278454e5dd5c to your computer and use it in GitHub Desktop.
.ideavimrc config
set scrolloff=5
" Do incremental searching.
set incsearch
set ignorecase
set smartcase
set relativenumber
set number
set highlightedyank
set relativenumber
set hlsearch
set incsearch
" Don't use Ex mode, use Q for formatting.
map Q gq
let mapleader ="\<Space>"
let g:sneak#label = 1
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
Plug 'justinmk/vim-sneak'
Plug 'tpope/vim-surround'
Plug 'tommcdo/vim-exchange'
Plug 'tpope/vim-commentary'
" Clipboard
set clipboard+=unnamedplus
nmap ]<Space> o<Esc>k
nmap [<Space> O<Esc>j
" Save file
nmap <c-s> :w<CR>
" Copy whole file
" nmap <c-c> :%y+<CR>
" Exit from NORMAL mode
imap <c-[> <ESC>
" Navigate in INSERT mode
imap <c-b> <ESC>^i
imap <c-e> <End>
imap <c-h> <Left>
imap <c-l> <Right>
imap <c-j> <Down>
imap <c-k> <Up>
nmap [[ :action MethodUp<CR>
nmap ]] :action MethodDown<CR>
vmap J :action MoveLineDown<CR>
vmap K :action MoveLineUp<CR>
inoremap jj <esc>
inoremap jJ <esc>
inoremap Jj <esc>
inoremap JJ <esc>
inoremap jk <esc>
inoremap jK <esc>
inoremap Jk <esc>
inoremap JK <esc>
" Reload .ideavimrc
nnoremap <leader>vv :e ~/.ideavimrc<CR>
nnoremap <leader>vr :source ~/.ideavimrc<CR>
" Navigation
nnoremap <c-o> :action Back<cr>
nnoremap <c-i> :action Forward<cr>
" nnoremap <c-d> <c-d>zz
nnoremap <c-u> <c-u>zz
nmap n nzzzv
nmap N Nzzzv
#####################
" nmap gC :action GotoClass<CR>
" nmap gF :action GotoFile<CR>
nmap gd :action GotoDeclaration<CR>
nmap gu :action FindUsages<CR>
nmap gt :action GotoTest<CR>
nmap gi :action GotoImplementation<CR>
nmap gs :action GotoSuperMethod<CR>
nmap gb :action CommentByBlockComment<CR>
vmap gb :action CommentByBlockComment<CR>
nmap gj :action QuickJavaDoc<CR>
nmap <leader>sf :action FileStructurePopup<CR>
nmap <leader>su :action ShowUsages<CR>
nmap <leader>st :action TypeHierarchy<CR>
nmap <leader>sh :action LocalHistory.ShowHistory<CR>
nmap <leader>sg :action Vcs.QuickListPopupAction<CR>
" nmap <leader>st :action Vcs.UpdateProject<CR>
" Bitbucket plugin
nmap <leader>sb :action Vcs.Log.ContextMenu<CR>
" nmap <leader>sgl :action ActivateVersionControlToolWindow<CR>
" Zen Mode
nmap <leader>sz :action ToggleDistractionFreeMode<CR>
" Navigation Bar
nmap <leader>sn :action ShowNavBar<CR>
" Github Copilot plugin
nmap <leader>sc :action Github<CR>
nmap <leader>fw :action FindInPath<CR>
nmap <leader>fa :action SearchEverywhere<CR>
nmap <leader>fo :action RecentFiles<CR>
nmap <leader>fl :action RecentLocations<CR>
nmap <leader>ff :action GotoFile<CR>
nmap <leader>fc :action GotoClass<CR>
nmap <leader>bn :action NewFile<CR>
nmap <leader>bb :action NewScratchFile<CR>
nmap <leader>ba :action CloseAllEditors<CR>
nmap <leader>bc :action CloseActiveTab<CR>
nmap <c-w-s> :action VimWindowSplitHorizontal<CR>
nmap <c-w-v> :action VimWindowSplitVertical<CR>
nmap <c-w-c> :action VimWindowClose<kR>
nmap <c-w-h> :action VimWindowLeft<CR>
nmap <c-w-j> :action VimWindowDown<CR>
nmap <c-w-k> :action VimWindowUp<CR>
nmap <c-w-l> :action VimWindowRight<CR>
nmap <leader>rr :action RenameElement<CR>
" nmap <leader>ri :action Inline<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>rt :action RefactoringMenu<CR>
nmap <leader>rm :action Move<CR>
" nmap <leader>ro :action OptimizeImports<CR>
nmap <leader>rg :action Generate<CR>
nmap <leader>rs :action SurroundWith<CR>
" Formating/Linting
nmap <leader>rf :action ReformatCode<CR>
vmap <leader>rf :action ReformatCode<CR>
nmap <leader>er :action Run<CR>
nmap <leader>ed :action Debug<CR>
nmap <leader>ef :action RerunFailedTests<CR>
nmap <leader>em :action ActivateMavenToolWindow<CR>
nmap <leader>et :action ActivateTerminalToolWindow<CR>
" nmap <F9> :action RunConfiguration<CR>
" vmap <F9> :action RunConfiguration<CR>
map <F10> :action ChooseDebugConfiguration<CR>
" nmap <F10> :action ChooseDebugConfiguration<CR>
" vmap <F10> :action ChooseDebugConfiguration<CR>
map <S-9> :action Run<CR>
map <S-F10> :action Debug<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment