7 ms·
Configuring Sublime Text 2
- ivanbernat 14y agoSublime team by default need to advertise Packages and just how much you can customize the thing. You'd be amazed just how powerful this thing can be - once you get the hang of it, the shortcuts and some basic packages. My favorite ones are Zen Coding (now deprecared in favor of Emmet) and SublimeERB when working with ERB - the front-end dev in me cries of joy when using them :-)
- decad 14y agoI agree I recently installed Emmet and it has vastly improved my life (front-end dev)
- molecule 14y agoMy first piece of advice is to set up a command line alias for Sublime... Sublime ships w/ a command-line executable: /usr/bin/subl
- knotty66 14y agoMaybe on OS X, on Linux I always end up rolling my own ...
- adrianhoward 14y ago/usr/bin/sublime on Linux installs I believe.
- ssorallen 14y agoThey have a nice guide how to set it up too: http://www.sublimetext.com/docs/2/osx_command_line.html http://www.sublimetext.com/docs/2/osx_command_line.html The one-step setup is: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
- subpixel 14y agoNitpick: the trailing 'l' has always seems superfluous to me - my alias is 'sub'
- molecule 14y agothe trailing 'ubl' has always seemed excessive to me: alias s='subl'
- lunixbochs 14y agoIf you find the "s" too much to type... and the "ubl"... and the space... Voila! command_not_found_handle() { [[ -e "$1" ]] && subl "$1" }
- stevvooe 14y agoI just hooked my shell to my frontal lobe. I find aliases to be restricting.
- jurre 14y agoThis hasn't been working for me for some reason on OSX, the posted alternative however did work so I'm quite excited!
- molecule 14y agoah, on further inspection: I had created a symbolic link to /usr/bin The actual executable is buried in Sublime's .app directory: Sublime Text 2.app/Contents/SharedSupport/bin/subl
- kbd 14y agoOn OSX I just use the built-in 'open -t', which works so long as Sublime Text is configured to open .txt files.
- Foxboron 14y agoor you just get the PPA https://launchpad.net/~webupd8team/+archive/sublime-text-2 https://launchpad.net/~webupd8team/+archive/sublime-text-2
- ryanpetrich 14y agoYou can also pipe text into subl and it will open in a new Sublime Text tab. find . | subl
- batgaijin 14y agoDoes sublime text 2 work well with CL or Haskell?
- shriphani 14y agoI tried using it with Clojure (FWIW) and I really disliked the REPL's style (maybe I am too used to Emacs here). I have since decided to use Sublime Text for Python, LaTeX, C, C++ (it really shines there) and Emacs for Racket and Clojure (I don't use it so much).
- jewbacca 14y agoI use it to write Haskell. The syntax highlighting screws up the first line of multiline record declarations. Out of the box, it can't run a Hoogle search or launch GHCI like TextMate did. It's definitely not a fully-featured Haskell IDE, but it's a usable basic editor. Depending on what you're used to, it may or not be adequate. I switched because I liked the default color theme better (... I mean... because TextMate was being abandoned).
- jfb 14y agoNo idea, but trying to write lisp in anything other than Emacs/SLIME seems like an exercise in purest madness.
- togasystems 14y agoCan someone explain the difference between command-p and command-t?
- rhizome 14y agoOn my nearly-vanilla install, cmd-t doesn't do anything.
- jmelloy 14y agoTraditionally, command-P prints and command-t opens a new tab.
- sandyarmstrong 14y agoNeither of these are the case in Sublime Text 2. cmd-n opens a new tab and cmd+shift+n opens a new window.
- sandyarmstrong 14y agoOn OS X, they appear to do the same thing. On Windows, ctrl-t doesn't seem to do anything. I don't have Sublime set up on Linux so I can test there. I suspect the author has an older configuration since he's been using it for almost 2 years, and that the keybinding probably changed since then to cmd-p.
- ryanmacg 14y agoSublime has both cmd-t and cmd-p in the OS X version, the general thinking for this seems to be related to other editors (such as Textmate) having used cmd-t. By having this in Sublime by default switching becomes easier.
- veidr 14y agoIIRC, ⌘P was Sublime's original mapping, and then ⌘T was added on Mac because the then-extremely-popular TextMate had a well-known ⌘T function that was similar.
- 14y ago
- shade 14y agoAnother useful tip for navigation - when using the fuzzy search, you can start typing a filename to jump to that file, then with that still in the search box, hit # and start typing a keyword to jump to in that file. So if you wanted to find something with the class btn_order in index.aspx, in Windows you'd hit CTRL-P and type "index#btn", hit enter, and there you are. You can of course scroll up/down through the available files matching the filter before you hit # -- the keyword search applies to the currently selected file.
- heelhook 14y agoAn even better one IMO is @, same thing as with # but it uses symbols.
- calinet6 14y agoOr : to jump to a line number. Beautiful.
- missing_cipher 14y agoCTRL+G in Windows.
- calinet6 14y ago(this is when in the Ctrl+P fuzzy-file-search box, so the colon : in that context also jumps to the line number in the found file)
- wonderzombie 14y agoYou can get that via Ctrl-R (or Cmd, if on a Mac). Ctrl-; brings up fuzzy matching for words in the file.
- heelhook 14y agoCmd-R is just for jumping to symbols in the current file, Cmd-T+@ to jump to a symbol on any given file.
- alexpopescu 14y ago> FileDiffs - This can be a really useful tool for diffing files. [...] This is something I've been looking for. I had to use an external diff tool or vimdiff, but this might change things quite a bit. The other thing that would be a great addition to ST2 (if not existing already) would be a search by symbol in all project files. Currently Cmd+R is great for navigating to a symbol in the current file. Extending this to a whole project would be awesome.
- grimgrin 14y agoHere are two other sources that I found pretty useful when switching to Sublime. http://net.tutsplus.com/tutorials/tools-and-tips/essential-sublime-text-2-plugins-and-extensions/ http://net.tutsplus.com/tutorials/tools-and-tips/essential-s... I'm not a huge fan of video sources when I could just look at images/read text and get it done faster, but these do offer some pretty good stuff. I was fond of him giving me the idea to use the Gist plugin, creating a new account, and have a great way to manage snippets. http://net.tutsplus.com/articles/news/perfect-workflow-in-sublime-text-free-course/ http://net.tutsplus.com/articles/news/perfect-workflow-in-su...
- doktrin 14y agoThis (free) video walkthrough is a terrific resource, and with no disrespect to the OP, is a better resource regarding getting the most out of ST2.
- feniv 14y agoAs a python programmer, these were the first two settings I configured after installing Sublime Text. "tab_size": 2, "translate_tabs_to_spaces": true You can either set them as Preferences > Settings - Default or Settings - Syntax specific
- natrius 14y agoUh, two space indentation in Python? Consistency is valuable. Everyone else who writes Python uses four spaces. http://www.python.org/dev/peps/pep-0008/#indentation http://www.python.org/dev/peps/pep-0008/#indentation
- tass 14y agoThis is a great reason to use tabs over spaces.
- buttscicles 14y agoIt wouldn't matter when people don't adhere to standards anyway.
- ketralnis 14y agoThat everybody else uses spaces?
- yen223 14y agoIf the file uses tabs, at least you can choose to display the indentations as 2 spaces or 4 spaces. If the file uses spaces, you don't get to choose.
- SquareWheel 14y agoThis is my reason for preferring tabs. Plus changing indent levels is faster via arrow keys.
- modeless 14y agoThe biggest win I've had from configuring Sublime Text is in setting up build systems. Specifically, configuring F4/shift-F4 (skip to next/previous error). The build system integration is rudimentary (and I hope that's a focus for Sublime Text 3) but "skip to next error" is all you really need to be productive.
- nicholassmith 14y agoIf you're using Sublime I'd highly recommend writing some Snippets, there's plenty you can write and it gets you digging into Sublime's docs. Helped me get used to Sublime a lot more.
- af3 14y ago> "trim_trailing_white_space_on_save": true, # trims trailing whitespace bad for Markdown, as it will delete spaces that are needed for newline, I believe.
- rmccue 14y agoYep, so if you put this on, make sure you override it back in the Markdown-specific settings.
- freerobby 14y agoI find this to be a questionable practice. When coding I like the idea of "trim whitespace from _my changes_ on save", but doing it globally within a file creates a lot of diffs and makes for convoluted commits. Having a +/- 75 lines when you fix a typo in a comment is annoying when doing a code review. If everybody on the team uses SublimeText (or an equivalent vim extension) I think this is a good idea, but when you have some folks using TextMate or other editors that are notorious for leaving extra whitespace, I find it better just to live with it.
- jemeshsu 14y agoAlways wondering why the version '2' is emphasised heavily. Never heard of Sublime Text when it is version 1. The version number is part of the app binary file name. It is the only OS X app in my Mac that has the app name together with version number on the menu bar. Nothing wrong with this "unconventional", just that it will break a little thing when Sublime Text 3 is released. For example to change command prompt linking as in "ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime".
- zeitg3ist 14y agoThe entire Adobe Creative Suite does that. It's annoying.
- calinet6 14y agoThey're not too big on marketing. Doesn't matter; it still works great.
- lobster_johnson 14y agoI suspect people emphasize it because the author does. Version 2 is a radically different piece of software from version 1, and I believe that during the alpha/beta development period you could run ST1/2 concurrently if you liked. This may be the reason why the folder name embeds the version number.
- javan 14y agoHere's my Github-themed, less-ugly-than-the-default setup: https://gist.github.com/3164018 https://gist.github.com/3164018
- darkstalker 14y agoThe hardest part of configuring Sublime Text is the color scheme. It's written in some apple XML format that's hard to edit by hand.
- tomschlick 14y agoThey accept textmate formatted schemes so there are many out there already that you can use.
- Foxboron 14y agohttp://snorpey.github.com/color-scheme-builder/ http://snorpey.github.com/color-scheme-builder/
- vinhnx 14y agoMaybe you will like this https://github.com/vinhnx/Ciapre.tmTheme https://github.com/vinhnx/Ciapre.tmTheme
- gegenschall 14y agoI really like this theme. Looks best on Ubuntu. :-) https://github.com/buymeasoda/soda-theme https://github.com/buymeasoda/soda-theme
- vinhnx 14y agoAwesome! Glad you like it! :)
- hayksaakian 14y agoTip I figured out accidentally: command + 1 through x changes to the 1 through xth tab in the current window.
- HyprMusic 14y agoKind of awesome seeing him mention one of my plug-ins I created to scratch a simple itch (Auto Semi-colon). Definitely motivated me to work on the slight improvements I wanted to implement.
- tylermauthe 14y agoThis is the real lesson of this article: "As a craftsmen it is important to understand and use our tools properly. Just as a painter needs to use the best paint and brushes - and understand how to use them - a developer should understand and use the best software tools available. For me, Sublime Text is the highest-quality brush available." Great stuff, thanks!
- goldfeld 14y agoWhy isn't there a plugin to Find in Files in the same way Ctrl-P works? Open the best match in buffer as results stream in.
- manojlds 14y agoWhat I need to know is how are people versioning the settings? For Vim, a simple .vimrc is all I need to take care of. What do people do for Sublime?
- heartbreak 14y agoMaybe you should, you know, download Sublime and try it out? The settings are stored similarly to Vim.
- manojlds 14y agoSo kind of you to assume that I haven't used it. I use it on Windows and after I formatted my Window 7 and am now on Windows 8, I don't have my Sublime text preferences with me and was wondering how people are versioning and syncing theirs. In vim ( which I don't claim to be an expert user), every setting is in .vimrc. Including the vundler bundles. Now, I have to reinstall all the plugins from Package Control. How do I version the settings? Get a list of installed plugins? Those were my questions, after having used Sublime for a few months now.
- jimhart3000 14y agoNot sure the path for windows, but on OS X you could make a repository at ~/Library/Application Support/Sublime Text 2/Packages. It doesn't separate out system packages (basically all your language info/syntax highlight settings), but all your user-installed packages go there and user settings are in Packages/User. If you cloned that folder into a fresh install, it should bring everything you had previously along with it.
- Derbasti 14y agoThat is actually a big gripe I have with ST2. I would love ST2 to have its config files in an easy Unix-like place. Like dotfiles, or better yet, dot-directories. (why dot-dirs instead of dot-files? Because while Windows does support symlinks, many programs do delete/newfile instead of modifying files, which breaks symlinks. In a dot-dir, that does not matter.) But really, this is not a big gripe, and furthermore one easily solvable uing symlinks.
- eta_carinae 14y agoSomething the article misses: Sublime Text 2 already comes with a command line front end called "subl". Just copy it in your favorite bin/ directory and you can open your files with it from any shell.
- pygy_ 14y agoEven better: use a symlink. You won't have to copy each update. ln -s target link thus: sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
- scq 14y agoI set Ctrl-Tab and Ctrl-Shift-Tab to behave like they do in web browsers and notepad++: [ { "keys": ["ctrl+tab"], "command": "next_view" }, { "keys": ["ctrl+shift+tab"], "command": "prev_view"} ]
- yen223 14y agoAwesome stuff. I would dare say the command palette alone makes ST2 better than Vim.
- kellishaver 14y agoHere's my (rather opinionated) setup. I'm quite visually impaired, so getting my editor just right so I can code comfortably is important. Most of my changes have to do with making things easier to see. http://kellishaver.tumblr.com/post/29158801106/sublime-text-2-for-the-visually-impaired http://kellishaver.tumblr.com/post/29158801106/sublime-text-...
- SquareWheel 14y agoI've been tweaking my Sublime for 5 months or so, and this is how my config file looks so far. "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", "detect_indentation": false, "detect_slow_plugins": false, "font_size": 10, "highlight_line": true, "highlight_modified_tabs": true, "margin": 0, "move_to_limit_on_up_down": true, "remember_open_files": false, "shift_tab_unindent": true, "tab_completion": false, "tab_size": 4, "translate_tabs_to_spaces": false, "word_wrap": false I'd suggest going through the default settings file to see what options there are to change. It's pretty darn configurable. I'd also like to suggest the plugins Bracket Highlighter and Emmet (previously Zen Coding). I also use Package Manager, Sublime Linter, and FileDiffs as mentioned in the article.
- wldlyinaccurate 14y agoThis is just my opinion, but I think detect_indentation should always be turned on. The reason being that having mixed indentation in a file is worse than having the "wrong" indentation.
- SquareWheel 14y agoI use tabs strictly in my projects, but often times I work on websites built by other people and there's a hodgepodge of 2 spaces, 4 spaces, and tabs. It's best to leave it as it is and get out as soon as possible.
- wldlyinaccurate 14y agoThis post reminded me that 90% of the developers I work with don't set their editor up properly. I'm constantly finding Windows line endings and trailing whitespace. I wrote this (really short) guide that I send to new developers, but imo editors should come configured like this out of the box. http://wildlyinaccurate.com/setting-up-your-editor http://wildlyinaccurate.com/setting-up-your-editor
- s1 14y agoHow to make the same settings for root and my user?
- purephase 14y agoIf it is the preferences you're modifying, there are per-user specific settings and default. I believe the default settings will apply for all users.
- gavanwoolery 14y agoFor those who sometimes prefer straight GUI, you can just drag the folder into Sublime Text (or Textmate) and it will open it in the sidebar (probably obvious to some, but I did not know to do it until I saw somebody else do it). Also, another thing I have grown really attached to: Command-Option [1,2,3,4] to open up multiple views within one window, good for viewing several files at once.