Sublime text 3 shortcut keys and configuring the compilation environment

Time:2021-7-30

Sublime text 3 is the favorite code editor of code farmers. When dealing with code every day, you must first use its tools and master the shortcut keys of the basic code editor to make you code more efficient. It may be strange at first. Just spend a week or two to stick to and get familiar with these commonly used shortcut keys! In fact, the relevant shortcut keys will be prompted in each option of the sulime text menu bar. You can have a look by yourself. This article is mainly to sort out some hidden or unexplored shortcut keys!

Software name:
Code editing software (sublime text 4) v4.0.0.4086 Chinese green version 64 / 32
Software size:
43.78MB
Update time:
2020-09-17Download now

Sublime Text 3 shortcut key version

CTRL + Shift + P: Open Command Panel
CTRL + P: search for files in the project
CTRL + G: jump to the line
CTRL + W: close the currently open file
CTRL + Shift + W: close all open files
CTRL + Shift + V: paste and format
CTRL + D: select a word. Repeat to select the next same word
CTRL + L: select a row. Repeat to add and select the next row
CTRL + Shift + L: select multiple rows
CTRL + Shift + Enter: inserts a new row before the current row
CTRL + X: delete current row
CTRL + M: jump to the corresponding bracket
CTRL + U: soft undo, undo cursor position
CTRL + J: select label content
CTRL + F: find content
CTRL + Shift + F: find and replace
CTRL + H: replace
CTRL + R: go to method
CTRL + N: new window
CTRL + K + B: switch sidebar
CTRL + Shift + M: select the content of the current bracket and repeat the bracket itself
CTRL + F2: set / delete Tags
CTRL + /: comment the current line
CTRL + Shift + /: inserts a note at the current location
CTRL + Alt + /: block comment, focus to the first line, and write the comment description
CTRL + Shift + A: before and after selecting the current label, modify the label
F11: full screen
Shift + F11: full screen undisturbed mode, only edit the current file
Alt + F3: select all the same words
Alt +.: close label
Alt + Shift + number: split screen display
Alt + number: switch to open the nth file
Shift + right click drag: there are too many cursors to change or insert column contents
The forward and backward keys of the mouse can switch tab files
Press Ctrl, click or select successively to edit multiple positions
Press Ctrl + Shift + up and down to wrap lines

Select class

Ctrl+D  Select the text occupied by the cursor. If you continue, the next same text will be selected.

Alt+F3  Select the text and press the shortcut key to select all the same text at one time for editing at the same time. Take a chestnut: quickly select and change all the same variable names, function names, etc.

Ctrl+L  Select the whole row and continue to select the next row. The effect and  Shift+↓  The effect is the same.

Ctrl+Shift+L  Select multiple lines first, and then press the shortcut key. The cursor will be inserted at the end of each line to edit these lines at the same time.

Ctrl+Shift+M  Select the contents in parentheses (continue to select the parent parentheses). Take a chestnut: quickly select and delete the code in the function, rewrite the code of the function body or rewrite the contents in parentheses.

Ctrl+M  Move the cursor to the end or start position in parentheses.

Ctrl+Enter  Insert a new row on the next row. Take a chestnut: you can quickly insert a line down even if the cursor is not at the end of the line.

Ctrl+Shift+Enter  Insert a new row on the previous row. Take a chestnut: you can quickly insert a line up even if the cursor is not at the beginning of the line.

Ctrl+Shift+[  Select the code and press the shortcut key to collapse the code.

Ctrl+Shift+]  Select the code and press the shortcut key to expand the code.

Ctrl+K+0  Expand all collapse codes.

Ctrl+←  Move the cursor to the left and quickly.

Ctrl+→  Move the cursor unit to the right and quickly move the cursor.

shift+↑  Select multiple rows up.

shift+↓  Select multiple rows down.

Shift+←  Select the text to the left.

Shift+→  Select the text to the right.

Ctrl+Shift+←  Select the text horizontally to the left.

Ctrl+Shift+→  Select the text unit to the right.

Ctrl+Shift+↑  Interchange the code of the line where the cursor is located with the code of the previous line (insert the line where the cursor is located before the previous line).

Ctrl+Shift+↓  Interchange the code of the line where the cursor is located with the code of the next line (insert the line where the cursor is located after the next line).

Ctrl+Alt+↑  Add a multi line cursor up to edit multiple lines at the same time.

Ctrl+Alt+↓  Add a multi line cursor down to edit multiple lines at the same time.

Edit class

Ctrl+J  Merge the selected multiple lines of code into one line. Take a chestnut: combine CSS properties of multi line format into one line.

Ctrl+Shift+D  Copy the entire line where the cursor is located and insert it to the next line.

Tab  Indent right.

Shift+Tab  Indent left.

Ctrl+K+K  Delete the code from the cursor to the end of the line.

Ctrl+Shift+K  Delete the entire row.

Ctrl+/  Note line.

Ctrl+Shift+/  Comment multiline.

Ctrl+K+U  Convert to uppercase.

Ctrl+K+L  Convert to lowercase.

Ctrl+Z  revoke.

Ctrl+Y  Resume undo.

Ctrl+U  Soft undo, feel and  Gtrl+Z  Same.

Ctrl+F2  Set bookmark

Ctrl+T  The left and right letters are interchangeable.

F6  Word detection spelling

Search class

Ctrl+F  Open the bottom search box to find keywords.

Ctrl+shift+F  The difference between searching in a folder and an ordinary editor is that sublime allows you to add multiple folders for searching. It is slightly high-end and has not been studied.

Ctrl+P  The search box opens. Take chestnuts for example: 1. Enter the file name in the current project to quickly search the file; 2. Enter @ and keyword to find the function name in the file; 3. Enter: and number to jump to the line of code in the file; 4. Enter # and keyword to find the variable name.

Ctrl+G  Open the search box, automatically bring:, enter a number and jump to this line of code. Take chestnuts for example: quickly locate files with long page code.

Ctrl+R  Open the search box, automatically bring @, enter keywords, and find the function name in the file. Take a chestnut: quickly find a function on the page with more functions.

Ctrl+:  Open the search box, automatically bring #, enter keywords, and find variable names, attribute names, etc. in the file.

Ctrl+Shift+P  Open the command box. Scenario Chestnut: open the naming box, enter keywords, and call the function of sublime text or plug-in, such as installing plug-in using package.

Esc  Exit cursor multi line selection, exit search box, command box, etc.

Display class

Ctrl+Tab  Switch the tabs of the current window according to the order in which the files have been browsed.

Ctrl+PageDown  Toggles the tab of the current window to the left.

Ctrl+PageUp  Toggles the tab of the current window to the right.

Alt+Shift+1  Window split screen, restore the default 1 screen (non keypad numbers)

Alt+Shift+2  Left and right split screen – 2 columns

Alt+Shift+3  Left and right split screen – 3 columns

Alt+Shift+4  Left and right split screen – 4 columns

Alt+Shift+5  Equally divided into 4 screens

Alt+Shift+8  Vertical split screen-2 screens

Alt+Shift+9  Vertical split screen – 3 screens

Ctrl+K+B  Turns the sidebar on / off.

F11  Full screen mode

Shift+F11  Undisturbed mode

Configuring the compilation environment

Console input (taking C + + as an example)

The principle is simple, that is, create an external bat for executing files, and then call it. Note that you need to use start to open a new window and pause to look at the results. What hurts is that sublime executes your start in the background by default. If your pause and start are placed in one file, pause is invalid for the file of start% 1, so it really needs to create two files. Note the environment variables( I can’t explain what environmental variables are clearly in three or two sentences. I’d better Baidu myself.)

After matching, I don’t think the console input is of great significance. If you do questions, you read them from files. You don’t need to read them for development. So ~ be careful.

MyCRun.bat

@echo off  

%1  

echo.  

echo ——————-  

pause  

exit  

MyCallRun.bat

@start  MyCRun %1  

Configuration file in   Sublime Text 3\Packages\C++.sublime-package  。 Back up first.

Modify the inside   C + +. Sublime build is

{  

    “shell_cmd”: “g++ \”${file}\” -o \”${file_path}/${file_base_name}\””,  

    “file_regex”: “^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$”,  

    “working_dir”: “${file_path}”,  

    “selector”: “source.c, source.c++”,  

    “variants”:  

    [  

        {  

            “name”: “Run”,  

“shell_ cmd”:  ” g++  \”${ file}\”  – o  \”${ file_ path}/${file_ base_ name}\”  &&  MyCallRun  \”${ file_ path}/${file_ base_ name}.exe\””     //   In fact, I added a mycallrun here

        }  

    ]  

}  

C/C++

Sublime text 3 is configured with C + + by default. But you need to add the GCC directory to the environment variable yourself

Java

Sublime text 3 only runs javac by default and needs to be added and run by itself.

I couldn’t understand the command format of sublime, so I changed javac to my own bat( It feels like it can also be connected with & & like C + +)

Create myjrun.bat where the command line can be accessed directly (I put it directly under JDK / bin)

@ECHO OFF    

cd %~dp1    

ECHO Compiling %~nx1…    

IF EXIST %~n1.class (    

DEL %~n1.class    

)    

javac %~nx1    

IF EXIST %~n1.class (    

ECHO Running…  

ECHO ———————-OUTPUT———————-  

java %~n1    

)  

Note that CLS cannot be used.

Modify the compilation options of Java (back up the original).

Directory: packages / java.sublime-package/javac.sublime-build

{  

    “shell_cmd”: “myJRun.bat \”$file\””,  

    “file_regex”: “^(…*?):([0-9]*):?([0-9]*)”,  

    “selector”: “source.java”  

}  

In this way, the Java code point build written in the future will run automatically.

This approach can not cross platform, and then study sublime’s own way.

Go

The environment for developing golang with sublime is very simple. You only need to install a gosublime.

Software name:
Code editing software (sublime text 4) v4.0.0.4086 Chinese green version 64 / 32
Software size:
43.78MB
Update time:
2020-09-17Download now

For more resources, please scan the code to pay attention to the official account.