Vi question for writing source code

Hi guys, I'm modifying an old f77 code using vi. I'm modifying the code remotely from my windows machine using xming using vi. I'm using tabs to move past the first 6 columns of the code and to keep my loops and if statements neat, but when I hit the tab key, vi displays a big red block which is kind of annoying. Is there any way to get rid of this block and just display the tab as white space (the background color of the editor)? When I use the spacebar these red blocks don't show up. Thanks.

If this RED color comes only for TAB and not for SPACES, consider converting your TABS to SPACES by using

 
set expandtab 

Refer Converting tabs to spaces - Vim Tips Wiki

[LEFT]Thanks for the reply. I tried this but nothing happened. I'm using vi, not vim, by the way. That aside, isn't it better practice to use tabs in source code? Or at least easier than pressing the space bar 6, 9, 12, or 15 times? I attached a picture to show you what I'm talking about. It's not really a huge deal, it's just mildly distracting.


[/LEFT]

Hi.

It looks to me like you are really using vim with one of the language syntax coloring schemes (or else xming is getting in the way). The one true vi doesn't have those extensions.

If you are using true vi, and you attempt to get the version, you'll see:

$ vi --version
vi: illegal option -- version

whereas if you are using vim, you'll see something like:

% vi --version
VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 18 2008 09:05:15)
Included patches: 1-314
(and probably many more lines)

Which do you get? ... cheers, drl

I stand corrected, sir. They do have VIM installed on the cluster.

Hi.

To get rid of the color, when in vim command mode, enter:

:syntax off

to turn it back on, enter:

:syntax on

Of course, you lose the other colors. To make changes to the color scheme is another topic altogether.

Best wishes ... cheers, drl

I see, it's all or none. Well I guess I'm stuck with it then. Thanks for the advice.

Hi.

Not exactly all or none, but one needs to do a little research. In looking through: Vim documentation: syntax
navigating to the description of the Fortran syntax file and (vim) commands, it is noted that TABs are considered by vim syntax to be an error, and hence are in red.

You can eliminate that feature by entering

:let fortran_have_tabs=1

before entering

:syntax on

I tried that and it worked for me, in the environment noted in a previous post.

If that tests correctly for you, you can probably automate that to some extent by modifying your .vimrc (note the leading dot) file. I did not try that.

Have fun experimenting, researching, and programming ... cheers, drl