Sublime Text lightweight speed text editor introduction

Sublime Text version

  • Sublime Text 4
  • Sublime Text Build 3211
  • Sublime Text 2.0.2a

PackageControl plug-in

Official website: Package Control - the Sublime Text package manager

Official website Chinese image: http://packagecontrol.cn/

The original official website was used as a Chinese mirror website by the wall. Now the official website has been restored and the Chinese mirror station has been closed.

INSTALLATION

Use one of the following methods to install Package Control:

Command Palette
  1. Open the command palette
    Win/Linux: ctrl+shift+p, Mac: cmd+shift+p
  2. Type Install Package Control, press enter
Menu
  1. Open the Tools menu
  2. Select Install Package Control...

This will download the latest version of Package Control and verify it using public key cryptography. If an error occurs, use the manual method instead.

Manual

If the command palette/menu method is not possible due to a proxy on your network or using an old version of Sublime Text, the following steps will also install Package Control:

  1. Click the Preferences > Browse Packages... menu
  2. Browse up a folder and then into the Installed Packages/ folder
  3. Download Package Control.sublime-package and copy it into the Installed Packages/ directory
  4. Restart Sublime Text
Chinese image

Because packagecontrol IO is blocked by the wall, so installing Sublime Text requires two steps

Step 1: install the plug-in code through the console, open the console through View > show console, paste the Python code into the console, and press enter.

  • Sublime Text 3
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.cn/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
  • Sublime Text 2
import urllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.cn/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

Step 2: modify Sublime Text plug-in channels as follows:

  • Open the Package Control configuration file Settings - User
  • Modify or add channels address
    { "channels": [ "http://packagecontrol.cn/channel_v3.json" ] }
    Save it!

Recommended plug-ins are constantly updated

  • Chinese localization, fully Chinese plug-in
    Switch between language in Main Menu Help/Language / use the help / Language submenu of the main menu to switch languages.

  • ConvertToUTF8, GBK encoding compatible

  • DeleteBlankLines to delete blank lines
    Ctrl+Alt+Backspace: delete all empty lines in the selection area
    Ctrl+Alt+Shift+Backspace: delete extra empty lines in the selection area
    If a line contains a tab or space character, it will not be deleted. Only empty lines containing \ n or \ r will be deleted

  • TrailingSpaces, highlight delete whitespace
    Edit > Trailing Spaces >

  • Solarized Color Scheme

  • Sunrise Theme

  • MarkdownPreview

  • Markdown Extended

    ctrl + shift + p and search for "Markdown Extended"

    View -> Syntax -> Open all with current extension as... -> Markdown Extended

  • MarkDown Editing

  • Sidebar enhancements

  • Emmet, a front-end artifact, can expand an abbreviation into an HTML and CSS code block by pressing the Tab key

  • ColorConvert, RGBA color conversion, hex color conversion to RGBA color

Sublime Text usage

edit

GOTO ANYTHING

Press Ctrl + p
Enter @ symbol to jump to the position where the symbol is located Ctrl-R
Enter #keyword to jump to the location of keyword Ctrl -;
Enter: 12 to jump to line 12 of the file. Ctrl-G

Command Palette command panel

Command Palette integrates functions that are not commonly used, such as sorting, changing syntax rules, and changing indentation settings. You can find the function you want by simply tapping the keyboard; Finding functions on the navigation bar or memorizing obscure shortcuts will become history.
Ctrl + Shift + p

Multiline cursor / column editing:
  1. CTRL + left click, Shift + right drag, select cursor position, increase selection: Ctrl, decrease selection: Alt, edit [vim mode: command, i a edit]
  2. Ctrl + Alt + up or down add multi light punctuation with the current cursor as the center, and press end to locate the end of the line (Linux Shift + Alt)
  3. Ctrl+shift+L: select multiple lines first, insert cursor at the end of each line, and edit [vim mode: visual, I word beginning and A word ending editing]
  4. Ctrl+D select the current words one by one and highlight them (Ctrl + K, Ctrl+D skip words), Alt+F3 select all the same words and edit [vim mode: visual, I word beginning and A word ending editing]
Finding & replacing

Ctrl+H open regular, enter ^, and Find All line headers; Enter $, and Find All line endings; Then Find All, the cursor flashes and you can edit it

Split screen

Alt + Shift + 2 split left and right
Alt + Shift + 8 split screen up and down
Alt + Shift + 5 to split the screen up, down, left and right (i.e. four screens).

Common shortcut keys

Tab indents to the right. It is only valid for the code behind the cursor (or selected)
Shift+Tab indent left
Ctrl + [indent left. Valid for entire line
Ctrl +] indent right. Valid for entire row
Ctrl + / comment line
Ctrl+Z undo
Ctrl+Y undo
Ctrl+F2 set bookmark, F2 switch bookmark

to configure

Preferences | Settings configuration information

vim mode

Sublime comes with a plug-in that supports Vim, but it is turned off by default.

"ignored_packages":	["Vintage",]

Opening mode:

  1. Package Control > Enable Package > Vintage

  2. Set in the menu preferences / settings user

"ignored_packages": []
White space character
  • Show white space characters
"draw_white_space":"all"
  • Automatically remove excess spaces at the end of the code line:
"trim_trailing_white_space_on_save": true

Save the file and delete it automatically!

You can also use the plug-in TrailingSpaces

Highlight the current row
"highlight_line": true,     //Highlight the current edit line
Font settings
"font_face": "DejaVu Sans Mono",
"font_size": 11

Windows registry

Add the right-click menu under windows: create the following registry script reg

  • SublimeText3
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\SublimeText3]
@="Edit with Sublime Text3"
"Icon"="D:\\PortableApps\\Sublime Text Build 3207 x64\\sublime_text.exe,0"
[HKEY_CLASSES_ROOT\*\shell\SublimeText3\command]
@="D:\\PortableApps\\Sublime Text Build 3207 x64\\sublime_text.exe \"%1\""

[HKEY_CLASSES_ROOT\Directory\shell\SublimeText3]
@="Open with Sublime Text3"
"Icon"="D:\\PortableApps\\Sublime Text Build 3207 x64\\sublime_text.exe,0"
[HKEY_CLASSES_ROOT\Directory\shell\SublimeText3\command]
@="D:\\PortableApps\\Sublime Text Build 3207 x64\\sublime_text.exe \"%1\""
  • SublimeText2
[HKEY_CLASSES_ROOT\*\shell\SublimeText2]
@="Edit with Sublime Text2"
"Icon"="D:\\PortableApps\\Sublime Text 2.0.2 x64\\sublime_text.exe,0"
[HKEY_CLASSES_ROOT\*\shell\SublimeText2\command]
@="D:\\PortableApps\\Sublime Text 2.0.2 x64\\sublime_text.exe \"%1\""

[HKEY_CLASSES_ROOT\Directory\shell\SublimeText2]
@="Open with Sublime Text2"
"Icon"="D:\\PortableApps\\Sublime Text 2.0.2 x64\\sublime_text.exe,0"
[HKEY_CLASSES_ROOT\Directory\shell\SublimeText2\command]
@="D:\\PortableApps\\Sublime Text 2.0.2 x64\\sublime_text.exe \"%1\""

Keywords: sublime editor

Added by Daniel0 on Thu, 06 Jan 2022 00:25:13 +0200