Skip to content

Instantly share code, notes, and snippets.

@mminski
Last active January 26, 2025 04:27
Show Gist options
  • Save mminski/5e0915df24c58960d42ba45de6defaa5 to your computer and use it in GitHub Desktop.
Save mminski/5e0915df24c58960d42ba45de6defaa5 to your computer and use it in GitHub Desktop.
" =======================
" IDEAVIM CONFIG
" =======================
" OPTIONS
set ignorecase
set noshowmatch
set smartcase
set surround
set multiple-cursors
set commentary
set argtextobj
set textobj-entire
set ReplaceWithRegister
set exchange
set NERDTree
set number relativenumber
set idearefactormode=keep
set ideajoin
set showmode
set so=5
set incsearch
set ideastatusicon=gray
set clipboard+=unnamed
" KEYMAPS
let mapleader='\'
vmap <leader>yiw "+yiw
nmap <leader>yiw "+yiw
vmap <leader>y "+y
vmap <leader>d "_d
nmap <leader>y "+yy
nmap <leader>p "+p
nmap <leader>P "+P
vmap <leader>p "+p
vmap <leader>P "+P
" shorts
nmap ; :
" register
nmap YY "nyy
nmap Yw "nyw
nmap Yiw "nyiw
nmap YiW "nyiW
nmap Yp "np
nmap YP "nP
" marks
nnoremap gm '
" source vim
nmap xv :so %<CR>
" run shell
nmap xx :.w !zsh <CR>
" shorting up some operators
onoremap w iw
onoremap W iW
onoremap " i"
onoremap ' i'
onoremap ) i)
onoremap ( i(
onoremap { i{
onoremap } i}
" whole line operations
nmap dk kddj
nmap dj jddk
nmap zj o<esc>k
nmap zk O<esc>j
" BOL EOL
map gh ^
map gl $
" scrolling
nmap <leader>d <C-d>
nmap <leader>u <C-u>
vmap <leader>d <C-d>
vmap <leader>u <C-u>
" making word-under-cursor-search inclusive
nnoremap * *``
nnoremap # #``
imap // <C-o>/
nnoremap <C-A> gg<S-v>G
nnoremap t e
nnoremap e ge
nnoremap E gE
nnoremap KK gg
nnoremap JJ G
nnoremap <C-r> yiw:%s/\<<C-r>"\>//g<left><left>
nnoremap s :%s/
nnoremap S :s/
onoremap " i"
onoremap ) i)
onoremap ( i(
onoremap { i{
onoremap } i}
inoremap jj <ESC>:w<CR>
inoremap kk <ESC>
inoremap :: <C-O>A);<ESC>
nnoremap ,, :q!<CR>
" =================
" IDEA actions
" =================
nnoremap <leader>sh :action SplitHorizontally <CR>
nnoremap <leader>sv :action SplitVertically <CR>
nnoremap <leader>sc :action UnsplitAll <CR>
nnoremap <leader>gh :action Back <cr>
nnoremap <leader>gl :action Forward <cr>
nnoremap <leader>gj :action MethodDown <cr>
nnoremap <leader>gk :action MethodUp <cr>
nnoremap <leader>gs :action GotoSuperMethod <cr>
nnoremap <leader>g, :action JumpToLastChange <cr>
nnoremap <leader>g. :action JumpToNextChange <cr>
nnoremap <leader>gd :action GotoDeclaration <cr>
nnoremap <leader>gr :action RecentFiles <cr>
nnoremap <leader>gc :action GotoClass <cr>
nnoremap <leader>gf :action GotoFile <cr>
nnoremap <leader>wh :action HideAllWindows <cr>
map <leader>rf :action ReformatCode<CR>
map <leader>n :action NextTab<CR>
map <leader>\ :action NextTab<CR>
map <leader>p :action PreviousTab<CR>
map <leader>' :action PreviousTab<CR>
imap <C-n> <ESC>:action HippieCompletion<CR>a
imap <C-p> <ESC>:action HippieBackwardCompletion<CR>a
map <leader>gt :action GotoTest<CR>
nnoremap <leader>cc :action CommentByLineComment <CR>
vnoremap <leader>cc :action CommentByLineComment <CR>
nmap <leader>fp :action FindInPath<CR>
nnoremap <leader>a :action SelectInProjectView<CR>
nnoremap <leader>ss :action SearchEverywhere <CR>
nnoremap <leader>rn :action RenameElement<CR>
nnoremap <leader>em :action ExtractMethod<CR>
map <leader>e :action GotoNextError<CR>
map <leader>E :action GotoPreviousError<CR>
map <leader>d :action ShowErrorDescription<CR>
map <leader>gi :action GotoImplementation<CR>
map <leader>fu :action FindUsages<CR>
map <leader>t :action ActivateTerminalToolWindow<CR>
map <leader>g :action Generate<CR>
map <leader>w :action EditorSelectWord<CR>
map <leader>e :NERDTreeToggle<CR>
map <leader>ff :action RecentFiles<CR>
map <leader>] :action NextSplitter<CR>
map <leader>[ :action PrevSplitter<CR>
map <leader>mf :action NewFile<CR>
map <leader>mc :action NewClass<CR>
map <leader>md :action NewDir<CR>
map <leader>xx :action RunClass<CR>
map <leader>dd <action>(ToggleDistractionFreeMode)
map <leader>dz <action>(ToggleZenMode)
map <leader>df <action>(ToggleFullScreen)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment