Computer Association of SIUE - Forums

CAOS Forums => Questions and Answers => Topic started by: Tony on 2007-12-02T19:23:03-06:00 (Sunday)

Title: Visual Studio Tabs
Post by: Tony on 2007-12-02T19:23:03-06:00 (Sunday)
I don't know if this is going to help anyone, but if you have Dr. Blythe and you didn't already know this, this will help you.

One of Dr. Blythe's rules is that your program no exceed 80 characters per line.  This is because he is a Unix guy and I guess all Unix text editors have a width of 80 characters and he doesn't like wrap around.

Anyways, what ever editor he uses will give a ton of spaces for tabs.  It is the same as if you do the type command in the cmd prompt in windows.  Well, in Visual studio you can change some settings for your tabs that will make all tabs a few spaces instead of a tab which can be handled different in different text editors.  Here are the paths to the options you need to change.

Tools/Options==>Open text editor, then C/C++, (Since each language has its own standard, you will have to select this for all the languages you are using.)  Then select tabs.   Then you can change your number of spaces, and then select Insert Spaces radio button.  This will make it give you the number of spaces you specified, rather than a tab of that many spaces. 

There is also a way to change all these settings in Unix, but I don't remember how.  So, if anyone knows, it would be great if you would post the steps on here.
Title: Re: Visual Studio Tabs
Post by: Gregory Bartholomew on 2007-12-02T20:56:29-06:00 (Sunday)
In UNIX (VIM), you need to issue the following commands to have tabs expanded to spaces:

set tabstop=3
set shiftwidth=3
set softtabstop=3
set expandtab

If your program already contains tabs, you can tell vim to change them to spaces by issuing the command "retab" after you have set the above settings (you can use the command "retab!" to have vim convert from spaces back to tabs).

Also, if you put the above settings, one per line, into a file named ".vimrc" in the root of your home directory, then vim will use them by default.

gb