20

Jun

Use the shortcut key to make VS Code more comfortable!: Comfortable Python Life with Visual Studio Code (page 1/3)

This article is limited to members.You can see everything by registering (free).

Serialized table of contents

Visual Studio Code (VS Code) is a high -performance editor.You can access the various functions using a mouse and other pointing devices, but some people may not want to release your keyboard when you write the code.In such a case, the command palette introduced last time is the shortcut key introduced this time.Here are some shortcut keys that I feel, "I don't remember all of them. I don't remember all of them. I want to remember.I feel ... it's hard to permeate the body).

VS Code documents also distribute a list of shortcut keys for each OS in PDF, so please refer to these.

The following shows a shortcut key that corresponds to VS Code in the table format, but at this time, it will be described as "[Ctrl] + [W]".This means pressing the [Ctrl] key and the [W] key at the same time.When multiple key combinations are needed, write it as "[Ctrl] + [K] → [Ctrl] + [F]".This means pressing the [Ctrl] key and [K] key at the same time, and then pressing the [Ctrl] key and [F] key.Please note that the meaning is different from "[Ctrl] + [K] → [F]".This means that the [Ctrl] key and the [K] key are pressed at the same time, and then only the [F] key is pressed.

Then another one.In VS Code, a key combination may work as a shortcut to separate functions, depending on where the window is.For example, pressing the [F2] key while editing the code with the editor will launch the corresponding process as the programmer wants to change the identifier name.On the other hand, if you have a Focus in the Explorer view, press the [F2] key, this time the programmer will perform the corresponding process, assuming that you want to change the file name.

状態に応じて、1つのショートカットキーに複数の役割が与えられることがある

Thus, VS Code knows which function to execute when a shortcut key is entered based on where or other conditions are entered.If you can't access the features you want, check where the focus is.

ショートカットキーを活用して、VS Codeをより快適に!:Visual Studio Codeで快適Pythonライフ(1/3 ページ)

Then, I will look at the shortcut keys that can be used more efficiently if you remember to use VS Code in the category I thought about and use VS Code.

First, we introduce a shortcut key that opens / closed files and folders in vs code.Basically, it is based on the manner specified for each OS (for Windows, [Ctrl] + [O] key, and for MacOS, it is common to open a file with [Command] + [O]).must.

動作ショートカットキー
フォルダをオープンする(Windows/Linux)Windows/Linux:[Ctrl]+[K]→[Ctrl]+[O]macOS:−
ファイルをオープンする(Windows/Linux)Windows/Linux:[Ctrl]+[O]macOS:−
ファイルもしくはフォルダをオープンする(macOS)Windows/Linux:上記参照macOS:[Command]+[O]
無名ファイルの新規作成Windows/Linux:[Ctrl]+[N]macOS:[Command]+[N]
ファイルを保存するWindows/Linux:[Ctrl]+[S]macOS:[Command]+[S]
エディタを閉じるWindows:[Ctrl]+[W]または[Ctrl]+[F4]Linux:[Ctrl]+[W]macOS:[Command]+[W]
全てのエディタを閉じるWindows:[Ctrl]+[K]→[Ctrl]+[W]Linux:[Ctrl]+[W]macOS:[Command]+[K]→[Command]+[W]
エディタグループの全てのエディタを閉じるWindows:[Ctrl]+[K]→[W]Linux:[Ctrl]+[W]macOS:[Command]+[K]→[W]
フォルダ(ワークスペース)を閉じるWindows/Linux:[Ctrl]+[K]→[F]macOS:[Command]+[K]→[F]
ファイルを削除する([エクスプローラー]ビューでファイルを選択した状態で)Windows/Linux:[Delete]macOS:[Command]+[Backspace]
VS Codeウィンドウを閉じる(エディタが開いていない状態で)Windows/Linux:[Ctrl]+[W]macOS:[Command]+[W]
VS Codeウィンドウを閉じる(常に)Windows/Linux:[Ctrl]+[Shift]+[W]macOS:[Shift]+[Command]+[W]
VS Codeを終了するWindows:[Alt]+[F4]Linux:[Ctrl]+[Q]macOS:[Command]+[Q]
ファイル/フォルダ関連のショートカットキー(一部)

Some people may notice that the [Ctrl] + [W] key ([Command] + [W] key) is allocated to both a shortcut key that closes the editor and a shortcut key that closes the VS Code window.Not (this is an example where multiple functions are assigned to one shortcut key according to the situation mentioned first).

This means that by hitting this shortcut key repeatedly, if the editor is finally closed and this shortcut key is pressed further, the VS Code window will be closed.The flow of closing the editor (file) and closing the window at the end is intuitive and easy to understand, so it will be easy to remember.

However, it is troublesome to hit the [Ctrl] + [W] key ([Command] + [W] key) repeatedly when many editors are open.In such a case, it is easy to use a shortcut of "close all editors" or "close all editor groups".Following the [Ctrl] + [K] key ([Command] + [K] key), if you close all the editor, the [Ctrl] + [W] key ([Command] + [W] key) is currently active.If you close all the editor groups of the editor group, just press the [W] key to close the editor in bulk.Before closing the VS CODE window, we recommend that you remember if you want to tidy.

On the other hand, if you want to continue working from the previous state when you open the VS Code window (when this folder / work space is opened), the "VS Code window is shown in the table above.I use a "closed (always) shortcut key (although it seems like I use a mouse) in such a case).

If you look at the shortcut keys you have seen so far, you can see that there are several rules.In other words, in Windows / Linux, the combination of the [Ctrl] key and some key is a shortcut to some basic functions in MacOS.And there are two ways to access the functions that are very similar to the basic functions.

One is to increase the modification key.For example, [Ctrl] + [Shift] + [W] key ([Command] + [Shift] + [W] key) is a shortcut that closes the VS Code window, but this is a Ctrl that closes the editor.This is a combination that adds the [Shift] key to the key ([Command] + [W] key).If you are aware of the flow of closing the editor mentioned earlier → closing the VS Code window, it is easy to remember.

The other is to first press the [Ctrl] + [K] key ([Command] + [K] key) and then enter the basic key combination.The [Ctrl] + [K] key ([Command] + [K] key) will then wait for the additional key input.

[Ctrl]+[K]キー(macOSでは[Command]+[K]キー)を押すと、次の入力を待っていることがステータスバーに表示される

Add an additional key to execute some commands.For example, if you close all the editor, enter the [Ctrl] + [W] key ([Command] + [W] key) following this key combination.This is also similar to "close all editors" by modifying the basic function of "closing a single editor" with the [Ctrl] + [K] key ([Command] + [K] key).It is considered that the function is executed (additional input may not require a [Ctrl] key or [Command] key).Remember that [Ctrl] + [K] key ([Command] + [K] key) is an entrance for accessing advanced functions.

VS CodeのUIへのアクセス1|2|3次のページへ

Copyright © Digital Advantage Corp. All Rights Reserved.