I found a situation today in which it would have been much much easier to have vim on hand than the available Windows tools (notably Notepad and Wordpad). I was helping my roommate’s boyfriend in his job search, and IE was acting up: clicking on a particular set of links within a job-posting page didn’t work (the JavaScript app was buggy, I think), so I had to go into the HTML source, copy out the URL for each job, and open that URL manually. Each URL was embedded inside a JavaScript function call that looked something like
foo('URL', arg1=a1, arg2=a2, ...,argN=aN) With a tool like sed, I could have just done some regular-expression magic on this: the single sed command sed "s/foo('([^']*)/\1/g'" would grab all the URLs of the appropriate form. (I may have the details slightly off, but that’s about it.) Windows has no such pattern-matching facility. Microsoft Word has some rudimentary matching, but it’s nothing like a full regular-expression search.
Or within vim, I could just go to the source code directly, go to the first ', then select all the text up to the next '. Again, trivial. It would have saved me at least 10 minutes of effort today. It’s a very basic thing to ask for, actually: the ability to select text, combined with the ability to search for a pattern. Shouldn’t you be able, in Microsoft Word, to “select all text up to the next occurrence of the word ‘foo’”? Seems like a reasonable demand to me. You may complain about the Unix syntax, but syntax isn’t the issue here: it’s pure functionality that Windows lacks.
Or yesterday, using Microsoft Word at work, I found myself really needing regular expressions: I had copied in a whole lot of seven-digit numbers, and I wanted to quickly make them all pretty by putting commas around digit groups. This would have been trivial in Perl:
perl -p -i -e 's/(\d)(\d\d\d)(\d\d\d)/\1,\2,\3/g'
It may seem obscure, but it’s like mathematics: it’s a notation designed to compress the maximum amount of meaning into the fewest characters. And once you’ve used one Unix command, you’re quite often ready to use a lot of others: the Perl, sed, and vim syntaxes (syntaces?) all use more or less the same commands to substitute one pattern for another. (Which you’d expect, given that geeks who grew up on the first two developed the third.)
The big secret with Unix, I’ve discovered, is that there may be an enormous fixed cost, but once you’ve learned the tricks they’re yours forever and your marginal-cost savings are huge. Over a lifetime, the accumulated ten-minute savings here and there amount to a lot.
But again, if people don’t get it, there’s not much one can say that will make them get it. They’ll just have to learn it on their own.