Live data from Hacker News

Handy text manipulation tricks in Sublime Text 2

whiletruecode.com

41–50 of 99 posts

Re: Handy text manipulation tricks in Sublime Text 2

#41

Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…

Makes me curious how you manage to remember all these commands.

Is there some sort of trick you use?

Re: Handy text manipulation tricks in Sublime Text 2

#42
post #35

Any article that talks about tricks in Sublime Text 2 without mentioning Multiple Cursors is... lacking (no offense to the OP). For anyone that doesn't know it, Multiple Cursors is the ONE BRILLIANT FEATURE that Sublime Text has. Don't get me wrong, tt's great in many other ways too, but Multiple Cursors is, IMO, a feature that should become part of every friggin' text editor in existence, it's that important. And it…

   if (somecondition):
     return
   if (anothercondition):
     return
 
   Now, let's say for a second that I just realized I don't 
   want to return, I want to do some processing, then 
   return. This happens a few times a day for me. I just 
   multi-select both "if"s, hit enter, and add the code.
Not a great example, because this only leads to code duplication.

Re: Handy text manipulation tricks in Sublime Text 2

#43
post #35

Any article that talks about tricks in Sublime Text 2 without mentioning Multiple Cursors is... lacking (no offense to the OP). For anyone that doesn't know it, Multiple Cursors is the ONE BRILLIANT FEATURE that Sublime Text has. Don't get me wrong, tt's great in many other ways too, but Multiple Cursors is, IMO, a feature that should become part of every friggin' text editor in existence, it's that important. And it…

I guess you are aware Sublime Text 2 has a Vim mode. As someone who's gone "far in Vim's world", how do you think this compares to regular Vim? I'm starting to learn Vim commands in ST2 but I don't know if "proper" Vim is required to get fully into Vim.

Re: Handy text manipulation tricks in Sublime Text 2

#44
post #35

Any article that talks about tricks in Sublime Text 2 without mentioning Multiple Cursors is... lacking (no offense to the OP). For anyone that doesn't know it, Multiple Cursors is the ONE BRILLIANT FEATURE that Sublime Text has. Don't get me wrong, tt's great in many other ways too, but Multiple Cursors is, IMO, a feature that should become part of every friggin' text editor in existence, it's that important. And it…

I do V(motion):norm cityour new content, which does the same as your point 2, very often.

But, as you said, multiple cursors is a lot like visual feedback for macros. I miss such a "live" feel sometimes.

You got me interested: I'm looking forward for your Vim plugin.

Re: Handy text manipulation tricks in Sublime Text 2

#46
post #29

I use both Emacs and vim on a daily basis. Emacs is my main editor and vim is for quickly dropping in to make a change in a terminal either locally or on a server. Both are amazing. Both are rock solid. Both are infinitely extensible. Both are free as in beer and as in freedom. I'm not afraid of paying good money for software. I don't think it is necessary to pay for a closed-source text editor when such good open-so…

Have you actually tried Sublime? It has split windows. And you can extend is pretty easily using packages. I've read many posts of vi and Emacs hardcore users who actually liked Sublime.

Re: Handy text manipulation tricks in Sublime Text 2

#47
post #35

Any article that talks about tricks in Sublime Text 2 without mentioning Multiple Cursors is... lacking (no offense to the OP). For anyone that doesn't know it, Multiple Cursors is the ONE BRILLIANT FEATURE that Sublime Text has. Don't get me wrong, tt's great in many other ways too, but Multiple Cursors is, IMO, a feature that should become part of every friggin' text editor in existence, it's that important. And it…

Completely agree on the awesomeness of multiple cursors and ST2 in general. The official documentation has some more tips: http://www.sublimetext.com/docs/2/multiple_selection_with_th...

Fortunately, other editors are already adopting similar features. Just today I was fiddling around with Ace, a web-based code editor, and noticed that they support multiple cursors too! Just select multiple words while pressing the Ctrl (or Cmd) key.

Live demo: http://ace.ajax.org/build/kitchen-sink.html

The nicest thing is that I only found this by accident because I'm so used to using multiple cursors in ST2. It's a great feeling to be surprised that something works just the way you sub-conciously expected :)

Re: Handy text manipulation tricks in Sublime Text 2

#48
post #41

Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…

Makes me curious how you manage to remember all these commands. Is there some sort of trick you use?

Vim commands are like a language - you don't route learn combinations, only the individual "words", and you string them together dynamically, like you would do with English words in a sentence.

Re: Handy text manipulation tricks in Sublime Text 2

#49
post #47
post #35

Any article that talks about tricks in Sublime Text 2 without mentioning Multiple Cursors is... lacking (no offense to the OP). For anyone that doesn't know it, Multiple Cursors is the ONE BRILLIANT FEATURE that Sublime Text has. Don't get me wrong, tt's great in many other ways too, but Multiple Cursors is, IMO, a feature that should become part of every friggin' text editor in existence, it's that important. And it…

Completely agree on the awesomeness of multiple cursors and ST2 in general. The official documentation has some more tips: http://www.sublimetext.com/docs/2/multiple_selection_with_th... Fortunately, other editors are already adopting similar features. Just today I was fiddling around with Ace, a web-based code editor, and noticed that they support multiple cursors too! Just select multiple words while pressing the C…

Fortunately, other editors are already adopting similar features.

Yup, work's being done to add this to Emacs as well although it is not quite there yet:

- http://emacsrocks.com/e08.html

- https://github.com/emacsmirror/multiple-cursors

Re: Handy text manipulation tricks in Sublime Text 2

#50

My favourite feature is definently multiple cursors; Ctrl+D selects the next occurance of your highlighted word, Alt+F3 selects all occurances.

That's interesting. Can you edit all selected occurrences at once? I don't think there's an immediate analogue in Vim.

Oh yes. It gives you multiple cursors as discussed upthread, with multiple selections. You could then for example press backspace, leaving all the occurrences gone with the cursors left in their place, ready for you to type something new.
Post reply on HN