plaintext

Why Plaintext?

According to the Life Hacks research done by Danny O'Brien, Unix geeks uniformly prefer using plain text files to track their to-do lists. In a computing era when beautiful GUI applications will perform innumerable activities to keep track of you and your data, why would anybody still poke at plain text files, especially on the utilitarian command line of all things?

The question contains the answer: the geeks don't want feature-bloated programs performing innumerable activities to their data. They want to pick and choose what they write down (or rather, type in), how they manipulate it, what has access to it, and when something gets changed. And they also want to be able to see the trees for the forest, so to speak, without the GUI getting in the way of their work.

See our Plaintext category for a list of posts on the topic.

How to edit remote files with local vim

So I finally got around to looking up how to edit remote files with local vim[1]. You do need to have an ssh public/private key set up[2] for the server in question.

On the command line, use the format:

vim scp://username@example.com//path/to/document

Note the double // after the domain name -- this gives you an absolute path on the remote box.

This technique works with the GUI gvim or MacVim applications too by using the :e command inside the program. Open up a new window and type

:e scp://lisa@example.com//www/docs/bleeding_gums.html

Bonus Tip #1

If your local username is the same as your remote username, you can eliminate it in your command. So, for example, if you were username "frink" in both places, you could use something like

vim scp://example.com//Users/frink/Documents/frogexaggerator.py

to access and edit your Frog Exaggerator controller script in your remote Documents folder.

Bonus Tip #2

Can't remember the name of your remote file? Don't worry -- open a directory instead!

:e scp://example.net//Library/WebServer/Documents

You'll see a list of the directory's contents. Move the cursor to your desired file (or subdirectory) and hit return to open it. Naturally, this also works on local items.

Give me more!

You can read more in depth info at the appropriately titled Vim Tips Wiki article "Editing remote files via scp in vim".


[1] Or gvim, MacVim, etc.

[2] Actually, you can use several different methods in addition to scp -- ftp, http, etc. -- but I had the automatic ssh login in place already.

Linux Tools for Writers

linux_gvim.png

Aaron Peters of The Writer’s Technology Companion posted "Moving to Linux: Tools for Writers" last year, covering the basic text editors, word processors, and desktop publishing options in an article for beginning Linux users.

As an avid free and open source software (FOSS) advocate, I’ve spent some time over the last few years writing on the Linux platform. I’ve come to discover that it’s still an immature platform for certain folks, such as hardcore gamers or multimedia professionals. But for those who have their fun (or make their living) by putting words on (e-)paper, Linux offers a perfectly usable platform for doing everything a writer needs to do.

This was the first in a series of "Moving to Linux" articles, all applicable to writers:

  1. Moving to Linux: Tools for Writers
  2. Moving to Linux: Working with Text (Part 1)
  3. Moving to Linux: Working with Text (Part 2)
  4. Moving to Linux: The New OpenOffice
  5. Moving to Linux: Scribus for Writers
  6. Moving to Linux: The Netbook is Your New Best Friend
  7. Moving to Linux: Working with the Netbook

If you're still using a Mac, most of the tools Linux users enjoy are available, either as separate binaries, compile-it-yourself source, or via package managers like MacPorts.

Vim a la TextMate

Alex Young posted "Vim for TextMate fans" a couple of years back, in which he ponders how to get the best of both worlds:

I’ve used vim a lot over the years, mainly because I spent a long time using Linux and it was there so I used it. The choice was obvious: vim or vi were on almost every machine I had access to, and worked excellently both locally and remotely. Once I’d learnt the basics I was set, I knew enough to get my work done.

Then I found TextMate for Mac OS. The immediacy of TextMate made it easy to get started with, and it has many excellent features. The problem is, I’m not always using a Mac. But you know who’ll follow me around to every platform I use? Good old vim! So I started thinking, how could I make vim feel more like TextMate?

Check out his screencast for more.

Using vim as a personal wiki

Abhijit Nadgouda over at iface thoughts describes a method of using vim as a simple wiki system, utilizing its built-in "tags" capability.

One thing I have learnt from experience is that the tool to collect and organize our information must be easily available and easy to use. And that is where vim scores higher than any other tool to build a wiki.[...]

Nowadays I use the vim as a combination of wiki and outliner to record my ideas and thoughts, documentation, tasks and even contacts.

Looks very easy to set up and use -- I think I'll give it a try.

Useful Unix, Vim, and Emacs tricks on Slashdot

cartoon of vi man beating up feeble emacs user

A couple of days ago, Slashdot posted a story asking about "(Useful) Stupid Unix Tricks?":

So the other day I messaged another admin from the console using the regular old 'write' command (as I've been doing for over 10 years). To my surprise he didn't know how to respond back to me (he had to call me on the phone) and had never even known you could do that. That got me thinking that there's probably lots of things like that, and likely things I've never heard of. What sorts of things do you take for granted as a natural part of Unix that other people are surprised at?

It's perhaps unsurprising that there have been over 2200 comments exploring the arcana of the Unix and Unixy command line. A lot of awesome lore to check out.

Yesterday came the next story, "(Useful) Stupid Vim Tricks?":

I thoroughly enjoyed the recent post about Unix tricks, so I ask Slashdot vim users, what's out there? :Sex, :b#, marks, ctags. Any tricks worth sharing?

570+ comments later, there's a lot to check out there as well.

Today's post was inevitable, "(Stupid) Useful Emacs Tricks?":

Since the Vi version of this question was both interesting and popular, let's hear from the other end of the spectrum. What are your favorite tricks, macros, extensions, and techniques for any of the various Emacs? Myself, I like 'M-x dunnet' ;-)

200 comments and counting.

One of the most enjoyable parts of the Vim story, apart from the various spiffy command tips and tricks, were links to other sites. Here are a couple, along with a few related others I've linked to before.

Command line tea timer for Mac

Cuppa is a spiffy tea timer program for Mac (if only for its sound effects ;), itself inspired by The Tea Cooker from Linux. However, there's an easy way to create a de facto tea timer, or run any kind of countdown, via the Terminal.

The sleep command allows you to run other commands or programs with a delay. So, for example, you could enter,

sleep 20; ps

which will pause for 20 seconds, then run ps to show your active tasks.

To keep you from having to stare at the Terminal window waiting for your tea countdown to finish, we'll make use of the say command, which taps into your Mac's built-in Text-to-Speech ability. (See System Preferences > Speech.)

So, assuming you want your Earl Grey to steep for four minutes, you could use something like this:

sleep 240; say "Your Tea, Earl Grey, Hot, has completed brewing."

Or for your Green Tea:

sleep 60; say "Green Tea processing complete."

Enjoy!

UPDATE 2009-10-23:

Following up on this, you can get the best of both worlds by using the popular Growl notification system -- specifically, the CLI growlnotify program, found on the Growl install disk image (see description on their Extras page for more info). Then you can do something along the lines of,

sleep 120; growlnotify --message "Dude, your most excellent tea is ready."

See man growlnotify for finer control.

Syndicate content