5 more Sublime Text tweaks & tips

I’m working hard on my Sublime Text Book and have received fantastic response for everything so far – very motivating. The last post was so well received that I’ve decided to post a few more of my favourite tips.

1. Save on focus lost

Chronic ⌘+S’er? This tip is particularly helpful when working with CSS/LESS/SASS and switching between your editor and browser. Instead of saving on every tiny little change, tell Sublime to automatically save your files when you tab away from the editor.

I find this is super handy when working with extensions like Live Reload or compiled languages like coffeescript that watch for file saves. Put this in your settings file at PreferencesSettings - User

"save_on_focus_lost": true

If you work with other watch scripts that break and restart a process upon save (like supervisor or forever), this might not be ideal for you. No problem, only enable it for the languages you want – simply place the above setting in /Packages/User/[syntax].sublime-settings. For example, I put the above in CSS.sublime-settings and LESS.sublime-settings

2. Paste and Indent

One of the best tricks I’ve ever learned in Sublime Text is paste and indent. If you have ever pulled a piece of code off the Internet and pasted it into your application, you’ll no doubt feel the pain of having it paste in all weird and have to go in and fix it.

Easy fix to this, instead of pressing the normal cmd + v to paste, simply switch to using cmd + shift + v to paste. This will automatically indent your code block.

Like that one? I loved it so I remapped my key combos to paste and indent by default on cmd + v

Paste this little snippet into your key bindings file located at PreferencesKey Bindings - User

{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }

3. Reindent Keyboard shortcut

Now, if for some reason you end up with either a block of code or an entire file filled with hard to ready, messy, poorly indented code, reindent is your best friend.

To automatically re-indent your code, simply select the code you want to indent and then from the menu EditLineReindent

Sublime doesn’t ship a keyboard shortcut for this. No problem, let’s make our own. Pop this little snippet into the PreferencesKey Bindings - User file.

{ "keys": ["super+shift+r"],  "command": "reindent" }

4. Highlight Modified Tab

When making a change in sublime text, by default it changes the × to a circle of the same colour.

Make it a little more obvious when you haven’t saved changes to a document by turning on the following:

"highlight_modified_tabs": true

The exact styling of your modified tabs will vary depending on your theme. It looks fantastic with my cobalt2 theme for Sublime Text

I’m an instructor at HackerYou where we use Sublime Text extensively. This is a small, yet common, problem that we run into. Making it visually obvious cuts down on mistakes like this.

5. Proper Fullscreen for Mac Users

This one is only for those running Sublime Text on Mac OSX 10.7 or 10.8 with multiple monitors. You have probably realized that apple has really dropped the ball when using fullscreen, rendering the rest of multiple monitors into nothing but a linen backdrop.

If you like to code fullscreen yet still use your other monitors, go ahead and add the following to your preferences file:

"use_simple_full_screen": true

You’ll have to restart Sublime Text for this one.


I’ve got plenty more tips as well as in-depth guides on the rest of Sublime Text in my book. If you have a must-use tip or commends on any of the above, please feel free to leave a comment!

This entry was posted in Sublime Text. Bookmark the permalink.

13 Responses to 5 more Sublime Text tweaks & tips

  1. Pingback: This Week in WordPress: Jan 14, 2013 - Theme Customizer

  2. Paul says:

    Nice article series, thanks.

    Your link to your cobalt2 theme is broken, I was wondering what it looked like but got a 404.

  3. Jordan says:


    Sigh… it’s those kind of things that I honestly don’t think I’d ever find on my own. Thanks!!

  4. me says:

    nice tips, thanks

  5. Pingback: Sublime text 2 - mój zestaw ★ BobikoPL Blog

  6. Miguel Garcia says:

    I leave here my personal key bindings and settings for Sublime Text:

    I use OSX but you can just change the shortcut (keybinding). They are specially for bash lovers. If you are not you will learn two new things 😉

    Key Bindings-User:


    Change them in Sublime Preferences( menu bar). The user settings are not modified when you ST is updated that’s why you will keep them there. There you can also override the default ones.

  7. Thanks for the article. I use CMD+SHIFT+V all the time on my Mac, by default it is ‘paste and match style’ which is really useful in say email or word processing for matching the style of the doc, but never thought to check what it did in a ‘simple’ text editor.

    Save on focus lost is awesome too.

  8. JasonHuang says:

    really nice ! especially for the high_light_changed_tabs . one more thing , i use sublime on win 7 , what’s the “super+shift+r” substitution for this setting?

  9. Jérémy says:

    Thanks for the tips !

  10. ali manzoor says:

    can you help me out regarding this error available in console – its quite irritating as all plugins stopped when it happened.

    SublimeLinter: csslint activated: /usr/local/bin/csslint
    error: plugin_host has exited unexpectedly, plugin functionality won’t be available until Sublime Text has been restarted
    indexing [queue 4]: no files were indexed out of the 2 queued, abandoning crawl

  11. Ahmed says:

    I need help. I am using Sublime text 3 on MacBook. I am also using “latexing” for typing my report. Every time I make build in order to see my update “command + B”, the PDF file starts from the first page instead of the page that I am editing on it. How can I fix this issue?
    . Thank you for your help

Leave a Reply

Your email address will not be published. Required fields are marked *