This article will take you to talk about the cursor operations invscode. This article will only cover the cursor operations that are most closely related to us, so let’s get started!
We have only one goal, let us shout our slogan: Make development as smooth as silk! Most of the examples in the article are based on the mac version, because I am a mac, but there is no need to worry about the win version. If you want to break the formation, keep it in mind: command is the ctrl key.
We use the arrow keys every day to operate the cursor. In fact, we also use many of its techniques subconsciously in muscle memory in our daily life. For example, by holding down the cmd key, you can go to the beginning and end of the line, but it is difficult to summarize, and it feels like it is blinding you. Let me give you a breakthrough point: granularity. In our daily use, the left and right arrow keys only have one character, that is, granularity is a character. If we think of the end of a word or sentence, it will be very troublesome; this sentence actually marks our focus: granularity; then, how to operate What about cursor granularity? [Recommended learning: "vscode tutorial"]
Horizontal direction
Combined with the direction keys
Granularity | mac | win |
---|---|---|
option | ctrl | |
cmd | Just use home/end | |
cmd shift \ | Ctrl shift \ |
vertical direction
mac | win | |
---|---|---|
Cmd up and down arrow keys | Ctrl Home/End key | |
Option up and down arrow keys |
Other cursor operations
Extension: [Select] operation only needs to add [shift]; [Delete] operation granularity is the same as cursor operation, in the opposite direction, addfn
( For example, all the content before the cursor in the deleted line is [cmd
delete
] and the content after the cursor is [cmd
fn
delete
】)
Cursor movement for words
Think To move the cursor directly to the entire word, that is, before or after function, you only need to press the Option (Ctrl key on Windows) and the left arrow key.
Move the cursor to the beginning or end of the line
Hold down the Cmd left arrow key (on Windows Home key), you can move the cursor to the first column of this line
Move the cursor to the first or last line of the document
Press Cmd and the up and down arrow keys (Ctrl Home/End key on Windows)
Code Block movement
Cmd Shift \ (Ctrl Shift \ on Windows), you can jump between the pair of curly braces.
Move current line up/down
Other cursor operations
Undo cursor processing
shiftkey), deletion (selecting plus
delete) and other operations, then, if we need What about operating multiple places at once? At this time we need to come to the advanced use of cursor operations, multi-cursor operations.
Basic operation - mouse creation of multiple cursors
Efficiency improvement operations
mac | win | |
---|---|---|
Cmd U | Ctrl U |
Shortcut keys | Detailed explanation | |
---|---|---|
Cmd D | Select the element, then press the shortcut key, vscode will select the next one an identical element and create the cursor; press again to create, and so on. | |
Cmd Option down arrow key | Create a cursor below the current cursor. | |
Option Shift i | Select multiple lines of content, then press the shortcut key, vscode creates a Cursor |
Other cursor operations
Select and delete Lenovo
The [Select] operation only needs to add a [shift]; the [Delete] operation granularity is the same as the cursor operation, and vice versa Just addfn
for the direction (for example, if you delete the line, all the content before the cursor is [cmd
delete
] and the content after the cursor is [cmd#]
##fndelete
])
keyboard Shorycutis defined, find the corresponding operation, and bind the shortcut key to the operation.
Eg: Bind the operation of [Select all contents in brackets]Cmd Shift ]Shortcut key as an example
Find the definition Where keyboard Shorycut
find the corresponding operation
Bind shortcut keys for operations
>Open Keyboard Shortcuts(JSON), if we need to implement an advanced shortcut key, we will need this knowledge.
mac | win | |
---|---|---|
Cmd U | Ctrl U |
Meaning | Remarks | |
---|---|---|
Command value | ||
==corresponds to the suffix name of the opened file. If we want to bind a shortcut key to the js file, we can use
resourceExtname == .js.
&&.
=~and judge it through regular expressions.
vscode Basic Tutorial
!The above is the detailed content of It's worth understanding some vscode cursor operations to make development as smooth as silk!. For more information, please follow other related articles on the PHP Chinese website!