Created
January 13, 2024 20:15
-
-
Save adeniyii/66feab0ae6d70f8b2bcf3578081045e8 to your computer and use it in GitHub Desktop.
dotfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mapleader = " " | |
set history=1000 | |
set number relativenumber | |
set idearefactormode=keep | |
set incsearch | |
set ideamarks | |
set ideajoin | |
set surround | |
set easymotion | |
set clipboard^=unnamedplus,unnamed | |
set clipboard+=ideaput | |
set multiple-cursors | |
set commentary | |
set argtextobj | |
set textobj-entire | |
set ReplaceWithRegister | |
set exchange | |
set NERDTree | |
set idearefactormode=keep | |
Plug 'machakann/vim-highlightedyank' | |
Plug 'tpope/vim-commentary' | |
""" -- Custom mappings -- | |
"""(Move between blocks) | |
"map J } | |
"map K { | |
map Q gq | |
map <C-n> <Plug>NextWholeOccurrence | |
"""normal mode (Switch to normal mode) | |
vmap i <Esc> | |
imap jj <Esc> | |
"""Join Lines | |
map <leader>j <Action>(EditorJoinLines) | |
""" Zen mode | |
nnoremap <c-z> :action ToggleDistractionFreeMode<CR> | |
""" Terminal | |
nnoremap <leader>t :action ActivateTerminalToolWindow<CR> | |
nnoremap <c-t> :action Terminal.OpenInTerminal<CR> | |
""" Navigation | |
nnoremap <c-/> :action SplitVertically<CR> | |
nnoremap <c--> :action SplitHorizontally<CR> | |
nnoremap <c-=> :action Unsplit<CR> | |
nnoremap <c-m> :action MoveEditorToOppositeTabGroup<CR> | |
""" Editing and Reloading the Config | |
nnoremap \e :e ~/.ideavimrc<CR> | |
nnoremap \r :action IdeaVim.ReloadVimRc.reload<CR> | |
sethandler <c-j> a:vim | |
sethandler <c-k> a:vim | |
"""Move between window splits | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
"""Indent then reselect the text that was just modified | |
vnoremap < <gv | |
vnoremap > >gv | |
""" Move between tabs | |
nnoremap <TAB> :action PreviousTab<CR> | |
nnoremap <s-TAB> :action NextTab<CR> | |
nnoremap <Leader>qq :action CloseContent<CR> | |
nnoremap <Leader>qa :action CloseAllUnpinnedEditors<CR> | |
nnoremap <leader>p :action PinActiveTabToggle<CR> | |
""" Move between buffers | |
""" Move between methods | |
nnoremap [[ :action MethodUp<CR> | |
nnoremap ]] :action MethodDown<CR> | |
""" Folding | |
nnoremap zc :action CollapseRegion<CR> | |
nnoremap zo :action ExpandRegion<CR> | |
nnoremap <leader>zc :action CollapseAllRegions<CR> | |
nnoremap <leader>zo :action ExpandAllRegions<CR> | |
""" Formatting | |
nnoremap <leader>c :action CommentByLineComment<CR> | |
noremap <leader>C :action CommentByBlockComment<CR> | |
nnoremap <leader>r :action Refactorings.QuickListPopupAction<CR> | |
nnoremap <Leader>= :action ReformatCode<CR> | |
nnoremap <leader>o :action OptimizeImports<CR> | |
""" Search files | |
nnoremap <leader>f :action RecentFiles<CR> | |
nnoremap <leader>l :action RecentLocations<CR> | |
nnoremap <leader>h :action LocalHistory.ShowHistory<CR> | |
""" Goto errors | |
nnoremap ge :action GotoNextError<CR> | |
nnoremap gE :action GotoPreviousError<CR> | |
""" Goto definitions | |
nnoremap g/ :action FindInPath<CR> | |
nnoremap <c-a> :action GotoAction<CR> | |
nnoremap <leader>u :action FindUsages<CR> | |
nnoremap <leader>s :action GotoRelated<CR> | |
nnoremap <leader>h :action CallHierarchy<CR> | |
nnoremap <leader>b :action ShowNavBar<CR> | |
nnoremap <leader>w :action ActivateProjectToolWindow<CR> | |
nnoremap <c-s> :action FileStructurePopup<CR> | |
nnoremap <c-o> :action GotoSymbol<CR> | |
nnoremap gc :action GotoClass<CR> | |
nnoremap gi :action GotoImplementation<CR> | |
nnoremap gd :action GotoDeclaration<CR> | |
nnoremap gp :action GotoSuperMethod<CR> | |
nnoremap gt :action GotoTest<CR> | |
nnoremap gb :action Back<CR> | |
nnoremap gB :action Forward<CR> | |
nnoremap gf :action GotoFile<CR> | |
nnoremap ga :action QuickActions<CR> | |
nnoremap gh :action ShowErrorDescription<CR> | |
"""New ... | |
nnoremap <leader>nn :action NewElement<CR> | |
nnoremap <leader>nd :action NewDir<CR> | |
nnoremap <leader>nf :action NewFile<CR> | |
nnoremap <leader>np :action NewProject<CR> | |
nnoremap <leader>nm :action NewModule<CR> | |
""" Plugin settings ------------------------- | |
let g:argtextobj_pairs="[:],(:),<:>" | |
let g:NERDTreeMapActivateNode='l' | |
let g:NERDTreeMapJumpParent='h' | |
"""cool fn to invert defined values | |
function! Invert(calledFromVisual) | |
let antonyms = ['true', 'false', 'after', 'before', 'start', 'end', 'left', 'right', 'first', 'last', | |
\'True', 'False', 'After', 'Before', 'Start', 'End', 'Left', 'Right', 'First', 'Last'] | |
if a:calledFromVisual | |
normal gv"wy | |
else | |
normal "wyiw | |
endif | |
let wordUnderCaret = @w | |
let eraseWord = a:calledFromVisual ? 'gvc' : 'ciw' | |
let count = 0 | |
while (count < len(antonyms)) | |
if (antonyms[count] ==# wordUnderCaret) | |
let antonym = (count % 2 ==? 0) ? antonyms[count + 1] : antonyms[count - 1] | |
execute 'normal ' .. eraseWord .. antonym | |
break | |
endif | |
let count += 1 | |
endwhile | |
endfunction | |
nnoremap ! :call Invert(0)<CR> | |
vnoremap ! :<C-u>call Invert(1)<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment