http://wbond.net/sublime_packages/package_control
Useful for installing things like themes, syntax awareness, code linters, etc...
Installation is through the Sublime Text 2 console. This is
accessed via the ctrl+` shortcut. Once open, paste the following command
into the console:
import urllib2,os; pf='Package
Control.sublime-package'; ipp=sublime.installed_packages_path();
os.makedirs(ipp) if not os.path.exists(ipp) else None;
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbon
d.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime
Text to finish installation'
Are you kidding me? The product or package maintainer should handle this better.Plus it's easy as pie, and as anyone who's actually used Package Control knows, it would be worth it if you had to pluck a hair from an Argentinian llama and place it in your USB port while reciting the gregorian chant from Monty Python and the Holy Grail to install it. One line of actual Python is simply a convenient shortcut.
Naturally people ask if the 3rd package manager will become an official feature but that opens up a new can of worms.
Man, you got that right. They should make it so that it can be installed through Package Control.
Oh, wait...
For a bootstrapping method, this seems completely reasonable. It doesn't involve downloading inscrutable single-platform installers, or opening a shell window, or any other external dependencies. The whole process runs inside the one environment you're guaranteed to have: Sublime Text itself.
"Computer people generally design terrible computer interfaces because they are not only willing to cope with something bad, they're pleased to."
- Alan kay, Personal Computing Historic Beginnings
I'd prefer that to a black-box installer.
EDIT: Just for fun, here is that file on OS X: https://gist.github.com/3117613 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.
Sublime is great. It reminds me of a less insane version of Foobar2000.
Ctrl+R for navigating to functions or classes within the current file.
SublimeClang gives you Visual Studio-style Intellisense, static analysis, and jump to definition/implementation.
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.
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} } ]
(This is in ST2 for Mac OS X - I'm sure there's an equivalent feature in ST2 for other systems.)
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.
For one thing, it goes a surprisingly long way to making up for not having language-sensitive refactoring tools if you’re renaming things, changing parameter lists, etc.
Also, you can make a selection in advance rather than relying on the default of selecting the current word. That selection can even span line breaks and/or include indentation. If you then select some/all instances of the same text as starting points using Ctrl+D, you can change not only the copies of the text but also (for example) extend the selections to include whatever is immediately before or afterwards (even if that is different in each case) or move to the start or end of each line. It’s a quick way to do a lot of common search-and-replace type operations without getting bogged down in regexes or macros.
A related useful technique is using (on Windows) Ctrl+Alt+up/down, which moves up/down a line creating multiple cursors as you go. If you then do Shift+left/right, you can get a “column selection” effect, for example. (You can also drag with the middle mouse button to select a column.)
I hope ST2 will build on these basic features as time goes on. It could allow incremental forward/backward search without cancelling the multiple cursors, let you cycle around which cursor is shown or will be left when you hit escape to cancel multiple mode, maybe even temporarily split the display to show multiple cursors at once if they are far apart. There’s a huge amount of potential here.
Also good to note: Command-F find also has a "Find All" option which can be faster than pressing Command-D multiple times, and also allows more complex non-word and regexp searches. From there you can use multiple cursors or replace the whole selection just by typing.
Brilliant editor, this one.
I eventually had to get an extension and modify it to replicate emacs' c-x c-f to create files.
- Goto file: "con pos" -> app/controllers/posts_controller.rb
- Goto line in file: "con pos:100" -> app/controllers/posts_controller.rb line 100
- Goto function in file: "con pos@foo" function foo in app/controllers/posts_controller.rb
Also one that came up recently is CMD+ALT+Q to auto-wrap long comments to your ruler (e.g. 80 columns).
"conpos:100"
works fine.A fine grained find+replace/modify :)
Also:
Ctrl+Shift+D duplicates the current line by default (or the current selection, if any). Ctrl+Shift+K deletes the whole line. Ctrl+K twice deletes to end-of-line. Ctrl+K Ctrl+backspace deletes to beginning-of-line.
Combine duplicate, move up/down, and the Ctrl+D multi-cursor stuff, and you have a copy-and-paste coder’s dream editor. ;-)
edit: back at my computer now. to put st2 into vim mode, just comment this line out in the default preferences:
"ignored_packages": ["Vintage"] :Vex- Code folding: No fold level 1 option, would like a hotkey. No line at the fold, just an icon at end of line.
- 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.
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.
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.
I don't understand how anyone who has actually used Sublime can say this. It's smooth, clean, cross-platform identical, and beautiful, and most importantly, insanely fast. I believe the widget set is their biggest strength.
Then again, I also believe the text configuration is another strength. It's a programmer's editor; it wasn't designed this way out of laziness or poor aesthetic or UI concepts, it was designed this way because it's exactly how most of the target users want to configure it. It also saves a lot of dev time that would be spent maintaining myriad settings UI's and determining which belong and which don't and how to lay them out and how to document them, etc. etc. etc. Instead, settings are keys and the way you manage them is through simple, readable JSON files. No problem.
It also has many other advantages, such as being able to have a settings file per project and override any settings as you like, rather than being limited by a pesky UI.
In fact, it would probably be a fairly easy thing to set up a Sublime plugin that provides a UI for the various settings as you desire. The fact that no one has bothered to do this yet is very telling.
Also, I have no performance issues with any of my editors. The widget comment was based on the fact they use no other widgets, they must not have written them yet.
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.
Now, create a new user defined bind for that command (you can google how to do this). Or you could use Ctrl+Shift+P+"save".
ctrl + m when in a bracket sets the cursor to it's matching bracket.
ctrl + up or ctrl + down scrolls the document up or down.
ctrl + g goes to a line.
See: http://vimdoc.sourceforge.net/htmldoc/visual.html#blockwise-...
ST2 allows multiple cursors in arbitrary locations - I'm not aware of another editor that supports that.
Switches case on lines 4, 15:
:4,15 norm ~
Indents text and changes the first two words of ever line to "duck" from mark a to the end of the file
:'a,$ norm >>2cwduck
Prepends a # to every line of the visual selection
:'<'> norm I#
Applies regex to lines that match a regex
:g/ducks/ s/moo/quack
[edit] typo
doesn't work on my ST2.
So, in this case, you would go to http://wbond.net/sublime_packages/community and search for "indent" or "pretty" or "xml".
I know you're new here, but a little reminder about etiquette, even if you haven't gotten laid in a while, the community here is based on people being helpful rather than trying to be superior. The problem with that attitude is that it backfires and just makes you look insecure.