Skip to content

Instantly share code, notes, and snippets.

@xanthalas
Last active July 12, 2022 08:14
Show Gist options
  • Save xanthalas/0489378ae5c2d8d342a1d36496412508 to your computer and use it in GitHub Desktop.
Save xanthalas/0489378ae5c2d8d342a1d36496412508 to your computer and use it in GitHub Desktop.
IdeaVim settings used in Rider
" Useful shortcuts:
"
" Alt-Left/Right Previous/Next tab
"
"
"
"
set ignorecase "Normal searches are not case sensitive
set smartcase "Over-ride case-insensitivity if the search string contains an upper case char
set hlsearch "switch off with nohlsearch
set nowrapscan "Stop search from wrapping at end of file
set incsearch "Switch on incremental searching
set clipboard=unnamed " VimTip 21: easy pasting to windows apps <http://vim.sf.net/tips/tip.php?tip_id=21> yank always copies to unnamed register, so it is available in windows clipboard for other applications.
let mapleader = "\"
set ideajoin
set ignorecase
set smartcase
set visualbell
set easymotion
set nowrap "Disable text wrapping
set scrolloff=0
"Map the key combinations hh, kk and jj to issue an escape when hit in insert mode
imap jj <ESC>
imap hh <ESC>
imap kk <ESC>
"Map arrow keys to NOP in normal mode
"nnoremap <Up> <esc>
"nnoremap <Down> <esc>
"nnoremap <Left> <esc>
"nnoremap <Right> <esc>
"Map 0 to go to the first character of the line
nnoremap 0 g^
nnoremap ]b gt
nnoremap [b gT
nnoremap [H :set hlsearch<CR>
nnoremap ]H :set hlsearch<CR>
nnoremap ]h :set nohlsearch<CR>
nnoremap [h :set nohlsearch<CR>
nnoremap <space> :
nnoremap <leader>\ $
nnoremap <leader>. diwhxi.
nnoremap <leader>cc :action CommentByLineComment<cr>
nnoremap <leader>cu :action CommentByLineComment<cr>
nnoremap [d $bf<space>D
nnoremap ]d $bf<space>D
nnoremap <leader>d $d0x
nnoremap <leader>. F.2cw.
nnoremap <leader>p viwp
nnoremap <leader>P viwpyiw
nnoremap s :action AceAction<cr>
nnoremap <leader>v :vsplit<enter>
nnoremap <leader>e :action ReSharperGotoNextErrorInSolution<cr>
nnoremap <leader>a viw"ap
nnoremap <leader>q :action ParameterInfo<cr>
nnoremap <leader>r :action RenameElement<cr>
nnoremap <leader>ur :action RiderUnitTestRunContextAction<cr>
nnoremap <leader>ud :action RiderUnitTestDebugContextAction<cr>
nnoremap <leader>x :action CloseAllUnpinnedEditors<cr>
nnoremap <leader>t :action PinActiveTabToggle<cr>
nnoremap <leader>s <A-1>
nnoremap <leader>z :action ToggleZenMode<cr>
nnoremap <leader>" i"<esc>ea"<esc>
nnoremap <leader>b :s/( /(/g<cr>
"Mappings for window management
"nnoremap <leader>wf :vsc Edit.FindInFilesTeam.Git.GoToGitChanges<cr>
nnoremap <leader>wc :action Unsplit<cr>
nnoremap <leader>wg :action ActivateCommitToolWindow<cr>
nnoremap <leader>wm :action MoveEditorToOppositeTabGroup<cr>
nnoremap <leader>ws :action LocateInSolutionView<cr>
nnoremap <leader>wu :action ActivateUnitTestsToolWindow<cr>
nnoremap <leader>ww :action HideAllWindows<cr>
"Mappings for debugger
nmap <leader>n :action StepOver<CR>
nmap <leader>i :action StepInto<CR>
nmap <leader>o :action StepOut<CR>
nmap <leader>g :action RunToCursor<CR>
nmap <leader>9 :action EvaluateExpression<cr>
nnoremap diq di"
nnoremap ciq ci"
nnoremap viq vi"
nnoremap yiq yi"
nnoremap daq da"
nnoremap caq ca"
nnoremap vaq va"
nnoremap yaq ya"
nnoremap gc <C-k><C-c>
vnoremap <leader>cc :action CommentByLineComment<cr>
vnoremap > >gv
vnoremap < <gv
nmap <leader>; A;<esc>
nmap <leader>, A,<esc>
inoremap <leader>; <esc>myA;<esc>`ya
inoremap <leader>, <esc>myA,<esc>`ya
"Insert mode mappings
inoremap <leader>q <esc>:action ParameterInfo<cr>a
imap !- <esc>xa !=
"imap ### <esc>a != null) { <enter>
"Disable some dangerous keys
nmap ZZ <nop>
set clipboard+=ideaput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment