DEV Community

Bhavesh Yadav
Bhavesh Yadav

Posted on

Top Shortcuts in VS Code for Mac

πŸ‘‹ Hey there! I'm excited to share with you some of the top shortcuts in VS Code for Mac! These shortcuts are designed to make your coding experience faster and more efficient. So, let's dive in and explore these handy keyboard commands:

1. Command Palette: Cmd + Shift + P 🎨

The Command Palette is a powerful tool that allows you to access various features and commands in VS Code. Just press Cmd + Shift + P, and a search bar will appear at the top of your editor. From there, you can type in commands, settings, and even install extensions, making it incredibly useful for quickly accessing any functionality within VS Code.

2. Search Files: Cmd + Shift + F πŸ”

This shortcut opens up the "Search" view in VS Code, enabling you to search for specific words or phrases across your entire project. It's an efficient way to locate files and navigate through your codebase seamlessly.

3. Multiple Cursors: Cmd + Opt + ↓ / ↑ ⌨️

Multiple cursors are a fantastic feature in VS Code that allows you to edit multiple lines simultaneously. To use it, place your cursor where you want to start, then press Cmd + Opt + ↓ to add additional cursors below, or Cmd + Opt + ↑ to add cursors above. Now, you can make edits on multiple lines all at once, saving you valuable time and effort.

4. Delete the line: Cmd + Shift + K πŸ—‘οΈ

This shortcut is a quick way to delete the entire line where your cursor is placed. Simply press Cmd + Shift + K, and the line will be instantly removed. It's a handy command for decluttering or getting rid of unwanted code swiftly.

5. Copy Line Up/Down: Opt + Shift + ↓ / ↑ πŸ“‹

This shortcut allows you to duplicate lines, either above or below the current line. To copy the current line downwards, press Opt + Shift + ↓. To copy it upwards, press Opt + Shift + ↑. It's particularly useful for replicating code or rearranging lines within your file.

6. Preview Markdown: Cmd + Shift + V πŸ“

If you're working with Markdown files, this shortcut opens up a preview window to display the rendered version of your Markdown file. It helps you visualize how your Markdown will appear when rendered, without having to switch to a separate application.

7. Toggle Sidebar: Cmd + B πŸ“‚

Use this shortcut to toggle the visibility of the sidebar in VS Code. The sidebar contains helpful navigation and functionality options such as the file explorer, extensions, and search views. Press Cmd + B, and the sidebar will appear or disappear, providing you with more screen real estate for your code.

8. Rename Component: F2 πŸ’‘

When working with programming languages like JavaScript or TypeScript, where you have defined components or variables, this shortcut makes renaming them a breeze. Place your cursor on the name you want to change and press F2. You can then modify the name, and it will be updated throughout your entire codebase, ensuring consistency and saving you from manual search and replace operations.

9. Select Current Line: Cmd + L πŸ–±οΈ

This shortcut allows you to select the entire line where your cursor is located. It's a handy way to highlight a line quickly and perform actions such as copying, cutting, or deleting the selected line.

10. Toggle Terminal: Cmd + backtick (`) πŸ–₯️

By pressing Cmd + backtick (`), you can open or close the integrated terminal in VS Code. The terminal is a powerful tool that allows you to execute commands, run scripts, and interact with your project's environment directly from within the editor.

11. Format Document: Shift + Opt + F 🧹

This shortcut automatically formats your code according to the predefined code style, making it more readable and consistent. It's particularly valuable when collaborating with others or when working with large codebases.

12. Split Editor: Cmd + \ πŸ”„

When you need to view and work with multiple files simultaneously, this shortcut comes in handy. It splits the editor pane, allowing you to display two sets of code side by side. It's ideal for comparing files, referencing code snippets, or multitasking.

13. Search File: Cmd + P πŸ”Ž

This shortcut opens the "Go to File" feature in VS Code, enabling you to quickly navigate to a specific file by typing its name. It saves you from manually searching through your project's directory structure and provides a more efficient way to locate and open the file you need.

14. Select the current word: Cmd + D πŸ“Œ

By placing your cursor on a word and using Cmd + D, you can select subsequent occurrences of the same word in your code. It's a neat way to select and make changes to multiple instances of a word simultaneously.

These shortcuts in VS Code for Mac make it easier and more enjoyable to work with code, enhancing productivity and speeding up your workflow. Whether you're a seasoned developer or just getting started, incorporating these keyboard commands into your daily coding routine can greatly improve your efficiency and save you time and effort.

Happy coding! πŸ’»πŸš€


Hey there! I'm Bhavesh, an avid tech enthusiast and blogger. As a curious explorer of the latest technological trends, I love sharing my knowledge through informative tutorials and captivating tech blogs. Feel free to contact me anytimeβ€”I'm always ready to help! You can catch me on TwitterΒ hereΒ for exciting tech updates and engaging discussions. Need to get in touch? Shoot me an email atΒ bhaveshy737@gmail.com. Let's embark on this tech journey together and stay connected across my social media platforms for thrilling tech content! πŸ˜ŠπŸ“±πŸŒ

Top comments (0)