Productivity boost with the keyboard in Visual Studio Code
Tags: productivity
Published: 2019-12-16 09:42:57

<a href="https://www.buymeacoffee.com/peacefullatom" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

The keyboard keeps you more productive if you have to handle a lot of text every day.

It doesn't matter much what the text represents: code, post, note, etc.

In this article, I want to share hotkeys that I'm using daily while working in the Visual Studio Code.

> Worth to note, that the list of shortcuts is available by this combination _Ctrl + K_ _Ctrl + S_.

## Spread cursor selection over several lines

| Shortcut Windows          | Shortcut Mac | Effect           |
| ----------------- |-| ---------------- |
| Ctrl + Alt + Up   |Option + Command + Up| Add cursor above |
| Ctrl + Alt + Down |Option + Command + Down| Add cursor below |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ksazcjiihng5so72ht25.gif 'Select and edit two strings via Ctrl + Alt + Down')

## Select entries starting from the word under the cursor

| Shortcut Windows          | Shortcut Mac | Effect           |
| -------- |-| -------------------------------- |
| Ctrl + D |Command + D| Add Selection To Next Find Match |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/s975tq4k7trxspjkrpp2.gif 'Select and edit matches via Ctrl + D')

## Change all occurrences of the word under the cursor

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + F2 |Command + F2| Change All Occurrences |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/kvoukarl1n1900uippj1.gif 'Change all occurrences via Ctrl + F2')

## Tell editor to treat document in the selected format

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + K M |Command + K M| Change Language Mode |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ubd069044ig4ohnudxjf.gif 'Change language mode via Ctrl + K M')

## Copy active line up or down without altering the clipboard

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Shift + Alt + Down |Shift + Option + Down| Copy Line Down |
| Shift + Alt + Up   |Shift + Option + Up| Copy Line Up   |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/9r322528cyvnmrhs4mpj.gif 'Copy lines via Shift + Alt + Down')

## Delete line without altering the clipboard

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + Shift + K |Command + Shift + K| Delete Line |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/iviyj9uwz2wncbfz57gs.gif 'Delete line via Ctrl + Shift + K')

## Move focus to the open editors' view

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + K E |Command + K E| Focus On Open Editors View |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jn8vcn5a0bckkun1ugr3.gif 'Select editor via Ctrl + K E')

## Compare file with the clipboard

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + K C |Command + K C| Compare Active File With Clipboard |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1wyf9x2qhi5pbsoirvx4.gif 'Compare file with clipboard via Ctrl + K C')

## Fast navigation within the file

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + Shift + . |Command + Shift + .| Focus Breadcrumbs |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rb6ai4oxofz7qnd2sizx.gif 'Fast navigation within the file via Ctrl + Shift + .')

## Fold/unfold section

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + Shift + [  |Option + Command + [| Fold       |
| Ctrl + Shift + ]  |Option + Command + ]| Unfold     |
| Ctrl + K Ctrl + 0 |Command + K Command + 0| Fold All   |
| Ctrl + K Ctrl + J |Command + K Command + J| Unfold All |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vknspu5cpyhd92qy6uo5.gif 'Folding capabilities')

## Format document/section

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Shift + Alt + F   |Shift + Option + F| Format Document |
| Ctrl + K Ctrl + F |Command + K Command + F| Format Section  |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ca8ssi3k0rd8vsdfh1rg.gif 'Format document via Shift + Alt + F')

## Go to matching bracket

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + Shift + \ | Command + Shift + \ | Go To Bracket |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/v2xfjhzue4doatbeuvnm.gif 'Jump to matching bracket via Ctrl + Shift + \ ')

## Move line up/down

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Alt + Up   |Option + Up| Move line up   |
| Alt + Down |Option + Down| Move line down |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/a72btwgh7tj5pmf01hl9.gif 'Move lines up and down')

## Rename symbol globally

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| F2       |F2| Rename symbol |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/c2drk6e7rzvbzzbpcv8n.gif 'Rename symbol via F2')

## Toggle terminal

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + ` | Control + ` | Toggle Integrated Terminal |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6g8rata10cm4fwcn7bec.gif 'Toggle terminal via Ctrl + `')

## Split terminal and switching between terminals (updated)

| Shortcut Windows      |Shortcut Mac     | Effect           |
| ---------| ---------------------- |-|
| Ctrl + Shift + 5 |Command + \ | Split Terminal      |
| Alt + Up         |Option + Command + Up| Focus Previous Pane |
| Alt + Left       |Option + Command + Left| Focus Previous Pane |
| Alt + Down       |Option + Command + Down| Focus Next Pane     |
| Alt + Right      |Option + Command + Right| Focus Next Pane     |

> Thanks to [fernandomaia](https://dev.to/fernandomaia) and [einav7](https://dev.to/einav7) I've got shortcuts for the Mac!

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/y6yokh0xudk8wnpw3c4y.gif 'Split terminal and switching between two terminals')

## Create a new terminal

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + Shift + ` | Control + Shift + `|Create New Integrated Terminal |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/9djtuetwy1q56rgo7n20.gif 'Create new terminal via Ctrl + Shift + `')

## Split/move editor

| Shortcut Windows          | Shortcut Mac | Effect           |
| --------- |-| ---------------------- |
| Ctrl + \           |Command + \ | Split Editor                             |
| Shift + Alt + 0    |Option + Command + 0| Toggle Vertical/Horizontal Editor Layout |
| Ctrl + Alt + Left  |Command + K Shift + Command + Left| Move Editor Into Previous Group          |
| Ctrl + Alt + Right |Command + K Shift + Command + Right| Move Editor Into Next Group              |

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/q4ulfdhn6ca9cl3978qm.gif 'Split/move editor')

## Conclusion

I hope that these shortcuts will help to boost your productivity as they are helping me.

All examples are given for the Windows-compatible keyboard, but they will also work on Mac. Simply replace Alt with Option and Ctrl with Control.

If you know some other helpful shortcuts, please, feel free to share them in the comments!

> Want to know how I've drawn the cover image? Check this article.

{% post peacefullatom/the-3d-keyboard-made-with-css-and-javascript-280 %}