Skip to content

Instantly share code, notes, and snippets.

@jaimemahaffey
Last active July 13, 2024 02:17
Show Gist options
  • Save jaimemahaffey/8ec6245f8238fd879800458a5b32cb8c to your computer and use it in GitHub Desktop.
Save jaimemahaffey/8ec6245f8238fd879800458a5b32cb8c to your computer and use it in GitHub Desktop.
"" IdeaVimRc for Rider with Plugins
" .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
" Clear key mapping
set visualbell
set number
set relativenumber
set clipboard=unnamed
set ignorecase
nnoremap % <Action>(GoToBrace)
let mapleader=","
packadd matchit " Extended matching. Supports % (matching motion) and g% (reverse motion)
"Plug 'easymotion/vim-easymotion' " Requires IdeaVim-EasyMotion. Lots of mappings
Plug 'kana/vim-textobj-entire' " entire buffer text object: ae
Plug 'machakann/vim-highlightedyank'
Plug 'terryma/vim-multiple-cursors' " See below for remapped keys. <A-n> doesn't work on Mac
Plug 'tommcdo/vim-exchange' " cx{motion} to select, again to exchange
"Plug 'tpope/vim-commentary' " [count]gc{motion}, o_gc, v_gc, gcc
"Plug 'tpope/vim-surround' " ys, cs, ds, S
Plug 'vim-scripts/argtextobj.vim' " argument text objects: aa, ia
Plug 'vim-scripts/ReplaceWithRegister' " [count][{reg}]gr{motion}, [count][{reg}]grr, {Visual}[{reg}]gr
set which-key
set notimeout
set commentary
set surround
set easymotion
"" -- 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
nnoremap <leader><space> :nohlsearch<CR>
" Do incremental searching.
set incsearch
" Don't use Ex mode, use Q for formatting.
map Q gq
map <leader>vr <action>(IdeaVim.ReloadVimRc.reload)
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
map <leader>fc <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)
" [ReSharper Documentation](https://www.jetbrains.com/help/resharper/)
" Get rid of this super annoying "-- VISUAL -- and External edit detected (hit <Esc> to return to previous mode, <C-c> to cancel external edit) cycle"
" v_CTRL-C: In Visual mode: Stop Visual mode. When insert mode is pending (the mode message shows "-- (insert) VISUAL --"), it is also stopped.
vnoremap <Esc> <C-c>
" # Folding #
" zf, zF: create
" zd: delete
" zo, zO: open / open recursively
" zc, zC: close / close recursively
" zR: open all folds
" zM: Close all folds
nnoremap <Leader>zd <action>(RiderCollapseToDefinitions)
nmap <Leader>zo <action>(ExpandRegion)
nmap <Leader>zO <action>(ExpandRegionRecursively)
nmap <Leader>zc <action>(CollapseRegion)
nmap <Leader>zC <action>(CollapseRegionRecursively)
" == Coding Assistance ==
" Show action list: Alt+Enter
nnoremap <Leader>a <Action>(ShowIntentionActions)
vnoremap <Leader>a <Action>(ShowIntentionActions)
" == Refactor == "
nmap <Leader>rr <Action>();
" Generate code: Alt+Insert
nnoremap <Leader>ng :vsc ReSharper.ReSharper_Generate<CR>
" Insert live template: Ctrl+J
nnoremap <Leader>ni :vsc ReSharper.ReSharper_LiveTemplatesInsert<CR>i
" Surround with template: Alt+Ctrl+J
map <Leader>ns <Action>(SurroundWith)
"vnoremap <Leader>ns <Action>(SurroundWith)
map <leader>h <Action>(Vcs.ShowTabbedFileHistory)
map <leader>f <Plug>(easymotion-s)
map <leader>e <Plug>(easymotion-f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment