Category Archives

50 Articles

Visual Studio Tips

Vim Took over VSCode Keybindings

Posted by matteskolin on

I enjoy using vim in VSCode and VS Proper, however, getting all the keyboard commands to meld between vim and the IDE can be a challenge. I was working the other day trying to do something as simple as find text in the current open file. Cntl + F for find right? Wrong, because in vim Cntl + F is advance forward through the file.

I could use a vim command for find such as ‘/’, but I am so used to Cntl + F, that I wanted to use this instead.

Actually, it turns out for me, most of the vim control key bindings are not important for me, but the normal control bindings are quite critical (copy and paste, select all, find, etc)

In VSCode, there is a setting for Vim to to tell it what keys not to handle. Adding this below to my settings.json greatly improved my workflow in VSCode, while allowing me to continue to use vim.

    "vim.handleKeys":{
      "<C-k>":false,
      "<C-a>":false,
      "<C-t>":false,
      "<C-f>":false,
      "<C-c>":false,
      "<C-v>":false
    },

For more details, see Vim extension documentation.

https://marketplace.visualstudio.com/items?itemName=vscodevim.vim

Visual Studio Tips

Useful VS Code Shortcuts

Posted by matteskolin on

I am really enjoying digging deeper into using Visual Studio Code. Here are some shortcuts that I have started using much more in my workflow.

F8 – Go To Next Problem

Also accessible from the window toolbar via Go -> Next Problem, This is very useful for quickly navigating through all errors after a build. Shift + F8 Will go to the previous problem

Control + Shift + b + Enter – Builds Project

This should build a project that has a build task defined in tasks.json. I’m still trying to figure out how to get this to happen without he need to hit the Enter key at the end of the sequence.

F2 – Rename Method

This is a wonderful way to rename a method or variable, as this is the command we are used to when renaming files and folders in Windows. It doesn’t require opening any menus, refactoring tools, or other complicated key combination. Try it out!

Alt + and Alt + = Navigate Forward and Backward

This is the equivalent of the Visual Studio proper Control Plus and Control -. I find the alt way of doing this more intuitive because this uses the arrow keys.