Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!usc!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.editors Subject: Re: vi for power users Message-ID: <1990Dec08.201540.6942@chinet.chi.il.us> Date: 8 Dec 90 20:15:40 GMT References: <109909@convex.convex.com> <1013@tokio.cs.utexas.edu> Organization: Chinet - Public Access UNIX Lines: 24 In article <1013@tokio.cs.utexas.edu> mayoff@cs.utexas.edu (Robert Mayoff) writes: >>5. How do I get just the name of the file I am editing right now? >>Because, for example if I want to say run this file through a filter and >>save the output in a file with the same name but different extension, >>can I do this? >You can type control-g to see the current filename (and a few other tidbits of >information). If you want to run a program with the current file as input >(with any modifications you have made), you can use (for example, to print the >file) > :w !lpr I think the % expansion is what he is looking for. Assuming you have written the file recently or have autowrite on, :! program % >%.ext would do what you ask (although if you have modified the file and want to make a backup copy of the original like this, having autowrite enabled will kill you). If you want to get the filename into the editor buffer, you could use :r !echo %. I often go to the end of a c program file and use :r !lint % to check for errors, using the === that lint emits as a marker between the text and the error list. Perhaps not as nice as multiple windows, but it works. Les Mikesell les@chinet.chi.il.us