Thursday, June 21, 2012

Set tabstop in VI - Mac OSX


From within VI

(Assuming you would like to use four spaces for your tabs)
:set tabstop=4

To make this behaviour the default:

user@machine:~$ cd ~
(if ~/.exrc does not exist, create it.  Otherwise skip to next cmd.)
user@machine:~$ touch .exrc
user@machiner:~$ vi .exrc

Add the following line to the file:
set tabstop=4


Save and close .exrc

user@machine:~$ . .exrc
user@machine:~$ vi someTextFile.txt

Basically, if the file .exrc does not exist in your home directory create it.
Open .exrc for editing.
Add the line (w/o quotes) "set tabstop=4"
Save .exrc
Source .exrc
Test to verify function.

This should also work in most flavors of *nix.

~Fin

No comments:

Post a Comment