This article provides you with 12 tips and tricks for the sublime text editor, digging deeper into this seemingly concise code editor, hidden behind the endless possibilities of implementing various advanced features.
1) Select
Here are some shortcut keys for sublime text selection:
- Command + DSelect a word
- Command + LSelect a row
- Command + ASelect All
Ctrl + Command + M ' Check all the contents in parentheses (very useful when writing CSS or JS)
Sublime text also supports the operation of selecting multiple rows at once: Furthermore, Sublime Text brings lets us select multiple lines at once, which can significantly b Oost your productivity. There is several ways to perform this feature:
- CommandPressCommandand hold the key and click the line you want to select
- Command + Ctrl + G(When partial text is selected) Press this key to select all the same text
- Command + D(When partial text is selected) directly selects the next occurrence of the text
2) CSS Sorting
The order of CSS properties is generally not important because the browser is rendered correctly in any order. But sorting all the properties still helps the code to be neat. In sublime text, you can sort by selecting the CSS properties and pressingF5them in alphabetical order.
You can also use third-party plug-ins such as Csscomb to control the sorting method in more detail.
3) command Panel (Palette)
Use the command panel to quickly accomplish multiple tasks. PressCommand + Shift + Pthe Bring up panel and type the command you want. Look at a few examples below:
Renaming files
Set file as HTML syntax
Inserting Code Snippets
4) Toggle tab and Project
When you open multiple tabs at the same time, you can switch between them with the following hotkeys:
- Command + TList all tabs
- Command + Shift + ]next tab page
- Command + Shift + [prev Tab
- Command + Ctrl + PToggle Side Bar Display Project
5) Cross-file editing
The same editing operation can be repeated in multiple files at the same time. For example, when you have the same piece of code in multiple files, you can quickly edit it using the following steps:
- PressCommand + Shift + FtheFindbox to enter the code you want to find. You can pressCommand + Ethe code snippet in the quick use selection.
- Wherespecify the range of files you want to look up in the box, or fill in the file to find the files that are<open files>currently open.
- ReplaceEnter the code you want to replace in the box, and press theReplacebutton to bulk replace it.
6) file crawler
PressCommand + Rto list all CSS selectors in the document. You can select and jump to view immediately. This operation is much faster than using the general "find" function.
7) spell check
If you often use sublime text for English authoring, it is useful to enable spell checking. SelectPreferences > Settings – Userthe menu and add the following code:
"spell_check": true,
8) Enhanced Sidebar
The Sidebarenhancements plugin effectively improves the sidebar of the sublime text. After installing the plugin, right-click on the sidebar to find new features: Open in Explorer, new file, new folder, ... Open, open in the browser.
Note: The hotkey that is opened in the browser isF12.
9) Change Theme
Sublime text can be replaced by the appearance theme. Soda Theme is a good topic that can be installed in the Package manager.
If the topic you want to install is not in the online repositories, you can also install it manually:
- Download and unzip the theme pack
- Click menuPreferences > Browse Packages…
- Copy the theme folder to thePackagesfolder.
- Click onPreferences > Settings – Usersthe menu and add the following code:"theme": "Soda Light.sublime-theme"
10) Replace the sublime text program icon
Not only can the theme be changed, but also the icon. There are plenty of redesigned sublime text icons on the dribbble. Replacement method:
- Download an icon that has.icnsthe best format. If not, convert it with IConvert.
- Terminal execution:open /Applications/Sublime\ Text.app/Contents/Resources/
- ReplacementSublime Text 3.icnsorSublime Text 2.icnsfile.
11) Sync Options
If you are working on more than one computer, synchronizing option settings should be a good idea. We use Dropbox to complete this task.
First, run the following command in the terminal to upload the settings file:
mkdir $HOME/Dropbox/sublime-text-3/
mv "$HOME/Library/Application Support/Sublime Text 3/Packages" "$HOME/Dropbox/sublime-text-3/"
mv "$HOME/Library/Application Support/Sublime Text 3/Installed Packages" "$HOME/Dropbox/sublime-text-3/"
Then run the following command on all computers that need synchronization to download the settings:
DSTPATH="$HOME/Library/Application Support/Sublime Text 3"
DROPBOX_PATH="$HOME/Dropbox/sublime-text-3"
rm -rf "$DSTPATH/Installed Packages"
rm -rf "$DSTPATH/Packages" mkdir -p "$DSTPATH"
ln -s "$DROPBOX_PATH/Packages" "$DSTPATH/Packages"
ln -s "$DROPBOX_PATH/Installed Packages" "$DSTPATH/Installed Packages"
12) Clickable URL
Using the widget Clickableurls allows the URL in the file to be clicked.
Original: most-wanted Sublime Text Tips and Tricks
12 Sublime Text application tips and tricks to know