Skip to content

Instantly share code, notes, and snippets.

@sakurawald
Created November 27, 2023 00:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakurawald/4ebbcbec427facb3239575fe59ceb83f to your computer and use it in GitHub Desktop.
Save sakurawald/4ebbcbec427facb3239575fe59ceb83f to your computer and use it in GitHub Desktop.
" vim settings
set scrolloff=5
set history=1000
" status bar
set showmode
" find and replace
set hlsearch
set incsearch
set ignorecase
set smartcase
set gdefault
map <leader>nh :noh<CR>
" ideavim settings
set ideajoin
set ideamarks
set idearefactormode=normal
set ideastatusicon=gray
" leader
map <space> <nop>
let mapleader="\<space>"
" better HJKL
map H ^
map L $
map J }
map K {
" better escape
inoremap jk <Esc>
" location
map <C-i> <Action>(Back)
map <C-o> <Action>(Forward)
" editor
map <leader>xx <Action>(CloseContent)
map <leader>xa <Action>CloseAllEditors)
map <leader>xo <Action>(CloseAllEditorsButActive)
map <leader>xp <Action>(CloseAllUnpinnedEditors)
" tab
map <C-Tab> <Action>(PreviousTab)
map <Tab> <Action>(NextTab)
map <leader>p <Action>(PinActiveEditorTab)
map <leader>1 <Action>(GoToTab1)
map <leader>2 <Action>(GoToTab2)
map <leader>3 <Action>(GoToTab3)
map <leader>4 <Action>(GoToTab4)
map <leader>5 <Action>(GoToTab5)
map <leader>6 <Action>(GoToTab6)
map <leader>7 <Action>(GoToTab7)
map <leader>8 <Action>(GoToTab8)
map <leader>9 <Action>(GoToTab9)
" window
map <leader>sh <Action>(MoveTabLeft)
map <leader>sj <Action>(MoveTabDown)
map <leader>sk <Action>(MoveTabUp)
map <leader>sl <Action>(MoveTabRight)
map <leader>sH <Action>(SplitHorizontally)
map <leader>sV <Action>(SplitVertically)
map <C-p> <Action>(JumpToLastWindow)
map <M-i> <Action>(PrevSplitter)
map <M-o> <Action>(NextSplitter)
map <C-k> <C-w>k
map <C-j> <C-w>j
map <C-h> <C-w>h
map <C-l> <C-w>l
map <leader>ww <Action>(HideAllWindows)
nmap <leader>wk <Action>(StretchSplitToTop)
nmap <leader>wj <Action>(StretchSplitToBottom)
nmap <leader>wh <Action>(StretchSplitToLeft)
nmap <leader>wl <Action>(StretchSplitToRight)
map <leader>wm <Action>(MaximizeEditorInSplit)
map <leader>wu <Action>(UnsplitAll)
" menu
map <leader>mm <Action>(MainMenu)
map <leader>ma <Action>(AnalyzeMenu)
map <leader>mb <Action>(BuildMenu)
map <leader>mc <Action>(CodeMenu)
map <leader>mf <Action>(FindMenuGroup)
map <leader>mg <Action>(GoToMenu)
map <leader>ms <Action>(ScopeViewPopupMenu)
map <leader>mt <Action>(EditorTabPopupMenu)
map <leader>mw <Action>(ToolWindowsGroup)
" file
map <leader>of <Action>(OpenFile)
map <leader>yp <Action>(CopyAbsolutePath)
map <leader>rf <Action>(RecentFiles)
map <leader>rl <Action>(RecentLocations)
map <leader>rp <Action>(ManageRecentProjects)
map <leader>sh <Action>(LocalHistory.ShowHistory)
map <leader>sf <Action>(ShowFilePath)
map <leader>si <Action>(SelectIn)
nmap \\fp <Action>(FindInPath)
nmap \\rp <Action>(ReplaceInPath)
map \\sw <Action>($SearchWeb)
" tag
map <leader>fu <Action>(FindUsages)
map <leader>fs <Action>(FileStructurePopup)
map <leader>su <Action>(ShowUsages)
map <leader>hl <Action>(HighlightUsagesInFile)
map <leader>qp <Action>(QuickPreview)
map <leader>qd <Action>(QuickDefinition)
map <leader>qD <Action>(QuickTypeDefinition)
" code
map <leader>c <Action>(CommentByLineComment)
map <leader>C <Action>(CommentByBlockComment)
map <leader>qf <Action>(ShowIntentionActions)
map <leader>g <Action>(ShowErrorDescription)
map <leader>om <Action>(OverrideMethods)
map <leader>im <Action>(ImplementMethods)
nmap \\o <Action>(SelectAllOccurrences)
nmap \\g <Action>(Generate)
nmap \\fc <Action>(ReformatCode)
nmap \\ic <Action>(InspectCode)
nmap \\t <Action>(GoToTest)
" run
map <leader>rc <Action>(ContextRun)
map <leader>rx<Action>(chooseRunConfiguration)
map <leader>rr <Action>(Rerun)
map <leader>rt <Action>(RunTests)
map <leader>rs <Action>(Stop)
" debug
map <leader>dc <Action>(ContextDebug)
map <leader>dx <Action>(Debug)
map <leader>db <Action>(ToggleLineBreakpoint)
map <leader>de <Action>(EditBreakpoint)
map <leader>dv <Action>(ViewBreakpoints)
" build
map <leader>bb <Action>(BuildMenu)
" refactor
map <leader>rn <Action>(RenameElement)
map <leader>re <Action>(Refactorings.QuickListPopupAction)
map <leader>uw <Action>(Unwrap)
map <leader>sw <Action>(SurroundWith)
map <leader>sd <Action>(SafeDelete)
map <leader>oi <Action>(OptimizeImports)
" hierarchy
nmap <leader>hc <Action>(CallHierarchy)
nmap <leader>hm <Action>(MethodHierarchy)
nmap <leader>ht <Action>(TypeHierarchy)
" collapse
map zz <Action>(ExpandCollapseToggleAction)
map za <Action>(CollapseAllRegions)
map zA <Action>(ExpandAllRegions)
" zen
map <leader>z <Action>(ToggleZenMode)
" []
nmap [g <Action>(GotoPreviousError)
nmap ]g <Action>(GotoNextError)
nmap [u <Action>(GotoPrevElementUnderCaretUsage)
nmap ]u <Action>(GotoNextElementUnderCaretUsage)
nmap [o <Action>(PreviousOccurence)
nmap ]o <Action>(NextOccurence)
nmap [m <Action>(MethodUp)
nmap ]m <Action>(MethodDown)
nmap [c <Action>(JumpToLastChange)
nmap ]c <Action>(JumpToNextChange)
" goto
map <leader>a <Action>(GotoAction)
map ga <Action>(GotoAction)
map gc <Action>(GotoClass)
map gf <Action>(GotoFile)
map gs <Action>(GotoSymbol)
map gt <Action>(GoToTest)
map gT <Action>(TextSearchAction)
map go <Action>(GotoSuperMethod)
map gd <Action>(GotoDeclaration)
map gD <Action>(GotoTypeDeclaration)
map gi <Action>(GotoImplementation)
map gI <Action>(QuickImplementations)
map gn <Action>(ShowNavBar)
" terminal
map <leader>tt <Action>(ActivateTerminalToolWindow)
map <leader>tc <Action>(Terminal.OpenInTerminal)
" bookmark
nmap mm <Action>(ToggleBookmark)
nmap ms <Action>(ShowBookmarks)
" todo
map <leader>to <Action>(ActivateTODOToolWindow)
" task
map <leader>ts <Action>(tasks.goto)
" idea join
map \\jl <Action>(EditorJoinLines)
" gist
map \\cg <Action>(Github.Create.Gist)
" vcs
map <leader>v <Action>(VcsGroups)
" open IdeaVim settings
map \\v <Action>(VimActions)
" text-object (bundle plugin)
set vim-paragraph-motion
set textobj-indent
set textobj-entire
set argtextobj
" jump-motion (required idea plugin: IdeaVim-EasyMotion, AceJump)
set easymotion
" highlight yank (bundle plugin)
set highlightedyank
let g:highlightedyank_highlight_duration = "1000"
let g:highlightedyank_highlight_color = "rgba(57, 197, 187, 155)"
" translation (required idea plugin: Translation)
nmap \\tt <Action>($ShowTranslationDialogAction)
nmap \\ts <Action>($TranslateTextComponent)
nmap \\ti <Action>($InclusiveTranslateAction)
nmap \\te <Action>($ExclusiveTranslateAction)
" string manipulate (required idea plugin: String Manipulation)
map \\ss <Action>(osmedile.intellij.stringmanip.PopupChoiceAction)
" code screenshot (required idea plugin: Code Screenshots)
map \\cs <Action>(one.util.ideaplugin.screenshoter.CopyImageAction)
" surround (bundle plugin)
" usage: https://github.com/tpope/vim-surround
set surround
" exchange (bundle plugin)
" usage: https://github.com/tommcdo/vim-exchange
set exchange
" nerdtree (bundle plugin)
set NERDTree
" replace with register (bundle plugin)
" usage: https://github.com/vim-scripts/ReplaceWithRegister
set ReplaceWithRegister
" alias
map U <C-r>
map <C-a> ggVG"+y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment