Vi question for writing source code


 
Thread Tools Search this Thread
Top Forums Programming Vi question for writing source code
# 1  
Old 07-18-2010
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.
# 2  
Old 07-19-2010
If this RED color comes only for TAB and not for SPACES, consider converting your TABS to SPACES by using

Code:
 
set expandtab

Refer Converting tabs to spaces - Vim Tips Wiki
# 3  
Old 07-19-2010
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.

Image
Vi question for writing source code-viexamplejpg
# 4  
Old 07-20-2010
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:
Code:
$ vi --version
vi: illegal option -- version

whereas if you are using vim, you'll see something like:
Code:
% 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
# 5  
Old 07-20-2010
I stand corrected, sir. They do have VIM installed on the cluster.
# 6  
Old 07-20-2010
Hi.

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

to turn it back on, enter:
Code:
:syntax on

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

Best wishes ... cheers, drl
# 7  
Old 07-21-2010
I see, it's all or none. Well I guess I'm stuck with it then. Thanks for the advice.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question on awk source files

Im repeating same command to get count, filename from 4 different files, writing to one same file. awk 'END{print NR"|"FILENAME}' file.txt >> temp.txt; awk 'END{print NR"|"FILENAME}' asdf.txt >> temp.txt; awk 'END{print NR"|"FILENAME}' lkjh.txt >> temp.txt; awk 'END{print NR"|"FILENAME}'... (12 Replies)
Discussion started by: JSKOBS
12 Replies

2. Shell Programming and Scripting

Question about writing a bash script

Hello, I want to write a bash script to delete the content after '#'. However, if '#' appears in a string with "", ignore this. For example, input file: test #delete "test #not delete" Output file: test "test #not delete" Does anyone know how to write this script? Thanks (1 Reply)
Discussion started by: jeffwang66
1 Replies

3. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

4. Solaris

Question about SunOS version, how to include in C source

Sorry if here is the wrong place to put this question, but for college we develop small programs in C using Solaris. Most of time is OK for us not to document nothing, until now. Every time program is executed must print OS name. Does Solaris has some predefined macros which I can include... (3 Replies)
Discussion started by: solaris_user
3 Replies

5. Shell Programming and Scripting

Quick Question concerning Reading and Writing

First off, this is not homework nor for any class. I have a file (column) of data such as: 12.56 2.78 0.54 22.7 ... etc. (call the file "num") I want to read in each line, then check to see whether it's greater than or equal to a value, say "1". If it is, save it in one file, if it's... (8 Replies)
Discussion started by: astropi
8 Replies

6. Homework & Coursework Questions

Question writing a shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell script that allows the user to run the following commands: ps top cmp netstat Once ... (3 Replies)
Discussion started by: qbnlnk
3 Replies

7. OS X (Apple)

open-source driver question

Hi, I'm a linux guy and have used netbsd, openbsd, freebsd etc in the past but never tangled with the kernel or drivers outside of Linux. My mother has fried her ethernet port on her iMac (G4 I think); I recently sent her a silicom USB U2E (usb 2 ethernet) dongle which is evidently not... (2 Replies)
Discussion started by: sjalex
2 Replies

8. Shell Programming and Scripting

writing to file question

when i do a echo on my variable and paste into excel, the result is like this ignore the commas here, just take it as if they're blank space, since i doing something else with it AutoMicroReport_51542.txt, APL FRANCE (004E), 20080508 11:16, APL ZIRCON 028S, BTSHIP, 91,58,... (2 Replies)
Discussion started by: finalight
2 Replies

9. Shell Programming and Scripting

Help needed in writing awk script for xml source

Hi, i am not able to get an approach for converting xml file to flat file using awk programming. Can anyone help me out. The input xml is like this: <outer> <field1>one</field1> <field2>two</field2> <field3>three<Error Code=777 Description=12345/></field3> <field4>four</field4> </outer>... (2 Replies)
Discussion started by: naren_0101bits
2 Replies
Login or Register to Ask a Question