Visual Studio

Table of Contents

Misc notes

Troubleshooting

  • Getting back sensible keyboard shortcuts, along with resharper:

    • Tools, Options, Keyboard, Reset the mapping Scheme
    • Then, trigger a Resharper shortcut
    • On the popup, e.g. <Ctrl-W>, choose to apply to all Resharper shortcuts
    • Resharper, Options, Keyboard, Use ReSharper/Idea shortcuts, apply scheme, Save
    • On a pop, e.g. <Alt-Up>, choose to apply to all Resharper shortcuts
  • To change formatting:

    • Tools, Options, Text Editor, C#, Formatting, New Lines

Useful shortcuts

Templates

  • outv gives System.Console.Out.WriteLine("$EXPR$ = {0}", $EXPR$);

Assistance

  • <C-q> brings up quick documentation
  • <C-p> brings up information about the method signature, with the cursor between parenthesis
  • <C-S-p> brings up the description of the method's signature
  • <Ctrl-Shift-Space> triggers smart code completion

Editing

  • <C-D> duplicates a line
  • <C-L> deletes a line
  • <C-X> cuts a line
  • <Ctrl-Alt-F> cleans up the code
  • <Ctrl-Shift-Alt-↑> moves current line up
  • <Ctrl-Shift-Alt-↓> moves current line down

Moving around

  • <Ctrl-Alt-L> goes to Solution Explorer
  • <Ctrl-Shift-L> goes to Solution Explorer, focuses on the currently focused file
  • <Ctrl-Alt-PageDown> goes to next tab
  • <Ctrl-Alt-PageUp> goes to previous tab
  • F12 goes to next error in file
  • <Shift-F12> goes to previous error in file
  • <Ctrl-Shift-F7> highlights usages in file
  • <Ctrl-Alt-Up> goes to previous usage location in file
  • <Ctrl-Alt-Down> goes to next usage location in file
  • <Ctrl-K>, <Ctrl-K> to create/delete a bookmark
  • <Ctrl-K>, <Ctrl-N> goes to next bookmark
  • <Ctrl-K>, <Ctrl-P> goes to previous bookmark

F# Workflow

  • Install F# PowerTools
  • The F# interactive window is open through View → Other windows → F# Interactive
  • <Alt-Enter> to get function signature in F# interactive
  • To enable renaming, one Resharper feature needs to be temporarily disabled: Resharper -> Options -> Keyboard and Menus -> Uncheck 'Hide overridden Visual Studio menu items

vsVimrc (Not using this anymore)

  • Vsvim is a nice vim plugin. To change the options, there is an options button below the text editor

  • Set <C-a> for vsvim behaviour

  • Set <C-c> for vsvim behaviour (back to normal)

  • Set <C-x> for vsvim behaviour

  • Set <C-w> for vsvim behaviour

  • :set shows the current settings that have been applied

Snippet of configuration used:

"BEHAVIOUR
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set backspace=indent,eol,start "allow backspacing over everything in insert mode
set incsearch "searches while typing
set hlsearch "highlights all matched words
:set number "This needs a colon for some reason

"searching
nnoremap <CR> :noh <CR><CR>

Non-Resharper shortcuts

  • <C-K><C-C> comments a line
  • <C-K><C-U> uncomments a line
  • <Ctrl-Space> triggers autocomplete
  • <Ctrl-\>, <Ctrl-E> triggers autocomplete
  • <Ctrl-G> triggers goto line
  • <Ctrl-K>, <Ctrl-I> brings up method information (quick documentation)