l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2002 Aug 01 20:50

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] vim question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] vim question



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
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!