Live data from Hacker News

Handy text manipulation tricks in Sublime Text 2

whiletruecode.com

71–80 of 99 posts

Re: Handy text manipulation tricks in Sublime Text 2

#71
post #52

Earlier quoted context omitted.

Yes I have. My comment about split windows was about TextMate, which 4 years later still doesn't have them. (Coming in TextMate 2, which will be released sometime after Half Life 3.) Sublime has the eye candy, that I was talking about. It looks great. The 'birds eye' view is nice, but not particularly useful. There is nothing that it can do that it can do that Emacs/vim can't do or couldn't do with a few minutes of m…

I don't want to need a cheat sheet to use my text editor, I already need them for the programming language, the regexes, mathematical notation, etc. I don't want to spend a few minutes doing macros/scripting, I want to spend my minutes on the problem domain I'm actually working on. I don't like modes (see NO MODES in the Bret Victor talk), and I like positioning my cursor with a mouse. I haven't paid for Sublime (yet…

Remembering shortcuts for Sublime would be no different to remembering shortcuts for Emacs/vim/whatever. I agree with the 'no modes' sentiment which is why I find Emacs more natural than vim for the bulk of my work.

If you forget the short-cut for a command in Emacs, you can hit M-x, type in the name of the command (with completion to help you) and once you execute the command Emacs will TELL you the shortcut for next time (if there is one assigned). Best feature ever.

Re: Handy text manipulation tricks in Sublime Text 2

#72
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…

One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplication and a goto, I choose goto.

Re: Handy text manipulation tricks in Sublime Text 2

#73
post #72
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…

One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplication and a goto, I choose goto.

I'd go dummy function all the way.

No code duplication. No goto

Re: Handy text manipulation tricks in Sublime Text 2

#74
post #72

Earlier quoted context omitted.

One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplication and a goto, I choose goto.

I'd go dummy function all the way. No code duplication. No goto

well to each his own. In case of the cleanup phase before return I find it to be much cleaner with goto, since usually it's sub 10 lines and you'd have to program a function that gets pointers or objects passed that then get freed/destroyed, which I find ugly as hell. I look at such an outer procedure as an 'owner' of these objects and therefore I want to see the allocations and deallocations in plain text right there.

Re: Handy text manipulation tricks in Sublime Text 2

#75
post #66

Earlier quoted context omitted.

Based on this comment I think it's possible that vim isn't for you and you would probably be better suited to something like Sublime or TextMate.

Why would that be, vim seems to be difficult to use because a good manual that actually teaches how to use vim isn't available yet. In fact it was surprising to me when I learned vim commands are actually a form of some terse language. Because I was only of an assumption that most vim commands are random string of characters you need to memorize. And when you memorize and practice enough you become productive. I woul…

> Why would that be, vim seems to be difficult to use because a good manual that actually teaches how to use vim isn't available yet.

What manuals have you tried? Have you tried `vimtutor`(if vim is installed, just run vimtutor from the sell).

> In fact it was surprising to me when I learned vim commands are actually a form of some terse language. Because I was only of an assumption that most vim commands are random string of characters you need to memorize. And when you memorize and practice enough you become productive.

You need to know a lot of words before you can form intelligible sentences. There is no not-knowing `h,j,k,l,esc,d,x,p,b,w,i,I...`. So yes, you do need to memorize basic operations before you can chain them. Most of the things in this cheatsheet are important to know http://tnerual.eriogerg.free.fr/vimqrc.pdf

And once you have learnt the basic, there is no manual to tell you how to combine them, because there is no syntax to do it - you just run them in sequence. It has already been pointed out in the SO thread, and various other threads here.

> I feel tempted to give vim a try now.

Your temptation will last all of 1 day. If you give up, vim isn't for you. It takes a minimum of 15 days to a month to s top missing whatever editor you are using right now, then another month to actually start liking it.

Re: Handy text manipulation tricks in Sublime Text 2

#76
post #72
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…

One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplication and a goto, I choose goto.

I agree, but I didn't want to get bogged down in a "GOTO bad or not" discussion, which is why I left this detail out.

Re: Handy text manipulation tricks in Sublime Text 2

#77
post #57
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 agree multiple cursors are awesome and largely can replace macros with real-time visible changes. But there is one use-case of macros that cannot be replaced with multiple cursors -- one where the places being affected by the macro are themselves computed by the macro.

Can you please give an example of that? You've got my curiosity piqued :)

Btw, another place this can't be used is across multiple files, at least the way ST does it.

Re: Handy text manipulation tricks in Sublime Text 2

#78
post #49
post #47

Earlier quoted context omitted.

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

This is awesome. The world is finally waking up! :)

Re: Handy text manipulation tricks in Sublime Text 2

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

I'll be brutally honest. I think it's a great effort, and almost moved back to Sublime Text w Vintage mode several times. And each time, I'll run a command that Vintage mode doesn't have yet, and leave.

I'd love it if ST managed to replace vim. I (very unfortunately!) don't see it happening soon. Vim just has so many features and so many plugins.

NOTE: Half of my plugins in Vim are only there to make vim behave like a decent, modern editor. In fact, half of my plugins in Vim are there to make it behave more like Sublime Text.

Post reply on HN