11 ms·
Setting up Sublime Text 2
- ricardobeat 14y agoYou shouldn't set "trim_trailing_white_space_on_save": true unless you work alone, otherwise you're going to have random whitespace changes polluting your diffs.
- maccman 14y agoOur coding guidelines at Stripe specify that whitespace is to be stripped. It works if everyone does it. On the occasion where whitespace does pollute the diff, GitHub has a convenient feature where you can append '?w=1' to any diff URL and whitespace changes will be omitted.
- foobar2k 14y agoThe number of pull requests I get where the diffs are completely unreadable because someone has this feature enabled is insane. On certain whitespace dependent languages (I'm looking at you Python) simply supressing the whitespace in the diff is not an option. What are the arguments for having whitespace removal as a coding standard?
- senko 14y agoIt's dead easy to accidentally add (or remove) trailing whitespace, which you find out at git diff time. Unless you want to have whitespace changes in your commit, you have to manually revert those edits back. Having the editor just trim those automatically is just delegating the trailing whitespace care to a piece of software with a simple rule: no whitespace allowed. If the entire team working on a project agrees to this rule, everything's peachy, and it's really easy to convert an existing repo to it - whenever you touch a file, if there are whitespace changes, commit them to a separate commit. At the end of the day, it's just standard, so doing invasive changes to a project that doesn't follow that standard (as in the pull reqs you descibed) is wrong, but that doesn't mean the rule itself is bad. As for ST2, it allows easy per-project settings so you can easily enable it globally and disable on a specific project if needed (or vice versa).
- deleted 14y ago[deleted]
- mixmastamyk 14y agoTrimming at the end of line has no effect on python.
- Silhouette 14y agoBut other whitespace does, so globally disabling whitespace in a diff isn't very helpful.
- bct 14y agogit diff --ignore-space-at-eol
- lucian1900 14y agoYou will never have silly diffs because someone accidentally changed some trailing whitespace (because there isn't any).
- stormbrew 14y agoThe problem with universal whitespace removal isn't the output of the diff, imo, but the spurious conflicts in merges. A change should be minimal to allow easier merging. Ideally whitespace would be trimmed from lines that have otherwise changed, thus ensuring a gradual (though probably never completing) repair of the code.
- chicagobob 14y agowe also have a rule that when possible (like you've opened up an old file with whitespace issues), that you should clean it and do a whitespace changes only commit before getting to work. It makes everyone's life easier if they're not looking for the "real diff" in your commit.
- tiedemann 14y agoThat sounds great and diligent. Me and commits never seem to sync properly anyway (mostly because I am the sole dev on so many projects I guess).
- matb33 14y agoI turned that feature off because of Markdown. To force a carriage return, you need to have two spaces at the end of the line.
- FuzzyDunlop 14y agoI think it's fine so long as everyone agrees, or as long as people don't strip the whitespace in the same commit as their actual changes. Half the time the pointless whitespace is introduced by an editor that auto-indents for you.
- s00pcan 14y agoAs opposed to having trailing whitespace and mixed tab/space whitespace polluting your diffs? Configure your diff viewer to ignore whitespace.
- forrestthewoods 14y agoIt only pollutes your diffs if you're using a crappy diff tool. Whatever tool you use should have full control over showing leading, trailing, consecutive, or all whitespace differences.
- lobster_johnson 14y agoNo, the main problem is that it screws up merges. Until Git can ignore trailing spaces as part of the merge strategy, it will be a problem when someone removes trailing spaces in one patch and someone else modifies (with real code) those same lines. If you have a largeish number of changes it will be a nightmare.
- forrestthewoods 14y agoAraxis Merge, problem solved?
- lobster_johnson 14y agoI don't know it. But unless it's something that comes built into Git it's not useful. It needs to be something everyone has. That's the whole point.
- forrestthewoods 14y agoNah. Use araxis merge and all your issues go away forever. If other devs want to use shitty tools then that's their fault. If you have a repo and are trying to merge pull requests then you definitely should stop using shitty tools. Even if you don't trim whitespace you should have non-shitty tools for local usage. There's no reason to use shitty tools here.
- tmhedberg 14y ago> Until Git can ignore trailing spaces as part of the merge strategy It can: git merge -X ignore-space-at-eol
- Void_ 14y agoMore icon replacements: http://dribbble.com/search?q=sublime http://dribbble.com/search?q=sublime
- alexshenoy 14y agoI actually like that the preferences are stored in JSON. This is one of the features that pulled me in to Sublime Text.
- itsbits 14y agoi agree..its easier to edit
- FuzzyDunlop 14y agoI'd love it if they were stored in dotfiles (something I like about Textmate 2), but at least all your config gets stored in a nice User package.
- account_taken 14y ago+1 Actually, things are stored in a few directories. It took a while to figure out where Sublime stores everything so I could write a dotfiles script for it. Having to set things up through Package Manager is a pain. Not sure why that's the first step whenever I read an article on Sublime. A simple package file script that git clones/pulls plugins is more maintainable.
- nuclear_eclipse 14y agoI keep my ST2 package manager config stored in my dotfiles repo, so setting up a new Sublime instance is as easy as just opening ST2 for the first time and letting the package manager fetch the appropriate plugins automatically.
- account_taken 14y agoWhat bootstraps package manager?
- nuclear_eclipse 14y agoSorry, I keep that whole plugin as part of my dotfile repo. When the plugin upgrades itself, I just commit that upgrade. When I install my dotfile repo on a new machine, I have a script that symlinks everything to the repo, including my ST2 data. I then have my .gitignore set up to ignore all the plugins that get installed, but specifically track changes to the package manager plugin, as well as any other custom plugins I write for myself.
- spacesuit 14y agoA few more Sublime Text plugins worth checking out: AdvancedNewFile -- easy file/directory creation Alignment -- shortcut for instant alignment Emmet -- essential for HTML/CSS GitGutter -- see diff marks in gutter Origami -- additional shortcuts for split panes VintageEx -- emulation of Vim's Ex-mode The Vim emulation isn't one-to-one, but it's pretty good with Vintage mode enabled and the VintageEx plugin installed.
- deleted 14y ago[deleted]
- itsbits 14y agoAnother awesome plugin in ST2 is WebInspector https://github.com/sokolovstas/SublimeWebInspector https://github.com/sokolovstas/SublimeWebInspector for Web Devs
- hauget 14y agoThis helped me a lot when I got started with Sublime http://net.tutsplus.com/articles/news/perfect-workflow-in-sublime-text-free-course http://net.tutsplus.com/articles/news/perfect-workflow-in-su... Good intro to basic configuration, shortcuts & vintage mode
- baby 14y agoIt's also free, and written by someone who actually used ST2 for more than a month.
- looki 14y ago"The default website, icon, and theme are ugly to say the least" I can't be the only one who completely, utterly disagrees with this? I absolutely love the default theme and I think the icon looks great (much better than the alternative provided). That being said, I don't want to start a whole pointless discussion about taste here, it just kind of bothered me to read something like that in a blog post that talks about setting up a text editor.
- pdog 14y agoYeah, I didn't understand this either. "Sublime's initial look leaves a lot to be desired." Really? I think it looks great. Here's another post that calls Sublime's default theme "pretty ugly" and "god-awful": http://floatleft.com/notebook/making-sublime-text-2-beautiful http://floatleft.com/notebook/making-sublime-text-2-beautifu...
- Helianthus 14y agoI love the icon. I don't have an opinion about the default theme except to say that part of the whole point of Sublime (to me) is to find a custom color theme for your code. It's like css for your workspace! I use a modified Cobalt that has much more green in it. Honestly I love that Sublime allows you to fulfill that urge to express yourself while you're expressing yourself (yo dawg etc.).
- jasonm23 14y agoIt's a bit like a teenies version of Emacs.
- deleted 14y ago[deleted]
- Camillo 14y agoI think ST2's chrome is functionally bad, rather than aesthetically, and I'm not sure it can be fixed with themes. The way the sidebar and the tab bar interact to show which document is active can be extremely confusing.
- codexon 14y agoI was looking at Sublime Text for Go, and apparently the autocomplete box cannot be expanded so it is unable to display function arguments. https://github.com/DisposaBoy/GoSublime/issues/212 https://github.com/DisposaBoy/GoSublime/issues/212 Probably an issue for other languages as well.
- senko 14y agoIf you use ST2 for working on Django projects, try https://github.com/dobarkod/DjangoNoseTestRunner https://github.com/dobarkod/DjangoNoseTestRunner (installable also via Package Control) for running only the test under cursor. It's probably saved us hours of (cumulative) time already.
- panabee 14y agowhat plugin do people use for highlighting brackets and parentheses? the default underline mode is faint and not very helpful. i have heard of one or two, but i'm curious to hear what people on HN use. thanks!
- missing_cipher 14y agoI'm using BracketHighlighter.
- panabee 14y agocool, thanks. that's one i saw before, but some people complained about performance degradation. have you seen any performance hit after installing the plug-in?
- missing_cipher 14y agoYou know, a few months ago I think so, but I could never find the culprit. I've had no issues recently, so maybe they updated it?
- snotrockets 14y agoI tried to like Sublime, I really did. Bought a license and used it for four months, before going back to Emacs. Sublime is nice, and easy to extend, but it only extends so far, while Emacs is infinitely extensible. You can practically live in Emacs[1]; some things I wanted to do in Emacs were hard to pull off, but I'm yet to find something it can't do. And it does so for years. Fashionable editors come and go, but Emacs forever stands; and if there is one thing I don't think I'll be able to ever do again, is learn another set of editor shortcuts. Those I used were drilled there ~10 years ago, and I don't think they'll ever come out. Also, author seems to take great deal about changing the editor theme and icon. Why should you ever care about that, outside a screenshot contest? Editor should look good by rendering a nice font at a size you find comfortable, highlighted in colors you find easy on the eyes. If you look at the chrome, well, you're not spending enough effort editing. [1] I'm not the one to start wars. vi might be just as good, but I'm not going to learn it this side of the river Styx.
- angrycoder 14y ago> [1] I'm not the one to start wars. vi might be just as good, but I'm not going to learn it this side of the river Styx Of course you aren't, as long as it is one of the two editors you approve of.
- snotrockets 14y agoI approve of anything that saves spaces and not tabs. I'm just not going to use it, and keep wondering why one diverts so much efforts to editors that aren't the One True Editor.
- hueyp 14y agoWhat do you use to replace command-T in ST2 in Emacs? I recently picked up Emacs because I'm doing a clojure project (I can't get ST2 to work with nrepl) but I am having a hard time without the command-T fuzzy search. I have ido and find-file-in-project installed but neither of them seem to include directories in the fuzzy search. So if I search 'custcore' it won't match 'customer/core.clj'. If I instead search 'core' it is too broad of a term. I really need very little out of an editor, but this is one of those things.
- mtp0101 14y agoI find it odd that Sublime is so widely loved. It seems like a way-station between Notepad and Vim/Emacs. The extensions are nice, and the GUI is easy on the eyes, but it seems that most of my peers outgrew their Sublime Text/Notepad++/Textmate stage by the time they completed their first year of undergrad. I would hate to be stuck in the slow world of Sublime Text limbo as a result of being too lazy to learn and customize Vim/Emacs.
- recursive 14y agoIt shouldn't be that surprising. I tried vim for a while, but I prefer sublime text. It's true that vim is more powerful, but for me that power seems to mostly theoretical. It doesn't seem to make me significantly faster in the real world. On the other hand, the basic text navigation keys in sublime text are the same as they are elsewhere in my os, so I don't have to switch in and out of "text editing mode" frequently. In any case, congratulations on advanced text editing learning curve.
- vec 14y agoA bit off topic, but the big win with Vim (and, from what I hear, emacs) isn't the speed per se; it's the lack of cognitive load. "I need to replace everything after the equals sign", for example, takes less concentration than "I need to move my cursor to the beginning of the word after the equals sign, hold shift, move it to the end of the line, and then hit backspace". Once I got past the terrible learning curve, being able to use those kind of abstractions made a noticeable difference in how much program state I can hold in my head while I'm changing it.
- chipotle_coyote 14y agoI have a love/hate relationship with Vim due to that sort of thing. In theory I agree with you; in practice I find it very easy to mis-navigate in Vim and find myself next to the wrong equals sign, or on the wrong side of the equals sign, or what have you. And in my experience, recovering from one of those errors, as quick as it is, makes me wonder why I didn't just use the mouse (or trackball, in my case) to click next to the damn equals sign in the first place. (Keyboard jockeys -- which I'm frequently one of, to be fair -- often underestimate how fast using the mouse actually is, I suspect, because we think of it as, "Oh, I have to move my hand all the way over there and move something and then move back, that's nuts!" Again in practice, I suspect the mouse removes a great deal of the cognitive load involved in navigation, and that may balance out more often than we're inclined to give it credit for.) Incidentally, in Sublime Text -- as well as Emacs and most Mac OS X applications, as this is a system-wide keyboard binding -- you could just hit ^K after the equals sign for "delete everything from here to the end of the line."
- andrethegiant 14y agoOne setting I find invaluable is to use Paste and Indent for ⌘V instead of the standard Paste. This adjusts your indentation to automatically match the context it's pasted in. To do this, put the following in your Key Bindings - User file: [ { "keys": ["super+v"], "command": "paste_and_indent" }, { "keys": ["super+shift+v"], "command": "paste" } ]
- gfunk911 14y agoYou just (minimally) changed my world. Thank you sir.
- chatmasta 14y agoTHANK YOU
- munimkazia 14y agoYou're my hero of the day.
- dechols 14y agoFor you python Sublime users: http://dechols.com/post/40402860395/sublime-text-2-python-development-environment-in http://dechols.com/post/40402860395/sublime-text-2-python-de...
- rydgel 14y agoAm I the only one to find Python syntax highlighting pretty poor? Is there any tip, color schemes or plugins to improve this?
- Kluny 14y agoI tried switching to the Soda theme as directed, didn't like it. And I'm dumb, and forgot to back up the original prefs file. Could someone remind me what the default theme is called?
- pedroo 14y agoJust delete the line. It should revert back to the default theme.
- emc 14y agoAlso for anyone that uses both Alfred (2.0) and sublime check out https://github.com/Humanoidism/SublimeIt https://github.com/Humanoidism/SublimeIt
- websitescenes 14y agoSublime 2 rules! Simple, great shortcuts and just plain nice to look at. They even let you use it for free. I bought it shortly after trying it out.
- kiernan 14y agoI do most of my editing on remote machines (both at work and at home) and haven't really been able to find a setup that works smoothly for this. Is everyone else developing everything on their local machines?
- balac 14y agoWhen I use remote machines I mount them with samba / ssh so I can use an IDE / Sublime
- 8ig8 14y agoYou could try the SFTP package. With it, you can mirror a remote directory locally and the package will automatically upload the change in the background. It has some other useful features for working on remote files. http://wbond.net/sublime_packages/sftp http://wbond.net/sublime_packages/sftp
- Poyeyo 14y agoYes, most of us use git.
- nshankar 14y agoGet me block level (vit, cit ...) commands in ST2 and I will switch. They are done very well in Vim.
- kyrias 14y agoVintage mode (which comes with ST) supports most common vim commands and either way there's plugins for most things and you can write your own for pretty much anything at all.
- johncoltrane 14y agoThis is still a very small subset. If you are a moderately advanced Vim user, neither Vintage nor VintageEX are enough, I'm afraid.
- kyrias 14y agoAnything that isn't built in you can add yourself...
- johncoltrane 14y agoVersus having it built-in in my current editor?
- zenocon 14y agoThe TrailingSpaces plugin isn't necessary. ST2 has an option in the default preferences to trim whitespace at the end of the line - just enable it. Not to come down too hard on the article or anything, but there are many other, far better resources for setting up and learning how to be productive in ST2. This book is good https://leanpub.com/sublime-productivity https://leanpub.com/sublime-productivity (I have no affiliation with the book.)
- Terretta 14y agoThat's all fine and good until you're using JADE: h1 | We build span.colored-text scalable | web sites & engineer span.colored-text powerful | platforms If you delete trailing spaces, you'll have no spaces between any word at the end of the line and the word in the next section. Point being: trailing spaces can be significant.
- zenocon 14y agoSo throw a nbsp; in front of the text in your span.colored-text Jade?
- sspiff 14y ago> The default website, icon, and theme are ugly to say the least I find the default icon better looking than the one the author is using, so I guess this is just a matter of taste. Same goes with the color scheme.
- taude 14y agoWhat's the easiest way to keep my Sublime configuration synchronized between machines? I've found that I sometimes have some plugins on one machine, and not another. It would be nice to be able to pull some file/files from GIT or something to keep configuration synced.
- ChikkaChiChi 14y agoMaybe SugarSync at this point.
- chesh 13y agoI recommend this approach to sync config files over Dropbox to get exactly the same editing environment from Win, Mac, and Linux: 1) move the /User folder under "Sublime Text 2/Packages" over to Dropbox/ST2/User 2) in Win goto CMD and from the %APPDATA%\Sublime Text 2\Packages folder enter: mklink /D "User" "path to\My Dropbox\ST2\User" 3) in Mac OSX/Linux goto the Packages folder (you can find the location under >Preferences>Browse Preferences) and enter: ln -s pathto/Dropbox/Sublime\ Text\ 2/User ./User The fantastic thing with this setup is that in any new machines, Package Control will automatically take care of installing any missing plugins.
- taude 13y agoThanks for this. Going to give it a try. Also appreciate that you've got some solution working across multiple OSes.
- ChikkaChiChi 14y agoI can't believe this many people care about how the icon looks.