Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Essential Shortcuts and Configuration for Sublime Text 3

Tech May 16 1

Choosing Between Sublime Text 2 and Sublime Text 3

While both versions are similar, Subllime Text 3 is recommended due to its updated UI and package management. Package files install directly within the Sublime Text 3 directory instead of separate system locations, making it portable and easier to backup configurations.

Adding Sublime Text to the Right-Click Context Menu

  1. Open the Registry Editor by running regedit from the command line.
  2. Navigate to HKEY_CLASSES_ROOT\*\Shell.
  3. Create a new key named "Edit with Sublime Text 3".
  4. Within this key, create a new String Value named Icon and set its value to "C:\Program Files\Sublime Text Build 3065\sublime_text.exe,0" (adjust the path to your installation).
  5. Create a subkey named Command and set its default value to "C:\Program Files\Sublime Text Build 3065\sublime_text.exe" "%1".
  6. The option will appear in the context menu immediately.

Basic Interface Configuration

Default settings are in Preferences > Settings-Default. Override them by adding entries to Settings-User. For example, to set font size, highlight the current line, and bold sidebar folder icons, add:

{
    "font_size": 12,
    "highlight_line": true,
    "bold_folder_labels": true
}

Changes save instantly with Ctrl+S.

Frequently Used Keyboard Shortcuts

Default shortcuts are listed in Preferences > Key Bindings-Default. Customize them in Key Bindings-User.

  • Format Code: Alt+Shift+F (Custom) - Formats selected code.
  • Fold Code: Ctrl+Shift+[ (Custom) - Collapses code within a method.
  • Reopen Closed Tab: Ctrl+Shift+T (Default)
  • Toggle Full Screen: F11 (Default)
  • Distraction-Free Mode: Shift+F11 (Default)
  • Quick Add Selection: Ctrl+D (Default) - Selects next occurrence of the current word. Ctrl+U steps back.
  • Close Panels: Esc (Default) - Closes search/replace panels.
  • Insert Line Above: Ctrl+Shift+Enter (Default)
  • Move by Word: Ctrl+Left/Right Arrow (Default)
  • Go to Symbol: Ctrl+R (Default) - Shows a list of methods/functions in the current file.
  • Set Layout: Alt+Shift+1/2/3 (Default) - Switches between single, double, or triple colum layouts.

Useful Plugins

Install Package Control first to simplify plugin management.

Installing Package Control

  1. Open the console via View > Show Console.
  2. Paste the following code and press Enter:
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.io/' + 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)
  1. After installation, use Ctrl+Shift+P, type "Install Package" to add new plugins or "Remove Package" to delete them.

BufferScroll Plugin

This plugin preserves code folding states between sessions. Install via Ctrl+Shift+P > Install Package > BufferScroll.

Configuring Xdebug for PHP Debugging

PHP Xdebug Setup

  1. Create a PHP file with <?php phpinfo(); ?> and view its source code in a browser.
  2. Visit the Xdebug Wizard, paste the source code, and follow the instructions to install the correct Xdebug extension.
  3. Add these lines to your php.ini file:
zend_extension="path/to/xdebug.so" ; Use full path to the extension
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request=yes
  1. Restart your web server.

Sublime Text Xdebug Client Setup

  1. Install the Xdebug client plugin via Package Control (search for "Xdebug").
  2. Configure user settings via Tools > Xdebug > Settings - User. Example configuration:
{
    "path_mapping": {
        "/var/www/html/": "C:/Projects/myapp/"
    },
    "url": "http://localhost/myapp/",
    "super_globals": true,
    "close_on_stop": true
}
  1. Define custom keyboard shortcuts for debugging in Preferences > Key Bindings - User:
[
    { "keys": ["f5"], "command": "xdebug_session_start" },
    { "keys": ["shift+f5"], "command": "xdebug_session_stop" },
    { "keys": ["f6"], "command": "xdebug_session_run" },
    { "keys": ["f10"], "command": "xdebug_session_step_over" },
    { "keys": ["f11"], "command": "xdebug_session_step_into" }
]
Tags: Sublime Text

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.