Vi

Tanya Katz tanya at adds.newyork.NCR.COM
Thu Jun 8 02:39:36 AEST 1989


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`??


	Tanya

------------------------------------------------------------------------------
    ###   ######  ######   #####       Tanya Katz       (516) 231-5400 x430 
   #   #  #     # #     # #           
  #     # #     # #     #  #####       ...uunet!ncrlnk!adds!tanya      
  ####### #     # #     #       #      tanya.katz at adds.newyork.ncr.com
  #     # ######  ######   #####       

  Applied Digital Data Systems, Inc.   100 Marcus Blvd., Hauppauge, NY 11788 
------------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list