Skip to content

Instantly share code, notes, and snippets.

@phakeandy
Created February 8, 2025 13:27
Show Gist options
  • Save phakeandy/4866807ff7f66d63b077225c8057955f to your computer and use it in GitHub Desktop.
Save phakeandy/4866807ff7f66d63b077225c8057955f to your computer and use it in GitHub Desktop.
ideavim configuration file
" .ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching.
set incsearch
set ignorecase
set smartcase
set which-key
set visualbell
" set keep-english-in-normal " 输入法自动切换
" ---------------
" -- Key Mapping
" ---------------
let mapleader=" "
map <C-c> <Esc>
map Q gq " Don't use Ex mode, use Q for formatting.
map Y y$
vnoremap < <gv
vnoremap > >gv
nmap <leader>j <action>(NextTab)
nmap <leader>k <action>(PreviousTab)
nmap <leader>e <action>(ActivateProjectToolWindow)
" Rename
map <leader>rn <Action>(RenameElement)
" Go to code
nmap <leader>gd <Action>(GotoDeclaration)
nmap <leader>gy <Action>(GotoTypeDeclaration)
nmap <leader>gi <Action>(GotoImplementation)
nmap <leader>gu <Action>(ShowUsages)
nmap <leader>gt <Action>(GotoTest)
nmap <leader>gf <Action>(Back)
nmap <leader>gb <Action>(Forward)
let g:WhichKeyDesc_Format = "<leader>f Format"
nmap <leader>f <action>(ReformatCode) \| <action>(OptimizeImports)
vnoremap <C-c> "+y
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Highlight copied text
Plug 'machakann/vim-highlightedyank'
" Commentary plugin
Plug 'tpope/vim-commentary'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-surround'
Plug 'easymotion/vim-easymotion'
set timeoutlen=5000
"map <Leader><Leader> <Plug>(easymotion-prefix)
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)
"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" -- EasyMotion Config
let g:EasyMotion_do_mapping = 0
nmap s <Plug>(easymotion-bd-E)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment