Skip to content

Instantly share code, notes, and snippets.

@KudoLayton
Last active December 20, 2024 14:52
Show Gist options
  • Save KudoLayton/b85a4edda8ef913213a9443749074d33 to your computer and use it in GitHub Desktop.
Save KudoLayton/b85a4edda8ef913213a9443749074d33 to your computer and use it in GitHub Desktop.
ideavimrc setup
" .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 hlsearch
"Which key
set which-key
"Quick Scope
set quickscope
" Relative & Number
set nu
set rnu
" Don't use Ex mode, use Q for formatting.
map Q gq
let mapleader = ' '
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Highlight copied text
Plug 'machakann/vim-highlightedyank'
" Commentary plugin
Plug 'tpope/vim-commentary'
" Surround
Plug 'tpope/vim-surround'
"Nerd tree
Plug 'preservim/nerdtree'
"" -- 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 <leader>b <Action>(ToggleLineBreakpoint)
"" Telescope like action
map <leader>ss <Action>(GotoSymbol)
map <leader>sf <Action>(GotoFile)
map <leader>sg <Action>(FindInPath)
"" Distraction Free Mode!!
function! ToggleDFMode()
:action ToggleDistractionFreeMode
set nu
set rnu
endfunction
nnoremap <leader>cd :call ToggleDFMode()<CR>
"" NERDTree
nnoremap <leader>nn :NERDTreeToggle<CR>
nnoremap <leader>nN :NERDTree<CR>
nnoremap <leader>nc :NERDTreeClose<CR>
"" Open In Terminal
map <leader>t <Action>(Terminal.OpenInTerminal)
"" Copy word under current cursor and put on substitute ex-command
"nmap <leader>* viwy \| :%s/\<<c-r>+\>//g<left><left>
"" Recent Files
map <leader>? <Action>(RecentFiles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment