1
0
mirror of https://github.com/chylex/dotfiles.git synced 2024-12-21 18:42:46 +01:00
dotfiles/.ideavimrc

277 lines
6.5 KiB
Plaintext

set clipboard-=ideaput
set hlsearch
set ignorecase
set incsearch
set number
set nrformats-=octal
set relativenumber
set scrolloff=999
set showcmd
set showmode
set sidescrolloff=999
set smartcase
set virtualedit=onemore
set visualbell
" Use WSL bash as shell
if has('win32')
set shell=bash.exe
set shellcmdflag=-lic
set shellxquote=
endif
" Configure IDEA settings (https://github.com/JetBrains/ideavim/wiki/set-commands)
set ideajoin
set idearefactormode=visual
" Configure IDE keybindings (https://github.com/JetBrains/ideavim/wiki/sethandler)
sethandler <C-A> a:ide
sethandler <C-B> a:ide
sethandler <C-C> a:ide
sethandler <C-E> a:ide
sethandler <C-F> a:ide
sethandler <C-G> a:ide
sethandler <C-H> a:ide
sethandler <C-I> a:ide
sethandler <C-J> a:ide
sethandler <C-K> a:ide
sethandler <C-L> a:ide
sethandler <C-M> a:ide
sethandler <C-R> a:ide
sethandler <C-S> a:ide
sethandler <C-T> a:ide
sethandler <C-V> a:ide
sethandler <C-W> a:ide
sethandler <C-X> a:ide
sethandler <C-Y> a:ide
sethandler <C-\> a:ide
sethandler <A-B> a:vim
sethandler <A-H> a:vim
sethandler <A-L> a:vim
sethandler <A-N> a:vim
sethandler <A-O> a:vim
sethandler <A-P> a:vim
sethandler <A-S-B> a:vim
sethandler <A-S-O> a:vim
sethandler <A-V> a:vim
sethandler <A-X> a:vim
sethandler <C-D> a:vim
sethandler <C-I> a:vim
sethandler <C-N> a:vim
sethandler <C-O> a:vim
sethandler <C-P> a:vim
sethandler <C-S-W> a:vim
sethandler <C-U> a:vim
sethandler <S-BS> a:vim
" Enable plugins (https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins)
Plug 'argtextobj.vim'
Plug 'vim-exchange'
Plug 'vim-highlightedyank'
Plug 'vim-indent-object'
Plug 'vim-matchit'
Plug 'vim-multiple-cursors'
Plug 'vim-paragraph-motion'
Plug 'vim-surround'
Plug 'vim-textobj-entire'
" https://vimhelp.org/index.txt.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 ů %
map gů g%
" Camel humps
noremap L [w
noremap H [b
nnoremap L [w
nnoremap H [b
" Navigate to end of previous word
noremap <A-b> ge
noremap <A-S-b> gE
" Increment/decrement numbers
noremap <Bar>+ <C-a>
noremap <Bar>- <C-x>
" Edit from cursor to start/end of parenthesized block
nnoremap c) c])
nnoremap d) d])
nnoremap c( c[((
nnoremap d( c[((<Esc>l
" Create lines
nnoremap <A-o> o<Esc>$
nnoremap <A-S-o> O<Esc>$
" Delete lines
nnoremap C cc
xnoremap C cc
nnoremap D dd
xnoremap D dd
" Enter visual block mode
map <A-v> <C-v>
" Indent keeping selection
xnoremap < <gv
xnoremap > >gv
xnoremap = =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
xnoremap p P
xnoremap P p
" Clear search highlights
nnoremap <Esc> :nohlsearch<Return><Esc>
" Show parameter info
nmap <A-p> <Action>(ParameterInfo)
imap <A-p> <Action>(ParameterInfo)
" Navigate back/forward
map <BS> <Action>(Back)
map <S-BS> <Action>(Forward)
" Navigate inspection highlights
map ( <Action>(GotoPreviousError)
map ) <Action>(GotoNextError)
" Navigate to previous/next method
map [[ <Action>(MethodUp)
map ]] <Action>(MethodDown)
" Navigate paragraphs at indentation
map { <Plug>(ParagraphPrevMotion)$
map } <Plug>(ParagraphNextMotion)$
" Manage editor tabs
map <C-w>m <Action>(MoveEditorToOppositeTabGroup)
map <C-w>s <Action>(MoveTabDown)
map <C-w>u <Action>(Unsplit)
map <C-w>U <Action>(UnsplitAll)
map <C-w>v <Action>(MoveTabRight)
noremap <C-w>S <C-w>s
noremap <C-w>V <C-w>v
map <C-w><C-w>a <Action>(CloseAllEditors)
map <C-w><C-w>h <Action>(CloseAllToTheLeft)
map <C-w><C-w>l <Action>(CloseAllToTheRight)
map <C-w><C-w>o <Action>(CloseAllEditorsButActive)
map \\ <C-w>
map \\\\ <C-w><C-w>
" Rebind repurposed commands
nnoremap M m
nnoremap Z z
" Repurpose 'Enter' for statement completion
nmap <Enter> <Action>(EditorCompleteStatement)
" Repurpose 'g' for navigation (VimJumpToSource requires a custom version of IdeaVIM)
map gb <Action>(GotoNextBookmark)
map gB <Action>(GotoPreviousBookmark)
map gD <Action>(GotoTypeDeclaration)
map ge <Action>(VcsShowNextChangeMarker)
map gE <Action>(VcsShowPrevChangeMarker)
map gf <Action>(VimJumpToSource)<Action>(HideActiveWindow)
map gi <Action>(GotoImplementation)
map gj <Action>(EditorCloneCaretBelow)
map gk <Action>(EditorCloneCaretAbove)
map gr <Action>(RecentLocations)
map gR <Action>(RecentChangedFiles)
map gs <Action>(GotoSuperMethod)
map gS <Action>(ShowSiblings)
map gt gg<Action>(KM.GotoNextTypeInFile)
map gT <Action>(KM.GotoNextTypeInFile)
map gu <Action>(ShowUsages)
map gU <Action>(FindUsages)
map g( <Action>(KM.GotoPreviousErrorInOtherMode)
map g) <Action>(KM.GotoNextErrorInOtherMode)
" Repurpose 'z' for view actions and debugger
map za <Action>(Annotate)
map zb <Action>(ViewBreakpoints)
map zc <Action>(EditorContextInfo)
map zd <Action>(CompareClipboardWithSelection)
map ze <Action>(ShowErrorDescription)
map zf <Action>(SelectInProjectView)
map zi <Action>(ShowHoverInfo)
map zm <Action>(ShowBookmarks)
map zp <Action>(QuickImplementations)
map zP <Action>(QuickTypeDefinition)
map zr <Action>(RunToCursor)
map zR <Action>(ForceRunToCursor)
map zs <Action>(osmedile.intellij.stringmanip.PopupChoiceAction)
map zt <Action>(ExpressionTypeInfo)
map zx <Action>(EvaluateExpression)
map zht <Action>(TypeHierarchy)
map zhm <Action>(MethodHierarchy)
if &ide =~? 'rider'
map zhc <Action>(RiderShowIncomingCalls)
else
map zhc <Action>(CallHierarchy)
endif
nmap zhl <Action>(LocalHistory.ShowHistory)
xmap zhl <Action>(LocalHistory.ShowSelectionHistory)
nmap zhg <Action>(Vcs.ShowTabbedFileHistory)
xmap zhg <Action>(Vcs.ShowHistoryForBlock)
" Repurpose 'm' for refactoring
map mc <Action>(IntroduceConstant)
map md <Action>(SafeDelete)
map me <Action>(Move)
map mf <Action>(IntroduceField)
map mg <Action>(Generate)
map mi <Action>(Inline)
map mm <Action>(ExtractMethod)
map mM <Action>(ExtractFunction)
map mn <Action>(RenameElement)
map mo <Action>(OverrideMethods)
map mp <Action>(IntroduceParameter)
map mP <Action>(IntroduceProperty)
map mr <Action>(Refactorings.QuickListPopupAction)
map ms <Action>(ChangeSignature)
map mS <Action>(NewScratchFile)
map mt <Action>(InsertLiveTemplate)
map mv <Action>(IntroduceVariable)
map mw <Action>(SurroundWith)
" Remap NERDTree bindings
let g:NERDTreeMapOpenVSplit = 'v'
let g:NERDTreeMapPreviewVSplit = 'gv'
let g:NERDTreeMapOpenSplit = 's'
let g:NERDTreeMapPreviewSplit = 'gs'
" Actions for custom version of AceJump
set acejump
map <Space> <Action>(AceVimAction_JumpAllEditors)
map g<Space> <Action>(AceVimAction_JumpAllEditors_GoToDeclaration)