Skip to content

Instantly share code, notes, and snippets.

@hakkm
Created March 12, 2025 15:56
Show Gist options
  • Save hakkm/8ae953dcf005524961dfb7ca0bd6f0aa to your computer and use it in GitHub Desktop.
Save hakkm/8ae953dcf005524961dfb7ca0bd6f0aa to your computer and use it in GitHub Desktop.
my ideavim's config
let mapleader = " "
""""""""""""""""""""""""""""""""""""""""" Plugins
Plug 'easymotion/vim-easymotion'
"""""""""""""""" mapping of easymotion
"map <leader>s <Plug>(easymotion-s)
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
""""""""""""""""""""""""""""""""""""""""" Set
set relativenumber
" Set shift width to 4 spaces.
set shiftwidth=2
" Set tab width to 4 columns.
set tabstop=2
set keep-english-in-normal
"set scrolloff=10
set showcmd
set visualbell
"set clipboard=unnamedplus
set clipboard+=unnamed
set smartcase
set incsearch
set hlsearch
" setting pluggins
set nerdtree
set surround
set easymotion
set notimeout
set sneak
"set which-key
" MAPPINGS --------------------------------------------------------------- {{{
nnoremap <leader>hl :nohlsearch<CR>
nnoremap <leader>w :w<CR>
nnoremap <leader>q :wq<CR>
" Jump between methods
nnoremap [[ :action MethodUp<CR>
nnoremap ]] :action MethodDown<CR>
" ctrl-j,k to navigate autocompletion
jj
" Type kj to exit insert mode quickly.
inoremap kj <esc>
" Resize with arrows
nnoremap <C-Up> :resize +2<CR>
nnoremap <C-Down> :resize -2<CR>
nnoremap <C-Left> :vertical resize -2<CR>
nnoremap <C-Right> :vertical resize +2<CR>
" Navigate buffers
nnoremap <S-l> :bnext<CR>
nnoremap <S-h> :bprevious<CR>  
nnoremap <C-p> <C-^>
" Insert --
" Press jk fast to exit insert mode
inoremap kj <ESC>
" ctrl + backspace to delete a word
" see :help c_BS ==> CTRL-H *c_<BS>* *c_CTRL-H* *c_BS*
" CTRL-H delete the character before the cursor *c_CTRL-H*
" <BS> = CTRL-H = backspace
inoremap <C-H> <C-w>
" Visual --
" Stay in indent mode
vnoremap > ">gv
vnoremap < "<gv
" Move text up and down
vnoremap <A-k> :m .-2<CR>=
vnoremap <A-j> :m .+1<CR>=
vnoremap p '"_dP
nnoremap J :m +1<CR>gv=gv
nnoremap K :m -2<CR>gv=gv
" Visual Block --
" Move text up and down
xmap J :move '>+1<CR>gv-gv
xmap K :move '<-2<CR>gv-gv
xmap <A-j> :move '>+1<CR>gv-gv
xopen vimmap <A-k> :move '<-2<CR>gv-gv
" Command --
" foget to use sudo
cmap <C-H> <C-W>
cmap <C-k> <C-p>
cmap <C-j> <C-n>
nnoremap ga :action ProjectViewPopupMenu<CR>
nnoremap ss :source ~/.ideavimrc<CR>
nnoremap nh :noh<CR>
"nnoremap <leader>e :action ActivateProjectToolWindow<CR>
""""""""""""""""""""""""""""""""""""""Run""""""""""""""""""""""""""""""""""""""
nnoremap <leader>rc :action RunConfiguration<CR>
nnoremap <leader>rr :action Run<CR>
nnoremap <leader>rn :action RunClass<CR>
noremap <leader>dd :action Debug<CR>
noremap <leader>dn :action DebugClass<CR>
"noremap <leader>cc :action Coverage<CR>
"noremap <leader>cn :action RunCoverage<CR>
noremap <leader>sp :action Stop<CR>
"nnoremap <C-;> :action ActivateRunToolWindow<CR>
map <C-\> :action ActivateTerminalToolWindow<CR>
map <C-;> :action ActivateServicesToolWindow<CR>
"""""""""""""""""""""""""""""""""""""Debug
noremap <leader>bp :action ToggleLineBreakpoint<CR>
noremap <leader>qe :action QuickEvaluateExpression <CR>
"noremap <leader>ee :action EvaluateExpression <CR>
"noremap <leader>fr :action Debugger.ForceEarlyReturn<CR>
noremap <leader>daw :action Debugger.AddToWatch<CR>
"noremap <leader>fc :action ForceRunToCursor<CR>
noremap <leader>hs :action Hotswap<CR>
noremap <leader>DD :action JRebel Debug<CR>
noremap <leader>rab :action Debugger.RemoveAllBreakpointsInFile<CR>
noremap <leader>raB :action Debugger.RemoveAllBreakpoints<CR>
noremap <leader>df :action Debugger.PopFrame<CR>
noremap <leader>pp :action ShowExecutionPoint<CR>
noremap <leader>ds :action StreamTracerAction<CR>
noremap <leader>mb :action XDebugger.MuteBreakpoints<CR>
""""""""""""""""""""""""""""""""""""""Window""""""""""""""""""""""""""""""""""""""
noremap <leader>AM :action ActivateMavenToolWindow<CR>
noremap <leader>AD :action ActivateDatabaseToolWindow<CR>
noremap <leader>AT :action ActivateTODOToolWindow<CR>
noremap <leader>AF :action ActivateFavoritesToolWindow<CR>
noremap <leader>AP :action ActivateProjectToolWindow<CR>
noremap <leader>AG :action ActivateVersionControlToolWindow<CR>
noremap <leader>AS :action ActivateServicesToolWindow<CR>
noremap <leader>AB :action ViewBreakpoints<CR>
noremap <leader>AR :action ActivateRestServicesToolWindow<CR>
"nnoremap <leader>wd :action ActivateDebugToolWindow<CR>
"nnoremap <leader>wr :action ActivateRunToolWindow<CR>
"nnoremap <leader>wh :action HideActiveWindow<CR>
nnoremap <leader>mm :action MaximizeToolWindow<CR>
noremap <leader>ha :action HideAllWindows<CR>
noremap <leader>hh :action HideAllWindows<CR>
"noremap <leader><leader> :action HideAllWindows<CR>
noremap <leader>si :action SelectInProjectView<CR>
"noremap <leader>eb :action EditBreakpoint<CR>
""""""""""""" File Tree
nnoremap <leader>nc :action NewClass<CR>
nnoremap <leader>e :NERDTreeToggle <CR>
""""""""""""""""""""""""""""""""""""""Information""""""""""""""""""""""""""""""""""""""
noremap gl :action ShowErrorDescription<CR>
"noremap <leader>ti :action ExpressionTypeInfo<CR>
noremap <leader>pi :action ParameterInfo<CR>
noremap K :action QuickJavaDoc<CR>
"noremap <leader>fs mm`m:action FileStructurePopup<CR>
noremap <leader>f :action GotoFile<CR>
noremap <leader>c :action GotoClass<CR>
noremap <leader>sd :action ShowUmlDiagram<CR>
"noremap <leader>ch :action CallHierarchy<CR>
"nnoremap <leader>fu :action FindUsages<CR>
nnoremap <leader>su :action ShowUsages<CR>
noremap <leader>mh :action MethodHierarchy<CR>
noremap <C-,> :action ShowSettings<CR>
noremap <leader>ps :action ShowProjectStructureSettings<CR>
""""""""""""""""""""""""""""""""""""""""""" goto
nmap <leader>a <Action>(GotoAction)
nmap ga <Action>(GotoAction)
nmap gC <Action>(GotoClass)
nmap gs <Action>(GotoSymbol)
nmap gt <Action>(GotoTest)
nmap gT <Action>(TextSearchAction)
nmap go <Action>(GotoSuperMethod)
nmap gd <Action>(GotoDeclaration)
nmap gD <Action>(GotoTypeDeclaration)
nmap gi <Action>(GotoImplementation)
nmap gI <Action>(QuickImplementations)
nmap gn <Action>(ShowNavBar)
"""""""""""""""""""""""""""""""""""""""""" lsp
noremap <leader>lf :action ReformatCode<CR>
noremap <leader>lr :action RenameElement<CR>
noremap <leader>la :action Generate<CR>
noremap <leader>lq :action ShowIntentionActions<CR>
"""""""""""""""""""""""""""""""""""""""""" testing
noremap <leader>rtf :action RerunFailedTests<CR>
map <leader><leader>f :action FindInPath<CR>
map <leader>sf :action NewScratchFile<CR>
" Which-key settings
set which-key
let g:WhichKey_FontSize = 16
let g:WhichKey_CommandColor = "#41ead4"
let g:WhichKey_PrefixColor = "#f335b2"
let g:WhichKey_SortOrder = "by_key_prefix_first"
let g:WhichKeyDesc_leader = "<leader> Leader key"
let g:WhichKeyDesc_leader = "<leader>x Open file explorer"
let g:WhichKeyDesc_easymotion = "<leader>j Jump with Easymotion"
let g:WhichKeyDesc_easymotion_prefix = "<leader><leader>"
let g:WhichKeyDesc_comment = "<leader>c Comment line"
let g:WhichKeyDesc_fold = "<leader>z Folding"
let g:WhichKeyDesc_fold_all = "<leader>zc Fold all regions"
let g:WhichKeyDesc_unfold_all = "<leader>zo Unfold all regions"
let g:WhichKeyDesc_window = "<leader>w Window splits"
let g:WhichKeyDesc_window_split_vertically = "<leader>wv Split vertically"
let g:WhichKeyDesc_window_split_horizontally = "<leader>wh Split horizontally"
let g:WhichKeyDesc_window_split_unsplit = "<leader>wu Unsplit"
let g:WhichKeyDesc_window_split_move_editor = "<leader>wm Move editor to opposite tab group"
let g:WhichKeyDesc_display = "<leader>d Display options"
let g:WhichKeyDesc_zen_mode = "<leader>dz Toggle Zen mode"
let g:WhichKeyDesc_df_mode = "<leader>dd Toggle Distraction-Free mode"
let g:WhichKeyDesc_fullscreen = "<leader>df Toggle full screen"
let g:WhichKeyDesc_action= "<leader>a Actions"
let g:WhichKeyDesc_action_context_menu = "<leader>am Open context menu"
let g:WhichKeyDesc_action_search = "<leader>as Open command modal"
let g:WhichKeyDesc_file_quickLook = "<leader><leader> Recent files"
let g:WhichKeyDesc_file_nav = "<leader>f File navigation"
let g:WhichKeyDesc_file_nav_goto_file = "<leader>ff Go to file"
let g:WhichKeyDesc_file_nav_goto_content = "<leader>fc Search for file content"
let g:WhichKeyDesc_file_nav_show_recent_files = "<leader>fr Show recent files"
let g:WhichKeyDesc_file_nav_show_recent_locations = "<leader>fl Show recent locations"
let g:WhichKeyDesc_close_tab = "<leader>q Close active tab"
let g:WhichKeyDesc_refactoring = "<leader>r Refactoring menu"
let g:WhichKeyDesc_refactoring_rename = "<leader>rn Rename element"
let g:WhichKeyDesc_refactoring_method = "<leader>rm Extract method"
let g:WhichKeyDesc_refactoring_variable = "<leader>rv Introduce variable"
let g:WhichKeyDesc_refactoring_field = "<leader>rf Introduce field"
let g:WhichKeyDesc_refactoring_signature = "<leader>rs Change signature"
let g:WhichKeyDesc_refactoring_all = "<leader>rr Open refactorings list"
let g:WhichKeyDesc_goto = "<leader>g Go to X"
let g:WhichKeyDesc_goto_declaration = "<leader>gd Go to Definition"
let g:WhichKeyDesc_goto_type_declaration = "<leader>gy Go to Type Definition"
let g:WhichKeyDesc_goto_implementation = "<leader>gi Go to Implementation"
let g:WhichKeyDesc_goto_usages = "<leader>gu Go to Usages"
let g:WhichKeyDesc_goto_test = "<leader>gt Go to Test"
let g:WhichKeyDesc_goto_back = "<leader>gb Go Back"
let g:WhichKeyDesc_goto_forward = "<leader>gf Go Forward"
let g:WhichKeyDesc_git = "<leader>g Git operations"
let g:WhichKeyDesc_git_commit = "<leader>gc Open Git commit dialog"
let g:WhichKeyDesc_git_status = "<leader>gs Open Git status dialog"
let g:WhichKeyDesc_git_branches = "<leader>gb Open Git branches list"
let g:WhichKeyDesc_errors = "<leader>e Error navigation"
let g:WhichKeyDesc_errors_next = "<leader>en Go to next error in solution"
let g:WhichKeyDesc_errors_prev = "<leader>ep Go to previous error in solution"
@hakkm
Copy link
Author

hakkm commented Mar 18, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment