Skip to content

Instantly share code, notes, and snippets.

@dobrowins
Last active March 24, 2024 16:51
Show Gist options
  • Save dobrowins/27afb2e1efe69942d5d6e6b93ea25e23 to your computer and use it in GitHub Desktop.
Save dobrowins/27afb2e1efe69942d5d6e6b93ea25e23 to your computer and use it in GitHub Desktop.
.ideavimrc
"" Source your .vimrc
"source ~/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Don't use Ex mode, use Q for formatting.
map Q gq
map <C-D> <C-D>zz
map <C-U> <C-U>zz
map } }zz
map { {zz
inoremap jk <Esc>
" Find more examples here: https://jb.gg/share-ideavimrc
set ideajoin
let mapleader=" "
set showmode
set showcmd
set visualbell
set incsearch
set clipboard+=unnamed
set highlightedyank
set number
set relativenumber
set nerdtree
" Open NERDTree (use q to exit)
map <leader>x :NERDTreeToggle<CR>
" todo: https://github.com/TheBlob42/idea-which-key
" all idea actions https://gist.github.com/zchee/9c78f91cc5ad771c1f5d
" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
" Folding code blocks
map <leader>zc <Action>(CollapseAllRegions)
map <leader>zo <Action>(ExpandAllRegions)
" debug actions
map <leader>d <Action>(Debug)
map \b <Action>(ToggleLineBreakpoint)
" Window splits
map <leader>wv <Action>(SplitVertically)
map <leader>ws <Action>(SplitHorizontally)
map <leader>wu <Action>(Unsplit)
map <leader>wm <Action>(MoveEditorToOppositeTabGroup)
" Refactoring
map <leader>rr <Action>(Refactorings.QuickListPopupAction)
map <leader>rc <Action>(ReformatCode)
map <leader>rn <Action>(RenameElement)
map <leader>rm <Action>(ExtractMethod)
map <leader>ri <Action>(ExtractInterface)
" Go to code
nmap <leader>gd <Action>(GotoDeclaration)
nmap <leader>gy <Action>(GotoTypeDeclaration)
nmap <leader>gi <Action>(GotoImplementation)
nmap <leader>gu <Action>(ShowUsages)
nmap <leader>gt <Action>(GotoTest)
nmap <leader>gf <Action>(Forward)
nmap <leader>gb <Action>(Back)
" Git windows
map <leader>gb <Action>(Git.Branches)
" File navigation
map <leader>nf <Action>(NewFile)
map <leader>ff <action>(GotoFile)
map <leader>fr <action>(RecentFiles)
map <leader>fc <action>(FindInPath)
map <leader><leader> <Action>(RecentFiles)
map <leader>fl <action>(RecentLocations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment