Operating System - HP-UX
1753900 Members
7773 Online
108809 Solutions
New Discussion юеВ

tab spaces in vi and printing don't match

 
Stuart Abramson_2
Honored Contributor

tab spaces in vi and printing don't match

I like to change my vi tab stops from default 8 to 5 spaces:

vi .exrc
set autowrite wrapmargin=0 report=1 tabstop=5

works fine.

But when I print, the tabstops aren't set to five. They seem to be set to 8, and all my files run off of the right side of the paper.

Is there some way to get the print tabs to match the vi tabs?
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: tab spaces in vi and printing don't match

Hi Stuart:

Have a look at the 'pr' filter's '-e' arguement (man 'pr'). Hence:

# pr -F -e5 filename | lp ...

Regards!

...JRF...

H.Merijn Brand (procura
Honored Contributor

Re: tab spaces in vi and printing don't match

Though this may work for you, you're bound to get trouble when exchanging files with others. Almost everyone in the unix world is using tabs=8

If the only reason you want it set to 5 is to have less indent in programmatic blocks, I would strongly advice to use sw=5 instead, it is supported by all vi clones, and still leaves the spacing portable regarding the tab stops.

If you are using a `better' vi, check if it has an expand option, so your file will not contain any spaces at all when writing it.

Also check the 'expand' command

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Steve Steel
Honored Contributor

Re: tab spaces in vi and printing don't match

Hi

expand should also work


expand processes the named files or the standard input and writes to
the standard output with tabs changed into spaces.


Steve steel
If you want truly to understand something, try to change it. (Kurt Lewin)