Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

Blogs about sublime-text

Sublime Text ColorHighlighter Tips.

2.24.2017

Sreenshot demonstrating ColorHighlighter for Sublime Text ColorHighlighter is a pretty nifty package for Sublime Text which can display the color of CSS colors values right in the text editor. Here are a few usage and configuration tips if you want to use it yourself.

Sublime Text Preferences.

10.15.2015

Getting the perfect configuration set up is part of what makes Sublime Text a dream. Here are some of the most useful configuration changes (from Sublime's defaults) that I've found. You can set these by editing the preferences file at Preferences > Settings - User.

"afn_insert_dimensions": "false"
With the AutoFileName package, don't automatically insert image dimensions.
"bold_folder_labels": true
In sidebar, show all folders with bold font.
"caret_style": "phase"
A smoother cursor blink transition.
"close_windows_when_empty": false
Don't close Sublime Text when there are no open files.
"copy_with_empty_selection": false
Don't copy if nothing is selected.
"ensure_newline_at_eof_on_save": true
Be sure all saved files end in an empty line.
"fallback_encoding": "UTF-8"
Use this encoding when it can't be determined automatically.
"file_exclude_patterns": [".bak", ".DS_Store", "Thumbs.db"]
Don't show these files in the sidebar or GoToAnything.
"find_selected_text": true
"Find" field is pre-seeded with highlighted text in document. Keeping this in user preferences ensures it works on OSX.
"folder_exclude_patterns": [".git", ".sass-cache", "tmp"]
Don't show these folders in sidebar or GoToAnything.
"font_options": ["subpixel_antialias"]
Prettier text.
"highlight_line": true
Use a lighter background color for line where cursor is.
"highlight_modified_tabs": true
Use special color for tabs with unsaved changes.
"line_padding_bottom": 1
Add just a little white space below lines.
"line_padding_top": 1
Add just a little white space above lines.
"open_files_in_new_window": false
Whether OSX opens dragged-in files in a new Sublime window.
"show_full_path": true
Whether title bar shows entire file path instead of just name. Keeping this in user prefs ensures it works on OSX.
"tab_size": 2
How many spaces is a tab equal to?
"translate_tabs_to_spaces": true
Use spaces instead of tabs.
"trim_automatic_white_space": true
Removes any auto-indented whitespace when on new lines.
"trim_trailing_white_space_on_save": true
When a file is saved, delete any whitespace at the end of a line.
"wide_caret": true
Have a wider cursor marker for better visibility.
"word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}~?"
Make it so that dashes et cetera are considered part of a word; and thus don't break a selection with a class name, for example.
"word_wrap": "false"
Set word wrap to by default for all file types / syntaxes. Can still enable / disable word wrap via View menu. I don't know why this "false" has to be a string, but it does.

Sublime Text and the Command Line.

9.3.2015

Sublime Text comes with an excellent little command line utility. Here are some examples of what it can do:

Usually you have to set this up on each computer you're using Sublime on. (This sort of thing is about telling your computer how to utilize Sublime, which is why it doesn't sync to other machines when you have syncing set up.)

Windows 7/10 Sublime / Command Line Configuration

OSX Sublime / Command Line Configuration

The Mug of Sublime Text.

11.6.2014

Sublime Text has many powerful keyboard shortcuts, but they can be tricky to remember. So I created The Mug of Sublime Text - an online reference of the coolest and most delightful keyboard shortcuts for Sublime Text. I've tested each shortcut on Windows 7, and provided OSX alternatives when they differed. If anyone finds that alternative commands are needed for Unix, pull requests are welcome!

The Mug of Sublime Text is a loving tribute to Mug of VI. I used VI for a while 8 years ago, and I still have one of these coffee mugs with VI's keyboard shortcuts printed on it. If you still love VI (or just want to dip your toes in the waters of VI), ST has a mode for that.

