Skip to content

Instantly share code, notes, and snippets.

@AldanariP
Last active June 23, 2025 10:40
Show Gist options
  • Save AldanariP/c3a0b5ac0d8f5afb9e56389815e3e2f2 to your computer and use it in GitHub Desktop.
Save AldanariP/c3a0b5ac0d8f5afb9e56389815e3e2f2 to your computer and use it in GitHub Desktop.
My IdeaVim config file
let mapleader = " "
" List of commands here: https://jb.gg/h38q75
" Examples here: https://jb.gg/share-ideavimrc
set scrolloff=10
set relativenumber
set visualbell
set ignorecase
set smartcase
set incsearch
set ideajoin
set clipboard+=unnamed
" --- Remaps
" better ergonomics with AZERTY layout
noremap q a
noremap Q A
noremap a q
noremap z w
noremap Z W
noremap w z
onoremap az aw
onoremap aZ aW
onoremap iz iw
onoremap iZ iW
" A funny way I found to prevent myself from spamming h & l
let g:hjkl_count = {'h': 0, 'l': 0}
let g:hjkl_last_key = ''
function! AntiSpam(key)
if g:hjkl_last_key != a:key
let g:hjkl_count = {'h': 0, 'l': 0}
endif
let g:hjkl_count[a:key] += 1
let g:hjkl_last_key = a:key
if g:hjkl_count[a:key] > 5
echo "Use w/e/b/f instead of spamming " . a:key . "!"
return ""
endif
return a:key
endfunction
nnoremap <expr> h AntiSpam('h')
nnoremap <expr> l AntiSpam('l')
" toggle highlight
nnoremap <leader>h :set invhlsearch<CR>
" join upward
nnoremap <leader>j ddkPJ
" select All :')
nnoremap <C-a> ggVG}
onoremap ie ggVG}
" more logical that way isn't it ?
nnoremap U <C-r>
" join without space
nnoremap gJ Js<C-c>
" Uppercase one letter (more ergonomic)
nnoremap <leader>c ~h
" wraps in () and insert before (example: <leader>psorted = 'list' -> 'sorted(list)')
nnoremap <leader>p ea)<Esc>bi(<Esc>i
nnoremap <leader>P Ea)<Esc>Bi(<Esc>i
" remove closest parenthsis
nnoremap <leader><C-p> F(vdf)vd
" navigate version control changes
nmap gc <Action>(VcsShowNextChangeMarker)
nmap gC <Action>(VcsShowPrevChangeMarker)
" --- Plugings (https://jb.g" g/ideavim-plugins)
Plug 'machakann/vim-highlightedyank'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-surround'
set quickscope
set functiontextobj
" --- Pluging config
" QuickScope
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
" --- Pluging remap
" FunctionTextToObject
onoremap if <Plug>InnerFunction
onoremap af <Plug>OuterFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment