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:
January 6: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
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



hola,

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.

pete
_______________________________________________
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:
EDGE Tech Corp.
For donating some give-aways for our meetings.