Skip to content

Instantly share code, notes, and snippets.

@NickTomlin
Last active December 16, 2015 21:08
Show Gist options
  • Save NickTomlin/5497127 to your computer and use it in GitHub Desktop.
Save NickTomlin/5497127 to your computer and use it in GitHub Desktop.
Quick notes on my ST2 Setup.

I use sublime text 2 (with vintage mode) to do front-end centric Drupal development, and some Python and Node.js on the side. This works in conjunction with my Dotfiles to make me a better, happier dev.

I love ST2 and use it everyday, but there are still tons of great plugins that I don't know about. Feel free to comment with any suggestions.

Happy Hacking!

-Nick

Using sublime from the command line

Follow these instructions to set up an alias that you can use on the command line E.g. subl *.png.

To open files at a specific line number, add a :<line-number> after the filename. E.g. subl readme.md:20

Syncing

To make sure all my machines have (relatively) similar settings, I keep my User directory in my Dropbox folder, and replace the default ST2 User directory on each new machine with a symbolic link to the Dropbox folder. E.g. in terminal:

ln -s ~/Dropbox/User /Library/Application Support/Sublime Text 2/Packages/User

This works great for syncing preference files, and mostly works for packages (which get installed by package control after restarting ST2).

Packages

It all starts with Package Control, which makes everything easy-breezy.

Themeing

Linting

  • CSS/PHP/JS/Python/Ruby: SublimeLinter
    • This is a complete lifesaver. Especially for sensitive languages like PHP (damn semicolons) or Python

    • I've found that I prefer the gutter mark notifications, instead of the normal line ones. You can set that by adding the following to your SublimeLinter.sublime-settings file:

        "sublimelinter_gutter_marks": true,
        "sublimelinter_mark_style": "none",
      

Version Control

  • ST2 Git
    • Especially awesome when used with the "add selected chunk" feature. You pinpoint the parts of your work that you want to commit without the hassle of add --interactive
    • Do note that if you are using the non-system version of Git (if you installed the latest with homebrew), you will have to set your git path in the Git.sublime-settings prefence file.
  • GitGutter
    • Makes diffing unstaged changes a snap. Really excellent when combined with the 'add selected text' featuer of ST2 git.

File Browsing

Front-End stuff

  • CSS / Pre-Processors
    • Emmet (Did this change my life? Yes it did)
    • SCSS (Syntax Highlighting)
    • Less (Syntax highlighting)
  • JS Packages
    • Bower (Great for grabbing jQuery plugins / latest jQuery)
  • Live Reload
    • I don't use an ST2 Plugin for this anymore. Instead, I use a guard task with the LiveReload chrome plugin, how-to here

Drupal

GoTo Drupal API

@todo: get a better ST2 Drupal config

Preferences

Default Preferences location by OS

  • Windows: %AppData%\Sublime Text 2\Packages\User

  • Mac OS: ~/Library/Application Support/Sublime Text 2/Packages/User/preferences.sublime-settings

  • Linux: @todo

My Preferences.sublime-settings file:

  {
    // stop go to anything from indexing these files
    "binary_file_patterns":
    [
      "*.jpg",
      "*.jpeg",
      "*.png",
      "*.gif",
      "*.ttf",
      "*.tga",
      "*.dds",
      "*.ico",
      "*.eot",
      "*.pdf",
      "*.swf",
      "*.jar",
      "*.zip",
      "*.eot",
      "*.woff",
      "*.svg",
      "*.ttf"
    ],
    // better readability for file names
    "bold_folder_labels": true,
    "caret_style": "phase",
    // causes issues (for me)
    "detect_indentation": false,
    // annoying
    "detect_slow_plugins": false,
    // detect annoying whitespace BEFORE commiting
    "draw_white_space": "all",
    "fade_fold_buttons": false,
    // stop go to anything from indexing these folders
    "folder_exclude_patterns":
    [
      ".sass-cache",
      ".git"
    ],
    // download at: http://damieng.com/blog/2007/11/14/droid-font-family-courtesy-of-google-ascender
    "font_face": "Droid Sans Mono",
    "font_size": 12.0,
    // prevent unsaved tabs form opening on ST2 startup
    "hot_exit": false,
    "ignored_packages":
    [
    // I like vintage mode, so it's commented out here
    // ST3 Users, check out https://github.com/guillermooo/Vintageous
    // "Vintage"
    ],
    "line_padding_bottom": 1,
    "line_padding_top": 1,
    // better file "grouping" for opening files from CLI
    "open_files_in_new_window": false,
    // cleaner exits
    "remember_open_files": false,
    // overriden on a language by language basis
    "tab_size": 2,
    "theme": "Soda Dark.sublime-theme",
    // because better developers do this ^^
    "translate_tabs_to_spaces": true,
    // Whitespace Control
    "trim_automatic_white_space": true,
    // Whitespace Control v2
    "trim_trailing_white_space_on_save": true,
    // 10.7 is dumb
    "use_simple_full_screen": true,
    "vintage_start_in_command_mode": true,
    "vintage_use_clipboard": true,
    // better visuals when combined with "phasing" caret style
    "wide_caret": true
  }

Vintage

Vim is really sweet, and I switch back and forth between ST2 and Vim pretty regularly, but ST2 and Vintage mode make an unbeatabale editor (IMHO).

I have a written a short list of ST2 vintage tricks for your (mostly my) edification.

@todo: explain particularities

Inspiration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment