Skip to content

Instantly share code, notes, and snippets.

@marcustut
Last active March 1, 2023 03:21
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 marcustut/f9d1e95ec9c37dc5a2014357afe05d3d to your computer and use it in GitHub Desktop.
Save marcustut/f9d1e95ec9c37dc5a2014357afe05d3d to your computer and use it in GitHub Desktop.
Configuration for Jetbrains IDE's IdeaVim plugin
let mapleader = " "
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set NERDTree
set number
set relativenumber
set incsearch
set ignorecase
set smartcase
set hlsearch
set visualbell
set noerrorbells
set ideajoin
set idearefactormode=keep
""" My Mappings -----------------------------
nnoremap <leader>rr :source ~/.ideavimrc<CR>
"" Fast scroll
" IdeaVim uses 'a' for alt instead of Vim's 'm'
nnoremap <a-j> 15gj
nnoremap <a-k> 15gk
" Terminal
nnoremap <leader>T :action ActivateTerminalToolWindow<cr>
"" File browser
nnoremap <leader>fb :NERDTreeToggle<CR>
"" Multiple cursors
map <C-n> <Plug>NextWholeOccurrence
"" LSP
nnoremap gd :action GotoDeclaration<CR>
nnoremap gr :action FindUsages<CR>
nnoremap gi :action GotoImplementation<CR>
nnoremap <leader>ls :action FileStructurePopup<CR>
nnoremap <leader>lk :action GotoPreviousError<CR>
nnoremap <leader>lj :action GotoNextError<CR>
nnoremap <leader>lf :action ReformatCode<CR>
vnoremap <leader>lf :action ReformatCode<CR>
nnoremap <leader>lr :action RenameElement<CR>
nnoremap <leader>la :action ShowIntentionActions<CR>
"" Folding
nnoremap zc :action CollapseRegion<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap <leader>zc :action CollapseAllRegions<CR>
nnoremap <leader>zo :action ExpandAllRegions<CR>
"" Navigation
sethandler <C-j> a:vim
sethandler <C-k> a:vim
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <Tab> :action NextTab<CR>
nnoremap <S-Tab> :action PreviousTab<CR>
nnoremap <leader>x :action CloseEditor<CR>
"" Zen mode
nnoremap <leader>zz :action ToggleDistractionFreeMode<CR>
"" Comment
nnoremap <leader>cc :action CommentByLineComment<CR>
vnoremap <leader>c :action CommentByLineComment<CR>
"" Search
nnoremap <leader>ps :action FindInPath<CR>
nnoremap <leader>fp :action SearchEverywhere<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment