Also a must-have: Sublime Package Control<p><a href="http://wbond.net/sublime_packages/package_control" rel="nofollow">http://wbond.net/sublime_packages/package_control</a><p>Useful for installing things like themes, syntax awareness, code linters, etc...
You guys know that you can go to the Default Keymaps file and get all of these tips in one list right? You can even change them...<p>EDIT: Just for fun, here is that file on OS X: <a href="https://gist.github.com/3117613" rel="nofollow">https://gist.github.com/3117613</a> Notice the "context" definitions. Also check out how the auto-pairing functionality is defined in terms of the key binding DSL. And how you can define nonstandard layouts for the panes. And so on.<p>Sublime is great. It reminds me of a less insane version of Foobar2000.
Ctrl+Alt+P to get a dialog for opening all your Sublime projects.<p>Ctrl+R for navigating to functions or classes within the current file.<p>SublimeClang gives you Visual Studio-style Intellisense, static analysis, and jump to definition/implementation.<p>When setting up Vim emulation, you'll need to install VintageEx and change some of the default bindings (Ctrl+Shift+P+"key" to see the binding files). You'll also want SublimeBlockCursor.<p>For example, put the following in the user defined keymap to override the defaults:
[
{ "keys": ["ctrl+f"], "command": "move", "args": {"by": "pages", "forward": true} },
{ "keys": ["ctrl+b"], "command": "move", "args": {"by": "pages", "forward": false} },
{ "keys": ["ctrl+shift+f"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} },
{ "keys": ["ctrl+shift+b"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} }
]
Further to point F: if you hold down control, you move by word segment - this is camel-case (and underscore) aware. So, if I am at the front of the word "cakeParty", I can move to between 'e' and 'P' by holding control and pressing the right arrow key.<p>(This is in ST2 for Mac OS X - I'm sure there's an equivalent feature in ST2 for other systems.)
Cmd + d selects the current word.<p>Subsequent Cmd + d presses will select the following instance of the word for editing. Makes it easy to do things such as renaming a local variable or changing both the opening and closing element of a HTML tag.
Cmd-P is useful for opening existing files, but what's the preferred way for creating them?<p>I eventually had to get an extension and modify it to replicate emacs' c-x c-f to create files.
One of my favorite features is the flexibility of the Goto Anything dialog (CMD+T or CMD+P) e.g.:<p>- Goto file: "con pos" -> app/controllers/posts_controller.rb<p>- Goto line in file: "con pos:100" -> app/controllers/posts_controller.rb line 100<p>- Goto function in file: "con pos@foo" function foo in app/controllers/posts_controller.rb<p>Also one that came up recently is CMD+ALT+Q to auto-wrap long comments to your ruler (e.g. 80 columns).
Something else you might not know -- multiple selection via command clicking (also implemented in Excel, for example) was in the original (1985ish) Apple Humn Interface Guidelines.
Another one i've found useful is CMD+D / CMD+K+D. CMD+D finds the next instance of the current selection and creates another cursor there (and selects it as well). CMD+K+D skips the current selection and finds the next one.<p>A fine grained find+replace/modify :)
For those that like/need to print their code, there is a plugin that does that:
<a href="https://github.com/joelpt/sublimetext-print-to-html" rel="nofollow">https://github.com/joelpt/sublimetext-print-to-html</a>
I've been using {g}vi{m} for 20 years now, but just bought ST2. I like how this whole discussion revolves around finding keystrokes in ST2 that yield the convenience of doing things I took for granted in vim. Maybe I should just yield to the wisdom of the crowd, go back to VIM, forget about having a file explorer on the left side (NERDtree's wonkiness drove me to ST2), and learn to use Ctrl-P. It's what people keep suggesting to use in ST2.
I tried out Sublime for a day or two, and think it does a lot of things right. However a few small things also bugged me right off the bat, may be someone can help.<p>- Code folding:
No fold level 1 option, would like a hotkey.
No line at the fold, just an icon at end of line.<p>- No GUI for options or syntax/theme editing. I give geany a pass on this (has options but not theme
editing) because it is free. Many other free choices have
this (N++, Programer's Ed.) but not Sublime. I don't wanna
dig through docs for hours (again) to get another editor set
up. It's a shame this stuff isn't standardized by now.<p>This might be because they made their own widget set and
haven't finished yet. If so, it was a mistake. QT, wx, or
native would have been fine. No need to reinvent the wheel.<p>Configuration: The mess of weird filenames and extensions in the config folder was a turnoff also. Json is nicer in many respects than xml, but I can't say it's optimal for config files.
You can also get multiple cursors from the keyboard with ctrl+alt+(uparrow or downarrow) not the most convenient of keybindings but can be rebound if you look for "select_line" in the default keybindings. (Linux and Windows)
Cmd-Shift-P is incredibly useful. It lets you intelligently search all the commands.<p>Want to Save-all? Cmd-Shift-P, type 'save' and hit enter. Plus it takes into account any customizations or add-ons you might have put together.
You can also search and do multiple selection with a regular expression, which is awesome. I've used this heavily in the past few weeks. The only problem I've had is that all searches appear to run on the main thread, so when working on a sufficiently large file, the whole application blocks like hell. And to make it even worse, they update search results on the fly, meaning that for every new character you enter it blocks. I've taken to writing my expressions fully in a random textfield elsewhere, and pasting them in all at once.
Things sublime text lacks that bug me: drag and drop of selections. It would be even better if it could do what nedit can do with drag and drop, or drag and clone of both normal and block selections.
You can also use your middle mouse button to make block selections, or doing things like making a long vertical line of multiple cursors (handy if you have an HTML list of varying line lengths, you can draw a long vertical line of multiple cursors, then use the left and right arrow keys and home and end keys to make changes to all of the lines quickly).
I've kept my favorite shortcuts open in a panel for about a week, so I could learn them by heart: <a href="http://pastebin.com/hQtYKzhN" rel="nofollow">http://pastebin.com/hQtYKzhN</a>
Favorites include: Expand selection (to various levels), close tag, block commenting and splitting lines!
ctrl + t swaps text, for example foo(bar) if you place the cursor before the parenthesis and press ctrl + t it will become bar(foo).<p>ctrl + m when in a bracket sets the cursor to it's matching bracket.<p>ctrl + up or ctrl + down scrolls the document up or down.<p>ctrl + g goes to a line.
Is it possible to do multi-line editing like Sublime Text but in Vim? I use both, and this was the feature that got me out of Terminal, but besides this I can't think of anything else offhand for what ST2 can do that Vim can't do.
Here's a (PC-oriented) cheat sheet of some keyboard shortcuts:<p><a href="https://gist.github.com/1958143" rel="nofollow">https://gist.github.com/1958143</a>
switched to sublime from np++ 3 months's ago, happy bunny! but i miss the np++ file explorer that allowed me to perform cut/paste/rename file & folder actions and even access the top level OS explorer menu within the editor so i had ,svn,archive,properties and send to<p>[edit] typo