Live data from Hacker News

Some things beginners might not know about Sublime Text

blog.alainmeier.com

21–30 of 116 posts

Re: Some things beginners might not know about Sublime Text

#21

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.

Yes, Ctrl-v to enter visual-block mode, then move up or down to cover all lines where you want to make changes, then I{string}Esc to append a string at the cursor location on all lines.

See: http://vimdoc.sourceforge.net/htmldoc/visual.html#blockwise-...

Re: Some things beginners might not know about Sublime Text

#22
Ctrl+Alt+P to get a dialog for opening all your Sublime projects.

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} } ]

Re: Some things beginners might not know about Sublime Text

#24

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. (This is in ST2 for Mac OS X - I'm sure there's an equivalent feature in ST2 for other systems.)

The command and alt modifiers work when I use the arrow key but this ctrl doesn't seem to do anything... OS X lion. For example, I put the caret in front of a camelCased variable and press ctrl+right arrow, nothing happens. Am I doing it wrong?

You need to hold alt _and_ ctrl at the same time.

Re: Some things beginners might not know about Sublime Text

#25
post #15

Cmd + d selects the current word. 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.

What's really wild is if you do CMD+d several times and then move around with the arrow keys. Multiple cursors follow you around. I'm not sure if this is useful, but it's certainly cool.

Re: Some things beginners might not know about Sublime Text

#26
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.

Re: Some things beginners might not know about Sublime Text

#29
post #7

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.

Now that I think about it, it's such a common feature everywhere except text editing (I'm mainly thinking of selecting/highlighting things like icons and menu items) it's interesting that it has taken so long to be an editor's big selling point.

Re: Some things beginners might not know about Sublime Text

#30
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).
Post reply on HN