Skip to content

Instantly share code, notes, and snippets.

@Sheepolution
Created February 6, 2019 12:59
Show Gist options
  • Save Sheepolution/f0b697569892749f4b6d21166a14d7f7 to your computer and use it in GitHub Desktop.
Save Sheepolution/f0b697569892749f4b6d21166a14d7f7 to your computer and use it in GitHub Desktop.
My VS Vim configurations for Visual Studio 2013 using ReSharper commands.
syntax on
set ignorecase
set smartcase
set hlsearch
set wrap
set number
set autoindent
set smartindent
set cursorline
set smarttab
set incsearch
set softtabstop=4 "go back one tab when hitting backspace(without this is goes back single space) -- Doesn't seem to work though?
set tabstop=4 "used by >>, << and tab.
set shiftwidth=4 "number of space characters used when displaying TAB
set expandtab "Replace tab by spaces
set encoding=utf-8
set clipboard=unnamed
" set laststatus=2 " Extra status bar but I have no idea why you would add it
nnoremap <C-Tab> gt
nnoremap <C-S-Tab> gT
inoremap <C-Tab> <Esc>gt
inoremap <C-S-Tab> <Esc>gT
vnoremap <C-Tab> <Esc>gt
vnoremap <C-S-Tab> <Esc>gT
inoremap <C-j> <Esc>
nnoremap <C-j> <NOP>
inoremap <Esc> <NOP>
" Ctrl + Shift + k to move up
" Ctrl + Shift + j to line down
" nnoremap <C-S-k> kddp
" nnoremap <C-S-j> ddp
" U for redo
nnoremap U <C-r>
" gr for replace visualized with yank
vnoremap gr "_dP
" J and K for fast movement
nnoremap J 10j
nnoremap K 10k
" Shift + q for visual block mode
nnoremap Q <C-v>
" Return to the original word when searching for words
nnoremap * *N
" Turn >> and << into < >
nnoremap > >>
nnoremap < <<
" Keep VISUAL when indenting
vnoremap < <gv
vnoremap > >gv
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
" Have x not copy to clipboard (you can use d for that)
nnoremap x "_x
vnoremap x "_x
nnoremap X "_X
vnoremap X "_X
" Make Y yank till end of line
nnoremap Y y$
" gl for going back to latest edited line.
nnoremap gl `.
nnoremap gL '.
" ctrl + o for inserting a new line
nnoremap <C-o> o<Esc>k
" nnoremap <C-S-o> O<Esc>
" Y in visual mode to keep visual
vnoremap Y ygv
" zi adds space
nnoremap <space>i i<space><Esc>i
" g; and g, to go back and forth changes. (ctrl + -)
nnoremap g; :vsc View.NavigateForward<CR>
nnoremap g, :vsc View.NavigateForward<CR>
" gn/gN for go to next/previous panel
nnoremap gn :vsc Window.NextPane
nnoremap gN :vsc Window.PreviousPane
" go for navigator
nnoremap go :vsc Window.NextToolWindowNav
" gb goes to last edit project wide (so doesn't matter if you're in a different tab).
nnoremap gb :vsc ReSharper.ReSharper_GotoLastEditLocation<CR>
" ( and ) for prev/next method
nnoremap ) :vsc ReSharper.Resharper_GotoNextMethod<CR>
nnoremap ( :vsc ReSharper.Resharper_GotoPrevMethod<CR>
" shift + '+'/'_' for increasing/decreasing number.
nnoremap + <C-a>
nnoremap _ <C-x>
" gf for AceJump
nnoremap gf :vsc Tools.InvokeAceJumpCommand<CR>
vnoremap gf :vsc Tools.InvokeAceJumpCommand<CR>
" Better wrap navigation
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
" Surround with gs
nnoremap gs :vsc Resharper.Resharper_SurroundWith<CR>
vnoremap gs :vsc Resharper.Resharper_SurroundWith<CR>
" <leader>s for svn commands
nnoremap <leader>sb :vsc TSVN.Blame<CR>
nnoremap <leader>sl :vsc TSVN.ShowLog<CR>
nnoremap <leader>sL :vsc TSVN.ShowLogforfile<CR>
nnoremap <leader>sd :vsc TSVN.ShowDifferences<CR>
nnoremap <leader>su :vsc TSVN.Update<CR>
nnoremap <leader>sc :vsc TSVN.Commit<CR>
" <leader>r for replace paste
nnoremap <leader>rw "_diwP
nnoremap <leader>rW "_diWP
nnoremap <leader>rr "_ddP
" Hide highlighting by pressing ESC twice
nnoremap <Esc><Esc> /!#@$%123#@%^<CR><Esc>
vnoremap <Esc><Esc> /!#@$%123#@%^<CR><Esc>
inoremap <Esc><Esc> <Esc>/!#@$%123#@%^<CR><Esc>i
" Enter for adding new line without going to next line
nnoremap <S-Enter> O<Esc>
nnoremap <CR> o<Esc>
nnoremap <C-S-Enter> O<Esc>j
nnoremap <C-CR> o<Esc>k
"Make ' and ` work with Dutch keyboard settings
nmap à `a
nmap á 'a
nmap Á 'A
nmap À `A
nmap ç 'c
nmap Ç 'C
nmap é 'e
nmap è `e
nmap É 'E
nmap È `E
nmap í 'i
nmap ì `i
nmap Í 'I
nmap Ì `I
nmap ó 'o
nmap ò `o
nmap Ó 'O
nmap Ò `O
nmap ú 'u
nmap ù `u
nmap Ú 'U
nmap Ù `U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment