If I don’t write this down in the next 5 minutes, I’ll surely forget it forever.
emacs had some problems opening a file when when it was checked into cvs. Then it had permissions problems when I moved the ,v file out of the way. The problem was that the disk was mounted on NFS and sudo doesn’t quite work over NFS.
Instead I decided to be a real man and use vi. First thing I had to do was insert the contents of a another file into the current one. No problem: :r (filename)
Then I had to substitute all $’s with \$’s. Hmm, that was a little tougher. :s subsitiutes only the first instance on one line. Adding /g does all on the line. To do them all, I had to use this magic incantation:
:1,$s/\/\$/g
The first part specifies the range to use.
Who said vi isn’t intuitive?
But wait! There’s more.
you can also do
:%s/\/\$/g
which does all instances of all of the lines. % is a short wildcard character for all lines.
I’m pretty sure there’s a eleven key meta-combination for that in emacs, but I can’t remember it off hand.
Uh oh. Vi vs emacs. I’m staying out of this one. Everyone knows that vi is for wussies.
M-x replace-regexp \ \$
Oh yeah, except when vi is the only editor available. I think emacs will actually fit on a DVD+R now.