[vox-tech] vim question
Peter Jay Salzman
vox-tech@lists.lugod.org
Thu, 1 Aug 2002 20:40:26 -0700
ok, here's a non-ugly(?) answer:
this is the last 3 lines of the file:
-> :!top
-> :!nice -n10 planetary % &
-> :w
the goal is to execuate the instructions with <F9>, <F10> and <F12>.
this will execute the last line:
map <F1> mzG"zyy:let @z=strpart(@z,3)<CR>`z@z<CR>
here's the parse:
mz place the z marker (no relation to the z register) at the current
cursor position. this is so the cursor returns to this location
after executing the marker.
G go to the end of the file
"zyy yank the last line of text, "-> :w" into the z register
:let @z=strpart(@z,3) forms a substring of register z consisting of
the 4th through last character. assigns it to register z. the
colon is part of the let command.
@z execute the contents of register z
the more i learn about vim, the more i realize how little i know...
pete
begin Ted Deppner <ted@psyber.com>
> On Thu, Aug 01, 2002 at 05:06:23PM -0700, Peter Jay Salzman wrote:
> > his question was: can you do a search and replace on a buffer?
>
> macro open a new window, paste the buffer, do a conventional S&R, yank the
> buffer, close the window, and viola. You could also ! out the line to sed
> -e s/foo/bar/ for an in place.
>
> Prolly too ugly.
>
> Very interesting problem... and beyond my vim skills. A friend of mine
> once said (after I showed him a few things about vi he hadn't known)
> "no one can know everything vi can do". And later came vim.
>
> --
> Ted Deppner
> http://www.psyber.com/~ted/
--
Please don't put my email address in your Outlook addressbook.
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D