Comprehensive Sublime Text Guide: Installation, Configuration, and Advanced Usage
This extensive tutorial provides a step‑by‑step guide to installing Sublime Text on Windows, adding it to the system PATH, configuring Package Control, customizing settings, themes, and key shortcuts, and demonstrates advanced editing features such as multi‑selection, find‑replace, navigation, and code snippets, making it a valuable resource for developers seeking to master this powerful cross‑platform code editor.
Abstract This article presents a complete, Chinese-language guide to Sublime Text, aiming to become the best Sublime Text tutorial by covering installation, configuration, and practical usage.
Prologue Sublime Text is a cross‑platform code editor that has evolved into a preferred GUI editor for many developers. The author, a typical programmer working with Java, Python, JavaScript, and occasional C# and other languages, writes this guide to fill the gap of a comprehensive Chinese tutorial.
Editor Choices
The author recommends Vim and Sublime Text for their cross‑platform nature, extensibility via plugins, and complementary strengths (Vim for CLI, Sublime for GUI).
Installation
Sublime Text 3 can be downloaded from the official website. During installation, enable "Add to explorer context menu" to open files directly from the right‑click menu.
Adding Sublime Text to Environment Variables
Run sysdm.cpl (Win+R) to open System Properties, then add the Sublime Text installation directory (e.g., D:\Program Files\Sublime Text 3 ) to the PATH variable.
Afterward, the subl command can be used in the command line:
subl file :: Open file with Sublime Text
subl folder :: Open folder with Sublime Text
subl . :: Open current folder with Sublime TextInstall Package Control
Package Control manages plugins. To install it, open the console with Ctrl+` and paste the following code:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 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://sublime.wbond.net/' + 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)After installation, press Ctrl+Shift+P and type "Package Control" to access plugin commands.
Purchase
Sublime Text is a paid, closed‑source software. Users can purchase it online, but an unregistered version remains functional with occasional purchase reminders.
Tour
The interface includes tabs, editing area, side bar, minimap, command palette, console, and status bar.
Settings
Sublime Text uses JSON configuration files. Example:
{
"font_size": 12,
"highlight_line": true
}Additional personal settings:
// Use a sans‑serif monospaced font
"font_face": "YaHei Consolas Hybrid",
"font_size": 12,
"caret_style": "phase",
"highlight_line": true,
"highlight_modified_tabs": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"rulers": [80, 100],
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": trueEditing Features
Basic editing shortcuts include Ctrl+Enter (new line below), Ctrl+Shift+Enter (new line above), word navigation with Ctrl+←/→ , and line movement with Ctrl+↑/↓ .
Multi‑selection: Ctrl+D selects the next occurrence of the current word, Ctrl+K skips, Ctrl+U undoes, Esc exits. Ctrl+Shift+L splits selections for simultaneous editing, and Ctrl+J joins them.
Finding & Replacing
Three modes: quick find/replace, standard find/replace ( Ctrl+F , Ctrl+H ), and multi‑file find/replace ( Ctrl+Shift+F ). Options include case‑sensitive ( Alt+C ), whole word ( Alt+W ), and regex ( Alt+R ).
Jumping
Navigate quickly with Ctrl+P (Go To Anything), supporting file, symbol ( @symbol ), keyword ( #keyword ), and line ( :12 ) jumps. Ctrl+R lists symbols, F12 jumps to definition, and Ctrl+G jumps to a line number.
Window & Tabs
New window: Ctrl+Shift+N . New tab: Ctrl+N . Close tab/window: Ctrl+W . Reopen closed tab: Ctrl+Shift+T . Split screen: Alt+Shift+2 (vertical), Alt+Shift+8 (horizontal), Alt+Shift+5 (grid). Switch screens with Ctrl+1 ‑ Ctrl+9 .
Full‑Screen
Toggle normal full‑screen with F11 and distraction‑free full‑screen with Shift+F11 .
Styles & Themes
Default theme is Monokai Bright. Popular third‑party themes include Soda Light/Dark, Nexus, Flatland, Spacegray Light/Dark. Theme and color scheme can be set in preferences, e.g.:
"theme": "Nexus.sublime-theme",
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme"Code Snippets & Auto‑Completion
Snippets can be triggered by typing the snippet name and pressing Tab . Auto‑completion works with Tab as well.
Bracket Handling
Navigate between matching brackets with Ctrl+M , select inside brackets with Ctrl+Shift+M , and use the BracketHighlighter plugin for visual aid.
Command Line Integration
Use the SublimeREPL plugin for an interactive Python console.
Miscellaneous
Additional features include macros, project management, Vintage (Vim mode), build systems, and debugging via plugins.
Shortcuts Cheatsheet
A comprehensive list of shortcuts for general use, editing, selection, find/replace, jumping, window management, and screen layout is provided throughout the guide.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.