Sublime Text Guide — Packages, Snippets, Build Systems, Multi-Cursor, Projects
Sublime Text is a lightweight, fast, and highly customizable text editor beloved by developers for its speed, multi-cursor editing, and extensive package ecosystem. This guide covers everything from package management to advanced editing techniques.
What You’ll Learn
You’ll install and manage packages with Package Control, create custom snippets for rapid coding, configure build systems for multiple languages, master multi-cursor editing, and organize projects effectively. Durga Antivirus Pro’s configuration files are edited using Sublime Text for its speed with large files.
Why Sublime Text Matters
Sublime Text launches in under a second, handles 100MB+ files without lag, and its distraction-free mode eliminates UI clutter. For rapid editing, configuration file management, and quick prototyping, Sublime Text is unmatched. Its package ecosystem provides IDE-like features without the overhead.
Learning Path
flowchart LR
A[VS Code Basics] --> B[Sublime Text<br/>You are here]
B --> C[Package Development]
C --> D[Build Systems]
style B fill:#f90,color:#fff
Package Control
Package Control is the essential package manager for Sublime Text:
# Install Package Control
# Tools → Command Palette (Ctrl+Shift+P) → "Install Package Control"
# Or via console (Ctrl+\`)
# import urllib.request,os; pf='Package Control.sublime-package'; \
# ipp=sublime.installed_packages_path(); \
# urllib.request.install_opener(urllib.request.build_opener( \
# urllib.request.ProxyHandler())); \
# open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen( \
# 'https://packagecontrol.io/Package%20Control.sublime-package').read())Essential Packages
# Ctrl+Shift+P → "Package Control: Install Package"
# Must-have packages:
# 1. A File Icon — File-type specific icons in sidebar
# 2. BracketHighlighter — Enhanced bracket highlighting
# 3. SublimeLinter — Inline linting (requires language-specific linters)
# 4. GitGutter — Git diff in gutter
# 5. Emmet — HTML/CSS rapid expansion
# 6. SideBarEnhancements — Right-click context menu in sidebar
# 7. Terminus — Embedded terminal in Sublime Text
# 8. Theme - Brogrammer — Popular dark themeCustom Snippets
Snippets save keystrokes by expanding short triggers into full code blocks:
Creating a Snippet
Tools → Developer → New Snippet…
<!-- Snippet for console.log in JavaScript -->
<snippet>
<content><![CDATA[
console.log('${1:message}');$0
]]></content>
<tabTrigger>cl</tabTrigger>
<scope>source.js</scope>
<description>Console log</description>
</snippet>Java Method Snippet
<snippet>
<content><![CDATA[
public ${1:void} ${2:methodName}(${3:String arg}) {
${4:body}
}
]]></content>
<tabTrigger>pm</tabTrigger>
<scope>source.java</scope>
<description>Public method</description>
</snippet>Save and Organize
# Save snippets to User package:
# ~/.config/sublime-text/Packages/User/
# Naming convention: <description>.sublime-snippet
# Example: "console-log.sublime-snippet"
# All snippets in User/ are automatically loadedSnippet Fields Reference
| Field | Purpose |
|---|---|
$1, $2, … | Tab stops — press Tab to jump |
${1:default} | Tab stop with default text |
$0 | Final cursor position |
$SELECTION | Insert selected text |
${1/pattern/replacement/} | Transform tab stop content |
<scope> | Language restriction (e.g., source.python) |
<tabTrigger> | Trigger text |
Build Systems
Sublime Text can compile and run code directly:
Custom Build System
Tools → Build System → New Build System…
{
"shell_cmd": "javac -d bin \"$file\" && java -cp bin ${file_base_name}",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"working_dir": "${project_path:${folder}}",
"selector": "source.java",
"variants": [
{
"name": "Run",
"shell_cmd": "java -cp bin ${file_base_name}"
},
{
"name": "Test",
"shell_cmd": "java -cp bin:$CLASSPATH org.junit.runner.JUnitCore ${file_base_name}"
}
]
}Multi-Language Build Systems
{
"build_systems": [
{
"name": "Python Run",
"selector": "source.python",
"shell_cmd": "python3 \"$file\""
},
{
"name": "Node.js",
"selector": "source.js",
"shell_cmd": "node \"$file\""
},
{
"name": "Shell Script",
"selector": "source.shell",
"shell_cmd": "bash \"$file\""
}
]
}Save as Packages/User/MultiBuild.sublime-build and select via Tools → Build System.
Build System Variables
| Variable | Expands to |
|---|---|
$file | Full path to current file |
$file_path | Directory of current file |
$file_name | Filename without path |
$file_base_name | Filename without extension |
$project_path | Path to project file |
Multi-Cursor Editing
Multi-cursor is Sublime Text’s superpower — edit multiple lines simultaneously:
Creating Multiple Cursors
# Method 1: Mouse
# Hold Ctrl (Cmd on Mac) + click to place cursors
# Method 2: Selection
# Select a word → Ctrl+D repeatedly to select next occurrences
# Alt+F3 → Select all occurrences at once
# Method 3: Column selection
# Shift+Right-click + drag → Column selection
# Ctrl+Shift+Up/Down → Add cursor above/belowMulti-Cursor Workflow
# Before — three lines to fix
user_name = "alice"
user_email = "alice@example.com"
user_role = "admin"
# Place cursor on first 'user_' by clicking
# Press Ctrl+D twice to select the other two 'user_'
# Type 'customer_'
# Result:
customer_name = "alice"
customer_email = "alice@example.com"
customer_role = "admin"
# Split selection into lines
# Select all three lines → Ctrl+Shift+L → cursor on each lineReal-World Usage
# Adding a prefix to multiple lines
# Select the lines → Ctrl+Shift+L → Home → type prefix
# Converting CSV to array
name,email,role
alice,alice@example.com,admin
bob,bob@example.com,user
# Place cursor on each line (Ctrl+Shift+L)
# Wrap with quotes and brackets:
# ["name","email","role"],
# ["alice","alice@example.com","admin"],
# ["bob","bob@example.com","user"],Project Management
Creating a Project
- Open the folder(s) for your project
- Project → Save Project As…
- This creates a
.sublime-projectfile
{
"folders": [
{
"path": "/home/user/projects/myapp",
"folder_exclude_patterns": ["node_modules", ".git", "dist"],
"file_exclude_patterns": ["*.min.js", "*.map"]
}
],
"settings": {
"tab_size": 2,
"translate_tabs_to_spaces": true,
"rulers": [80, 100],
"word_wrap": true,
"wrap_width": 100
},
"build_systems": [
{
"name": "Run App",
"shell_cmd": "npm start"
}
]
}Project Switching
# Quick switch between projects
# Ctrl+Alt+P → Start typing project name
# Projects remember open files, cursor positions, and settingsKeyboard Shortcuts
Customizing Key Bindings
Preferences → Key Bindings (edit the User file):
[
// Go to definition
{ "keys": ["f12"], "command": "goto_definition" },
// Find in project
{ "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} },
// Toggle sidebar
{ "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" },
// Duplicate line
{ "keys": ["ctrl+shift+d"], "command": "duplicate_line" }
]Essential Default Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+P | Goto anything (file, symbol, line) |
Ctrl+Shift+P | Command palette |
Ctrl+D | Select next occurrence |
Ctrl+Shift+L | Split selection into lines |
Ctrl+/ | Toggle comment |
Ctrl+Shift+/ | Block comment |
Ctrl+Shift+Up/Down | Swap line up/down |
Ctrl+Shift+K | Delete line |
Ctrl+Enter | Insert line after |
Ctrl+Shift+Enter | Insert line before |
Ctrl+R | Goto symbol |
Ctrl+G | Goto line |
Ctrl+M | Jump to matching bracket |
Command Palette Extensions
Add custom commands to the palette:
Tools → Command Palette → “New Command”
# Packages/User/hello_world.py
import sublime
import sublime_plugin
class HelloWorldCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, 0, "Hello from custom command!\n")Add to Default.sublime-commands:
[
{ "caption": "Hello World", "command": "hello_world" }
]Common Sublime Text Mistakes
1. Not Using Vintage Mode
Sublime Text has Vim emulation built in (Vintage mode). Enable it: Preferences → Settings → "ignored_packages": [] (remove “Vintage”). Now you have Vim keybindings in a fast editor.
2. Over-Installing Packages
Every package adds startup time and potential conflicts. Install only what you need. Disable unused packages: Ctrl+Shift+P → “Package Control: Disable Package”.
3. Ignoring the Status Bar
The status bar shows line endings, syntax highlighting mode, encoding, indentation settings, and Git branch. Click any item to change it.
4. Not Using the Minimap
The minimap (right side) provides a bird’s-eye view of your file. Click and drag to navigate. Toggle with Ctrl+KK or View → Show Minimap.
5. Opening Very Large Files Without Warning
Sublime handles 100MB+ files, but opening a 2GB log file will consume all RAM. Use the Line limit in Ctrl+P to load only portions of huge files.
6. Forgetting to Save Build Systems
Build system files must be in Packages/User/ with .sublime-build extension. Save them, then select via Tools → Build System.
7. Not Running Package Control Sync
When switching machines, sync packages via Package Control’s Settings → Package Control.sublime-settings → "installed_packages" list. Copy this file to the new machine.
Practice Questions
1. How do you select all occurrences of a word for multi-cursor editing? Place cursor on the word and press Alt+F3 (Linux/Windows) or Ctrl+Cmd+G (Mac). Every occurrence gets a cursor.
2. What is the difference between .sublime-project and .sublime-workspace?
The .sublime-project file defines folders, settings, and build systems — it’s shareable via version control. The .sublime-workspace file stores session state (open files, cursor positions) — never commit it.
3. How do you create a snippet for a specific file type?
Use the <scope> tag: source.python for Python files, source.java for Java, text.html for HTML. Multiple scopes separated by commas.
4. How do you run a custom build system for the current file?
Tools → Build System → select your build system, then Ctrl+B to build. Or set "selector" to auto-detect the right build system.
5. Challenge: Edit a 5000-line CSV file to add a prefix “Doda_” to every value in the first column without using a script. Answer: Use column selection: click after the first value in row 1, hold Shift+Right-click and drag down to column-select the first column values. Ctrl+Shift+L to get cursors on each line. Home, then type “Doda_”.
Mini Project: Build a Snippet Library
Create a personal snippet library for a language you use daily:
<!-- log4j-logger.sublime-snippet -->
<snippet>
<content><![CDATA[
private static final Logger log = LoggerFactory.getLogger(${TM_FILENAME_BASE}.class);
]]></content>
<tabTrigger>log4j</tabTrigger>
<scope>source.java</scope>
</snippet><!-- flask-route.sublime-snippet -->
<snippet>
<content><![CDATA[
@app.route('/${1:path}', methods=['${2:GET}'])
def ${3:handler}():
"""${4:Description}"""
return ${5:render_template('${6:template}.html')}
]]></content>
<tabTrigger>flaskroute</tabTrigger>
<scope>source.python</scope>
</snippet>Create 10 snippets total covering your most repetitive code patterns. Organize them with clear tabTrigger values and descriptive <description> tags.
FAQ
What’s Next
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-20.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro