Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Don't accidentally open huge text files from the Command Line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Don't accidentally open huge text files from the Command Line
Authored by: CarlRJ on May 17, '11 12:06:45PM
Ugh, TextEdit, really? For large (text) data files, do yourself a favor and use a tool more appropriate for the job, like less or vi (which is really vim on Mac OS X). The fully GUIfied MacVim is the best of the old and new worlds for working with text files of any size.

[ Reply to This | # ]
Don't accidentally open huge text files from the Command Line
Authored by: robleach on May 23, '11 09:42:15AM

You know, there are plusses and minuses to every app. I use vim somewhat frequently, but there are lots of things you can do in Text Edit that you cannot do (or cannot do easily) in vim or some other text editors. In fact, I prefer xemacs exclusively for coding. But some nice features in Text Edit include for example, option-click-drag to make vertical selections, which I frequently use for tab-delimited data. I also perform multi-line searches very often. There are other good reasons to use Text Edit which I won't go into. I'll agree that vim is pretty awesome and can likely perform functions like these in its own way (given some effort), as probably could other text editors, but Text Edit isn't as bad as you think. Some people write off an app because it doesn't have feature 'X'. If that's important to what you do, that's cool, but you could be missing out on features you never knew existed that you might find very useful - or perhaps you're one of a few that like feature 'X' and it's not useful for other people. It depends on your specific use-case. But you're definitely right about other text editors being better with large files. In my case, I'd rather just `more -S` a large file and if I need to edit it, I'll use vim. But typically, I just want the file to appear in a different window next to my terminal. Do you know how to do that with a single terminal command? *That* would be cool.

Rob



[ Reply to This | # ]
Don't accidentally open huge text files from the Command Line
Authored by: CarlRJ on May 23, '11 12:57:53PM
[ I'm continuing this not to try to say "thou shalt use MacVim above all others", merely following up on your points. ]
But some nice features in Text Edit include for example, option-click-drag to make vertical selections, which I frequently use for tab-delimited data.
FWIW, Option-click-drag for column selections works just fine in MacVim
I also perform multi-line searches very often.
Not sure precisely what this means; Vim (GUI or otherwise) can perform any search you can possibly imagine. This may help: Search across multiple lines - Vim Tips Wiki
In my case, I'd rather just `more -S` a large file and if I need to edit it, I'll use vim.

I normally do the same, though converted from typing more to less back in the days when they were different programs.

I totally get that some people just prefer different apps (spending most of my time in Terminal means non-typical Mac user right off the bat), I was trying to make the point that, for large column-oriented data files, Apple's TextEdit is (surprisingly, given the name), often not the best tool for the job.

But typically, I just want the file to appear in a different window next to my terminal. Do you know how to do that with a single terminal command? *That* would be cool.

Install the mvim command-line component that comes with MacVim. Type "mvim filename", or more excitingly, "some command | mvim -". Results pop up in a separate window, which you can dismiss at your leisure with ":q!", Cmd-W, or clicking the red X gumdrop (I normally use Cmd-W, Cmd-D, to quickly close, dismissing the "Do you want to save" prompt).

These days, I find that a lot of things I used to do as "some command > /tmp/foo" followed by "vi /tmp/foo" have been simplified/improved to "some command | mvim -".

Note that TextWrangler, BBEdit, TextMate, SubEthaEdit, and likely others, all supply some similar command-line executable to open a file in them, you're not stuck with MacVim for this :)



[ Reply to This | # ]