I tried to document only shortcuts that are part of ST's default installation, but some keymap customizations are too awesome to be ignored. I've also provided my customized keymap files in the repo so you can use them. I didn't include keyboard commands that are fairly standard to the operating system; such as Ctrl Shift t to re-open the most recently closed tab.

This reference is tilted towards my own front-end web developer workflow, so of course I've included some of the best Emmet.io shortcuts too.

Environment Syncing for Sublime Text 3.

4.25.2014

I've recently upgraded to Sublime Text 3, so I realized I also needed to update my process for synchronizing Sublime's configuration via Dropbox. This process results in all of your settings being automatically shared between computers (even Windows and Mac). These steps will sync Snippets, Installed Packages and Color Schemes between every Sublime Text 3 instance that you configure this way. It won't sync Projects or Recent Documents, but you could sync the Settings directory to enable this. If you need them, here are my original instructions for syncing Sublime Text 2 with Dropbox.

The basic procedure will be to create a new directory for settings in Dropbox, and then replace Sublime's normal directories with symbolic links (folder shortcuts) that point to the Dropbox folder. This general process will work in any scenario where applications utilize a flat folder structure for their settings or add-ons, such Photoshop and Cmder. You'd just need to figure out the specific directories that you need to sync. The process should also work on file synchronization systems other than Dropbox, such as Sync.

Initial setup / first computer:

  1. Install Package Control into Sublime Text.
  2. From the Preferences Menu, choose Browse Packages (Sublime Text > Preferences > Browse Packages... on OSX.). Then navigate up one directory - this is your Sublime Text user directory. It will contain directories named Backup, Installed Packages, Local and Packages and some other ones you don't have to worry about.
    • In Windows 7, this is usually C:\Users\[username]\AppData\Roaming\Sublime Text 3.
    • In Mac OS X, this is usually /Users/[username]/Library/Application Support/Sublime Text 3.
  3. Exit Sublime Text.
  4. Create a new directory called something like ST3 somewhere in Dropbox. Mine is at Dropbox\App Backups\ST3.
  5. Move the Packages folder from your ST user directory to the ST3 directory in Dropbox.
  6. Open up a Command Prompt or Terminal window with Administrator privileges (right click and choose "Run as Administrator") and navigate to your ST2 user directory.
  7. Create a symbolic link for Packages:.
    • In Windows 7, this will be something like mklink /D "Packages" "C:\[ST3 Dropbox directory]\Packages".
    • In Mac OS X, this will be something like ln -s /[ST3 Dropbox directory]/Packages ./Packages.
  8. Wait for Dropbox to finish syncing.
  9. Open ST3 and confirm that your settings and packages are still working. If not, something's gone wrong in the above steps.

Subsequent computers:

For each other computer that you want to sync your ST settings to:

  1. Install Package Control into Sublime Text.
  2. From the Preferences Menu, choose Browse Packages (Sublime Text > Preferences > Browse Packages... on OSX.). Then navigate up one directory - this is your Sublime Text user directory. It will contain directories named Backup, Installed Packages, Local and Packages.
  3. Exit Sublime Text.
  4. In your Sublime Text user directory, delete or rename the Packages directory; you'll be replacing it with the Dropbox one.
  5. Open up a Command Prompt or Terminal window with Administrator privileges (right click and choose "Run as Administrator) and navigate to your ST user directory.
    • In Windows 7, this is usually C:\Users\[username]\AppData\Roaming\Sublime Text 3.
    • In Mac OS X, this is usually /Users/[username]/Library/Application Support/Sublime Text 3.
  6. Create a symbolic link for the Packages directory:
    • In Windows 7, this will be something like mklink /D Packages "C:\Users\[username]\Dropbox\App Backups\ST3\Packages".
    • In Mac OS X, this will be something like ln -s /[ST Dropbox directory]/Packages ./Packages.
  7. Open Sublime Text and bask in your marvelous synced settings.

More blogs about sublime-text: