The best kittens, technology, and video games blog in the world.

Friday, October 25, 2013

Recommended Sublime Text configuration

102503666.jpg by The Consumerist from flickr (CC-BY)

Turn on Sublime Text, go to user configuration, press Cmd-, (or Ctrl-,) to go to User preferences, delete whatever was there before, and just copy and paste this:

  "ensure_newline_at_eof_on_save": true,
  "show_full_path": true,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": true,
  "word_wrap": true

OK, now explanations.

First and most important - "tab_size": 2 and "translate_tabs_to_spaces": true enforce 2 space indentation default. As civilized people living in the 21st century we shouldn't be indenting with tabs like animals! Note that I didn't override "detect_indentation": true, so if you open a file with screwed up indentation already, Sublime will use that file's indentation within it, no matter how wrong. This only applies to new files.

Next "ensure_newline_at_eof_on_save": true and trim_trailing_white_space_on_save: true normalize whitespace in your files, reducing unnecessary version control conflicts, especially if everybody uses settings like that.

"word_wrap": true enables word wrap for source files (by default it is on for plaintext files, but off for source files). There are some formats like .feature which work better without word wrap, but for 99% of sources word wrap is the right thing to do, and even two 2560x1600 monitors don't provide enough screen real estate to always be able to expand all lines fully.

The last setting you'll need is "show_full_path": true. This is a fix for OSX's stupid idea of only showing fill name in title bar, instead of full path. Far too often multiple files in your repository will have the same file name, and full path is the only way to tell them apart quickly, and without this title bar is basically wasted space.

That's it for today. Coming next: a book on how to configure Emacs.

No comments: