Operating System - HP-UX
1837960 Members
2365 Online
110124 Solutions
New Discussion

Set tabstops with special line in vi

 
Rob van Buiten
Regular Advisor

Set tabstops with special line in vi

How can set the tabstops in a document for vi.
Other editors have a special syntax inside the file-to-edit:
# :vim:tabstop=4:
The special line is checked by the editor, and
any commands on it are executed by vi

Does HP-UX vi have a similar feature?
4 REPLIES 4
Kenan Erdey
Honored Contributor

Re: Set tabstops with special line in vi

Hi,

in vi try :set tabstop=4

Kenan.
Computers have lots of memory but no imagination
Paul Ettema
Advisor

Re: Set tabstops with special line in vi

Hi,

I think that what you want can find in de file ".exrc" in your home directory.

For example "set tabstop=4"


My file contains this:
set autowrite wrapmargin=0 report=1 showmode
set tabstop=4


Paulus.
Rob van Buiten
Regular Advisor

Re: Set tabstops with special line in vi

Kenan "solution" is just the command. the trick is to have it issued automatically whenever you open the file.

Paul's solution is better, but changes the defaults for all files.

How can I have tabstop=4 in one file, tabstop=6 in the next, and default settings in all others?

Kind Regards,
Reinier Kleipool
Peter Nikitka
Honored Contributor

Re: Set tabstops with special line in vi

Hi,

I don't like it to put such information into files - depending on the tool used onto that file (compiler, ...) it may be harmful for further processing.
I use this solution to set a different tabsize for all files in a directory:
In ~/.exrc:
set ts=4
set exrc
...
In .../anydir/.exrc (must be writable by user only):
set ts=8

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"