Fork 0

232 lines
6.2 KiB

set idearefactormode=visual
set ignorecase
set incsearch
set noerrorbells
set number
set relativenumber
set scrolloff=12
set showcmd
set showmode
set sidescrolloff=48
set smartcase
set virtualedit=onemore
set visualbell
set acejump
set argtextobj
set exchange
set highlightedyank
set ideajoin
set matchit
set multiple-cursors
set ReplaceWithRegister
set surround
set textobj-entire
set textobj-indent
" http://vimdoc.sourceforge.net/htmldoc/vimindex.html
" Map top row on Czech keyboard layout to digits
map + 1
map ě 2
map š 3
map č 4
map ř 5
map ž 6
map ý 7
map á 8
map í 9
map é 0
" Move some commands closer on Czech keyboard layout
nnoremap ú @@
noremap ů ;
map § %
" Navigate to end of previous word
nnoremap <A-b> ge
nnoremap <A-S-b> gE
" Navigate to indents
nnoremap J +
vnoremap J +
nnoremap K -
vnoremap K -
" Navigate camel humps
nnoremap L [w
vnoremap L [w
nnoremap H [b
vnoremap H [b
" Edit camel humps
nnoremap dL :raction EditorDeleteToWordEndInDifferentHumpsMode<CR>
nnoremap dH :raction EditorDeleteToWordStartInDifferentHumpsMode<CR>
nmap dih dHdL " Only works in the middle of a hump
nmap cL dLi
nmap cH dHi
nmap cih dihi
" Edit from cursor to start/end of parenthesized block
nnoremap c) c])
nnoremap d) d])
nnoremap c( c[((
nnoremap d( c[((<ESC>l
" Delete lines
nnoremap C cc
nnoremap D dd
vnoremap C cc
vnoremap D dd
" Alternative way to enter visual block mode
nnoremap <Space>v <C-V>
" Indent keeping selection
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
" Turn capital letters into opposite actions
" nnoremap U :redo<CR> " Handled by custom version of IdeaVim
" Reselect pasted text
nnoremap gp `[v`]
" Put without yank
xmap p gr
" Rebind commands that will be repurposed
nnoremap GG G
nnoremap dG dG
nnoremap cG cG
nnoremap M m
nnoremap Z z
map <A-S-n> <A-p>
" Repurpose 'Enter' for statement completion (renaming function requires a custom version of IdeaVIM)
function! CompleteStatement()
if (renaming())
" TODO https://github.com/JetBrains/ideavim/discussions/397#discussioncomment-1573048
" return "\<Enter>"
return "<Enter>"
action EditorCompleteStatement
return ""
nmap <expr> <Enter> CompleteStatement()
" Repurpose special characters for navigation
nmap ( :raction GotoPreviousError<CR>
nmap ) :raction GotoNextError<CR>
nmap [ :raction MethodUp<CR>
nmap ] :raction MethodDown<CR>
nmap { :raction JumpToLastChange<CR>
nmap } :raction JumpToNextChange<CR>
" Repurpose 'g' for navigation (:raction requires a custom version of IdeaVIM)
nmap gb :raction GotoNextBookmark<CR>
nmap gB :raction GotoPreviousBookmark<CR>
nmap gd :action GotoDeclaration<CR>
nmap gD :action GotoTypeDeclaration<CR>
nmap ge :raction VcsShowNextChangeMarker<CR>
nmap gE :raction VcsShowPrevChangeMarker<CR>
map gi :action GotoImplementation<CR>
map gj :raction EditorCloneCaretBelow<CR>
map gk :raction EditorCloneCaretAbove<CR>
nmap go :raction GotoNextElementUnderCaretUsage<CR>
nmap gO :raction GotoPrevElementUnderCaretUsage<CR>
nmap gr :action RecentLocations<CR>
nmap gR :action RecentChangedFiles<CR>
map gs :action GotoSuperMethod<CR>
map gS :action ShowSiblings<CR>
nmap gT /\\<class\>\\\|\\<interface\>\\\|\\<enum\>\\\|\\<object\>\\\|\\<record\>\\\|\\<struct\>\\\|\\<trait\><CR>w:nohlsearch<CR>
nmap gt gggT
nmap gu :action ShowUsages<CR>
nmap gU :action FindUsages<CR>
map gz :action NextSplitter<CR>
map gZ :action PrevSplitter<CR>
" Make bidirectional 'g' commands work with 'G' too
nmap Gb gb
nmap GB gB
nmap Ge ge
nmap GE gE
map Gj gj
map Gk gk
nmap Go go
nmap GO gO
nmap Gt gt
nmap GT gT
map Gz gz
map GZ gZ
" Repurpose 'z' for view actions, debugger, and tab management
map za :action Annotate<CR>
map zb :action ViewBreakpoints<CR>
map zc :action EditorContextInfo<CR>
map zd :action QuickJavaDoc<CR>
map ze :action ShowErrorDescription<CR>
map zf :action SelectInProjectView<CR>
map zht :action TypeHierarchy<CR>
map zhm :action MethodHierarchy<CR>
map zhc :action CallHierarchy<CR>
map zm :action ShowBookmarks<CR>
map zp :action QuickImplementations<CR>
map zP :action QuickTypeDefinition<CR>
map zr :action RunToCursor<CR>
map zR :action ForceRunToCursor<CR>
map zsd :action MoveTabDown<CR>
map zsr :action MoveTabRight<CR>
map zsu :action Unsplit<CR>
map zsU :action UnsplitAll<CR>
map zt :action ExpressionTypeInfo<CR>
map zx :action EvaluateExpression<CR>
" Repurpose 'm' for refactoring (normal mode)
nmap mg :action Generate<CR>
nmap mi :action Inline<CR>
nmap mn :action RenameElement<CR>
nmap mo :action OverrideMethods<CR>
nmap ms :action ChangeSignature<CR>
nmap mS :action NewScratchFile<CR>
" Repurpose 'm' for refactoring (normal / visual mode)
nmap mc :action IntroduceConstant<CR>
vmap mc :action IntroduceConstant<CR>
nmap mf :action IntroduceField<CR>
vmap mf :action IntroduceField<CR>
nmap mm :action ExtractMethod<CR>
vmap mm :action ExtractMethod<CR>
nmap mM :action ExtractFunction<CR>
vmap mM :action ExtractFunction<CR>
nmap mp :action IntroduceParameter<CR>
vmap mp :action IntroduceParameter<CR>
nmap mP :action IntroduceProperty<CR>
vmap mP :action IntroduceProperty<CR>
nmap mr :action Refactorings.QuickListPopupAction<CR>
vmap mr :action Refactorings.QuickListPopupAction<CR>
nmap mv :action IntroduceVariable<CR>
vmap mv :action IntroduceVariable<CR>
" Actions for custom version of AceJump
map <Space><Space> :action AceVimAction_JumpAllEditors<CR>
map <Space>f :action AceVimAction_JumpForward<CR>
map <Space>F :action AceVimAction_JumpBackward<CR>
map <Space>t :action AceVimAction_JumpTillForward<CR>
map <Space>T :action AceVimAction_JumpTillBackward<CR>
map <Space>l :action AceVimAction_JumpOnLineForward<CR>
map <Space>h :action AceVimAction_JumpOnLineBackward<CR>
map <Space>j :action AceVimAction_JumpLineIndentsForward<CR>
map <Space>k :action AceVimAction_JumpLineIndentsBackward<CR>
map <Space>w :action AceVimAction_JumpLWordForward<CR>
map <Space>W :action AceVimAction_JumpUWordForward<CR>
map <Space>b :action AceVimAction_JumpLWordBackward<CR>
map <Space>B :action AceVimAction_JumpUWordBackward<CR>
map <Space>e :action AceVimAction_JumpLWordEndForward<CR>
map <Space>E :action AceVimAction_JumpUWordEndForward<CR>
map <Space><A-b> :action AceVimAction_JumpLWordEndBackward<CR>
map <Space><A-S-b> :action AceVimAction_JumpUWordEndBackward<CR>