Mac Visual Code Studio Shortcut For Commenting Out

Mac Visual Code Studio Shortcut For Commenting Out

Please complete the security check to access this website.

“CTR+K,C” for commenting “CTR+K,U” for uncommenting shortcuts are NOT useful, easier to click a button on a toolbar instead. Every developer comment / uncomment pieces of code quite often. Ctrl+K Ctrl+S Keyboard Shortcuts Basic editing. Ctrl+K Ctrl+C Add line comment Ctrl+K Ctrl+U Remove line comment Ctrl+/ Toggle line comment Shift+Alt+A Toggle block comment. F11 / Shift+F11 Step into/out F10 Step over Ctrl+K Ctrl+I Show hover Integrated terminal. Visual Studio Code keyboard Shortcuts helps developers maximize their productivity by allowing them to work faster and more efficiently. Here I am listing down all the keyboard shortcuts and cheats of Visual Studio Code editor for Windows, Mac and Linux Operating systems.

A complete list of all keyboard shortcuts in Visual Studio 2017. Run Code Analysison Solution. Step Out Shift+F11 Step Out Current Process. For python code, the 'comment block' command Alt + Shift + A actually wraps the selected text in a multiline string, whereas Ctrl + / is the way to toggle any type of comment (including a 'block' comment as asked here). (If you want an editor that does run natively, Xamarin Studio or Visual Studio Code might fit the bill). There are multiple options for running Windows on a Mac. Every Mac comes with Apple’s Boot Camp software, which helps you install Windows into a separate partition.

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Mac Visual Code Studio Shortcut For Commenting Out With Semicolon

As a developer, sometimes I am forced to use Visual Studio to code for Windows. Just like a lot of Mac developers, I therefore run Visual Studio in a VMWare Fusion VM. And it works great.

Visual Studio Code Shortcuts Mac

Except it drives me nuts that keyboard navigation in the Visual Studio editor does not use the same keys as on the Mac. Which means I am constantly seeing the window move around when I am trying to get to a line end. And even if I did remap my brain to Visual Studio’s keys, it assumes I have a Home and an End key to use, which the Mac mini wireless keyboard and laptops do not have.

I tried changing keys in Tools / Options / Environment / Keyboard but Visual Studio studiously ignores any shortcuts which use the Windows key which just happens to be the Command key on the Mac keyboard which just happens to be a commonly used shortcut for navigation on the Mac.

The solution I found is to install AutoHotKey on the VM and remap the Visual Studio keys you need. Here is my AutoHotKey script file so far:

I have set this up so the changes only apply to Visual Studio. All other Windows applications will remain unaffected. The SetTitleMatchMode is needed to make it so that the matcher sees the right title.

The #IfWinActive, Microsoft Visual Studio line means that all changes that follow until the next #IfWinActive apply only to Visual Studio windows.

Shortcut

My mapping changes are as follows:

  • ⌘→: Edit.LineEnd (Default windows key End, original behavior: Snap window to right of screen)
  • ⌘←: Edit.LineStart (Default windows key Home, original behavior: Snap window to left of screen) but I had to map this to ALT-← and change the mapping in Visual Studio (see below). This is because Windows 8 intercepts the Home key, minimizes all other windows and does not pass it on to Visual Studio.
  • ⌘↑: Edit.DocumentStart (Default windows key CTRL+HOME)
  • ⌘↓: Edit.DocumentEnd (Default windows key CTRL+END)
  • ⌘/: Edit.CommentSelection (Visual Studio CTRL+K,CTRL+C) mapped to ALT+/ and remapped in Visual Studio.
  • ⌥→: Edit.WordNext (Default windows key CTRL+RIGHT) but somehow this combination does not work on my system natively or adjusted.
  • ⌥←: Edit.WordPrevious (Default Windows key CTRL+LEFT) also not working.
  • ⌘b: Build.BuildSolution (Visual Studio CTRL-SHIFT-B) to match Xcode.
  • ⌘K: Build.CleanSolution (No key) Manually mapped to CTRL-SHIFT-M.

Some of these mappings require you to change the Visual Studio keys. To do so, go to Tools / Options / Environment / Keyboard.

First, find the key mapping you would like to change (See 1). In this case, I am remapping Edit.LineStart. You should see Home (Text Editor) under Shortcuts for selected command: (I have already changed mine).

To set the new shortcut, see 2:

  • Make sure that Text Editor is chosen under Use new shortcut in:
  • Press the shortcut key in the blank space and make sure that it gets shown correctly.
  • Click Assign to save it.

I have only just started using this solution, but already its 100% easier for me to navigate around my Visual Studio code files (and the window no longer jumps around).

If you try this out and find any other tricks, let me know in the comments and I’ll add the best ones here.

Back to coding in Visual Studio on a Mac!

Follow the author as @hiltmon on Twitter and @hiltmon on App.Net. Mute #xpost on one.