l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Aug 01 19:57

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)
[vox-tech] vim question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] vim question


one of my students asked me a question i couldn't answer.

at the bottom of the file, he has:

-> :!top
-> :!nice -n10 planetary % &
-> :w

he was playing around with vim and came up with the following macros:

> map <F12> mzG3l"zDp'z@z<CR>
> map <F11> mzGk3l"zDp'z@z<CR>
> map <F10> mzGkk3l"zDp'z@z<CR>
> map <F9>  mzGkkk3l"zDp'z@z<CR>

so <F9> writes the file.  it does this by skipping over "-> ", putting
the command in the z buffer by deleting to the end of the line and then
executing the z buffer.  he also rigs things up so that the cursor is
returned to its original position (his ' should actually be a `).

his question was: can you do a search and replace on a buffer?

in other words, i guess it would be something like:

map <F1> mzG"zyy `z@z<CR>
                | this is where we'd get rid of "-> " in the z buffer

does anybody know how to do this?

before anyone asks, the goal isn't mapping a single key to save.  it's
just to learn how to do a search/replace on a vim buffer.

btw, this kid is a sophmore in highschool.  he's going to be one awesome
vim user.  i'm thoroughly impressed by him.  his name is marcello and
he's hoping to make it to the next lugod meeting.

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
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:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.