Live data from Hacker News

Handy text manipulation tricks in Sublime Text 2

whiletruecode.com

51–60 of 99 posts

Re: Handy text manipulation tricks in Sublime Text 2

#51
post #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.

It's also closed source, meaning we can't fix something if we want to. We can't see what's going on back there. When it comes to a tool that I use every day with personal data, I really want it to be open source.

My browser and my text editor definitely need to be open source. Additionally, Emacs is really amazing, and like many others, I've been building this init.el for years (in my case months), meaning Emacs and I are really made for each other right now.

Re: Handy text manipulation tricks in Sublime Text 2

#52
post #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.

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 macro-recording/scripting. This is why I am saying it isn't worth the money. The open-source alternatives are superb.

Re: Handy text manipulation tricks in Sublime Text 2

#53

Sublime Text makes me feel silly for loving a text editor so much. Now if only it would do text completion across multiple files...

Me too. I've been a vi/vim users for 20+ years, and I swear by vim for C/C++-based development - but now that I'm mostly doing Lua (MOAI), SublimeText2 has become my absolutely most loved tool. It is really one of those editors that became an instant hit, the moment I discovered Cmd-R, Cmd-T, and of course everyones favourite, Cmd-D. ;)

For some reason, ST2 reminds me of the old PC-Write editor for DOS, in terms of raw features and power - I guess because PC-Write was the last editor I used that had proper column/row selection, multiple-cursors, and so on. I sure do miss that editor (switched to vim full-time as soon as PC-Write was EOL'ed and I moved off DOS to Unix) ..

Re: Handy text manipulation tricks in Sublime Text 2

#54
post #48
post #41

Earlier quoted context omitted.

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.

What are the list of those individual "words". And what is the syntax for combining them?

Re: Handy text manipulation tricks in Sublime Text 2

#55
post #54
post #48

Earlier quoted context omitted.

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.

What are the list of those individual "words". And what is the syntax for combining them?

This is the best explanation I've found so far: http://stackoverflow.com/a/1220118/3528

Re: Handy text manipulation tricks in Sublime Text 2

#56
post #33

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

I think macvim has this because I've been doing it for as long as i remember, or maybe it's in Janus though.

This is all plain vim, so this'll work in MacVim, GVim and Janus (just MacVim and a bundle of plugins).

Re: Handy text manipulation tricks in Sublime Text 2

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

Re: Handy text manipulation tricks in Sublime Text 2

#58
post #54

Earlier quoted context omitted.

What are the list of those individual "words". And what is the syntax for combining them?

This is the best explanation I've found so far: http://stackoverflow.com/a/1220118/3528

It was a very good read. But not what I was expecting. If vim is indeed speaking a language this is what I would expect a vim tutorial to have.

    1. Basic commands.
    2. Syntax to chain basic commands.
    3. Ability to form other commands from basic commands.
    4. Way to write macros.
Instead most vim tutorials I have read present with a list of several commands to memorize and then a cheat sheet to navigate you through a jungle. Often they are letters, and not meaningful words. So they are difficult to put into ones brain. Couple that with vim's modes. And you are set with a perfect recipe for disaster in case of a new bie.

If vim is indeed speaking a language than manuals and tutorials teaching it, must explain how to speak that language.

This is 2012 and the need to memorize commands, and read cheat sheets to edit text doesn't belong to our times.

What I seem to get is vim aims to provide sed, grep, tr, cut etc kind of tools inside a text editor in form of some interplay of letters and words. How I haven't figured out till today's date.

Every time I've tried to learn vim, I've quit trying to memorize 'yy P...' kind of commands. That happens as I first can't memorize random arrangement of characters. Secondly if its not random, I've not understood how to arrange and use those letters to make meaningful commands.

Re: Handy text manipulation tricks in Sublime Text 2

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

One thing I miss in ST2 Vintage mode is that brackets aren't recognized with things like ci< and di<.

Re: Handy text manipulation tricks in Sublime Text 2

#60
post #58

Earlier quoted context omitted.

This is the best explanation I've found so far: http://stackoverflow.com/a/1220118/3528

It was a very good read. But not what I was expecting. If vim is indeed speaking a language this is what I would expect a vim tutorial to have. 1. Basic commands. 2. Syntax to chain basic commands. 3. Ability to form other commands from basic commands. 4. Way to write macros. Instead most vim tutorials I have read present with a list of several commands to memorize and then a cheat sheet to navigate you through a jun…

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