Jump references, Zen modes… VS Code has 11 shortcuts/actions to double your efficiency and comfort!
Prior to this article, we discussed shortcuts in VS Code in two consecutive articles:
- Can you really use VS Code Ctrl, Shift, and Alt? Efficient and easy to use shortcut keys: multi-cursor, jump reference, easy to fix
- VS Code of Vim | operation without modifying the VSC default shortcut | often combined with logic
This article continues our discussion of shortcuts in VS Code. In fact, this article focuses more on “actions” than the previous two articles, not on shortcuts, but on exploring and applying functionality.
F12 Jump reference
As shown above:
F12
Jump to definition of variable, function, classShift + F12
Jump to its reference; When there are multiple references, you can select the specific reference
Using F12, you can also jump to the source of the environment library. As shown below, I jumped to core.py of the library gym (installed to lib using Conda).
Find and replace
Ctrl + F to find; Press Ctrl + H to pop up the replace window. As above, I replaced foo with foobar, using Alt + R to support regular syntax.
Ctrl + Shift + P
Ctrl + Shift + P is probably the most common operation in any editor or debugger: a command window pops up, then we type the name of the relevant command, and press Enter to execute the command.
As shown above, I use Ctrl + Shift + P to execute the View: Split Editor Right command, then use Ctrl + P to call out the window switcher (file switcher).
Switching window
A stack of overlapping files, VS Code calls it a “group.” We usually use “intra-group switching” and “inter-group switching”.
As shown above, Ctrl + < the number of the group you want to go to > to focus the cursor on the group you want to go to. Ctrl + 1 above to switch to the left group; Ctrl + 2 to switch to the group on the right.
Alt + < number > switches tabs within the group.
Also, notice that Ctrl + Shift + E opens or closes file Manager Explorer, which is the tree on the left. Ctrl + B switches Side Bar, the sidebar.
Create, close and adjust the table
Use Ctrl + ~ switch terminal, and Ctrl + J is the switch Panel, that is, contain terminal, modulator at the bottom of the container.
In addition, Ctrl + N creates a new file and Ctrl + W closes the current file (this works on almost every Windows application).
Zen mode
Sometimes, the programs seem too complicated and bloated, which distracts our attention, makes our vision not clear and reduces our comfort level. Using Zen Mode Zen Mode blocks out these distractions.
Commands can be invoked by typing Zen using Ctrl + Shift + P. In addition, I changed the shortcut keys to Ctrl + Alt + Z (in Keymaps in the lower left corner of the pinion), as shown in the image above, which is very nice.
group size
With a small display and an area split between two or more groups, our code reading screen was too “narrow”.
As shown above, we can Toggle Editor Group Sizes to make the reading mode wider. I set the shortcut keys to Ctrl + Alt + G.
Ctrl + i / Ctrl + /
As shown below, Ctrl + I invokes code hints, and Ctrl + / comments out or uncomments selected text.
Plug-in: vscode – input – sequence
A VScode-input-sequence solves the problem of inputting sequence data.
As shown above, with multiple cursors, we can input a sequence of data and determine the sequence’s progression rules, length of progression, space, base, etc.
Plugin: Relative Path
I like Relative Path as shown below. Ctrl + Shift + H will automatically complete the Relative Path of the file.
Plug-in: Auto Markdown TOC
There are many plugins for markdown to automatically generate directories, but the one that I think is most friendly to Chinese is Hunter Tran’s Auto Markdown TOC.
As above, the table of contents is generated automatically using the Auto Markdown TOC (again, the relevant command is invoked in Ctrl + Shift + P).
I am Scot/Scot/Scot (Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot/Scot). Welcome to add my wechat PiperLHJ into the group communication. Your “watching” or “forwarding” will be of great help to me!