Skip to content

Instantly share code, notes, and snippets.

@xanthalas
Last active June 17, 2021 09:14
Show Gist options
  • Select an option

  • Save xanthalas/d341edb0e22d6b326908096923a17cd6 to your computer and use it in GitHub Desktop.

Select an option

Save xanthalas/d341edb0e22d6b326908096923a17cd6 to your computer and use it in GitHub Desktop.
vsvimrc for VS Vim on Visual Studio
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 ignorecase
set smartcase
set visualbell
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 g0 to go to the first character of the line - g0 doesn't work in VSVim
nnoremap g0 g^
nnoremap ]b gt
nnoremap [b gT
nnoremap [h :noh<CR>
nnoremap ]h :noh<CR>
nnoremap <space> :
nnoremap <leader>\ $
nnoremap <leader>cc :vsc Edit.CommentSelection<cr>
nnoremap <leader>cu :vsc Edit.UncommentSelection<cr>
nnoremap <leader>d $blD
nnoremap <leader>. F.2cw
nnoremap <leader>p viwp
nnoremap <leader>v :vsplit<enter>
nnoremap <leader>e :vsc ReSharper.ReSharper_GotoNextErrorInSolution<cr>
nnoremap <leader>a viw"ap
nnoremap <leader>q :vsc Edit.ParameterInfo<cr>
nnoremap <leader>ur :vsc ReSharper.ReSharper_UnitTestRunFromContext<cr>
nnoremap <leader>ud :vsc ReSharper.ReSharper_UnitTestDebugContext<cr>
nnoremap <leader>x :vsc Window.CloseAllButPinned<cr>
"Mappings for debugger
nmap <leader>bb :vsc Debug.ToggleBreakpoint<CR>
nmap <leader>n :vsc Debug.StepOver<CR>
nmap <leader>i :vsc Debug.StepInto<CR>
nmap <leader>o :vsc Debug.StepOut<CR>
nmap <leader>g :vsc Debug.RunToCursor<CR>
nmap <leader>r :vsc Debug.Continue<CR>
nmap <leader>9 :vsc Debug.QuickWatch<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>
"Visual mode mappings
vnoremap <leader>cc :vsc Edit.CommentSelection<cr>
vnoremap <leader>cu :vsc Edit.UncommentSelection<cr>
vnoremap > >gv
vnoremap < <gv
nmap ;; A;<esc>
imap ;; <esc>A;<esc>
nmap ,, A,<esc>
imap ,, <esc>A,<esc>
"Insert mode mappings
inoremap <leader>q <esc>:vsc Edit.ParameterInfo<cr>a
imap !- <esc>xa !=
imap ### <esc>a != null) { <enter>
"Disable some dangerous keys
nmap ZZ <nop>
nmap s :vsc Tools.InvokeAceJumpCommand<cr>
nmap S :vsc Tools.InvokeAceJumpCommand<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment