Vi
John B. Milton
jbm at uncle.UUCP
Fri Jun 9 05:32:15 AEST 1989
In article <1103 at adds.newyork.NCR.COM> tanya at adds.newyork.NCR.COM (Tanya Katz) writes:
>In article <13816 at dartvax.Dartmouth.EDU> Andy Behrens write:
>|In article <19890 at adm.BRL.MIL> thoyt at ddn-wms.arpa (Thomas Hoyt) writes:
>|> Can Vi reformat a paragraph, justifying it properly....
>|
>|If you put the following line in your .exrc file, you can type "V" when
>|the cursor is anywhere in a paragraph, and the entire paragraph will be
>|rejustified by being piped through "fmt".
>|
>| map V 0}!{fmt^M}
>|
>Well I liked this idea, but I usually don't like to overwrite the
>vi file, and wanted to just produce an nroff file from within vi.
>
>SO... here are my macros:
>
> map M :!less %.out^M^M
> map V :!nroff %>%.out^M^MM^M
>
>This brought up an interesting question of file name manipulation
>from within vi, and passed to the shell.
>
>% = the current file name, but how can I truncate it to just
>the prefix if it is something like:
> name.1
>to get:
> name
>or better yet `basename name`??
The prpgram basename can take a second argument, which is a string to remove
from the end of the path after the leading directory has ben stripped off.
So `basename /a/b/c/file.out .out` will be "file", and
`dirname /a/b/c/file.out`/`basename /a/b/c/file.out .out` will be "/a/b/c/file"
John
--
John Bly Milton IV, jbm at uncle.UUCP, n8emr!uncle!jbm at osu-cis.cis.ohio-state.edu
(614) h:294-4823, w:466-9324; N8KSN, AMPR: 44.70.0.52; Don't FLAME, inform!
More information about the Comp.sys.att
mailing list