The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mail format problem: ali560045 Shell Programming and Scripting 5 06-04-2008 09:52 AM
To convert multi format file to a readable ascii format gaur.deepti UNIX for Dummies Questions & Answers 5 03-25-2008 03:03 PM
CSV format problem ccwq Shell Programming and Scripting 10 08-06-2007 03:16 AM
format problem bebop1111116 High Level Programming 5 10-10-2006 11:41 AM
serial no. format problem unknown2205 UNIX for Dummies Questions & Answers 6 12-05-2005 11:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-28-2003
HOUSCOUS HOUSCOUS is offline
Registered User
  
 

Join Date: Feb 2002
Location: Houston TX
Posts: 123
Question Format Problem with vim

Hi, there. Everyone had a great Thanksgiving?

I have a slice format problem when I am using vim to edit c++ source code. I don't know how to discribe the problem exactly. You see, usually when I use the command "vi hello.cpp" to write a code, it will have the format like this:


Code:
#include <iostream>

using namespace std;

int main()
{
        cout << "hello, world!" << endl;
        
        cin.get();cin.get();
        return 0;
}

Recently, I don't know what I did, when I do the same thing, it becomes like this:


Code:
#include <iostream>

using namespace std;

int main()
{
cout << "hello, world!" << endl;

cin.get();cin.get();
return 0;
}

I mean I could use <tab> to move around the code, but it would be unconvnient. Besides, usually when I used an open parenthesis or bracket, it would remind me to close it. Now the warning is gone, too.

Could anyone help me change vim back to the original setting?
  #2 (permalink)  
Old 11-28-2003
google's Avatar
google google is offline Forum Advisor  
Moderator
  
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Take a look in your home directory for a hidden file .exrc This is the vi customization file. Did you by chance delete it? or unwittingly modify it?

Here is a link for more information on setting it up and for customizing your vi options.
  #3 (permalink)  
Old 11-28-2003
linuxpenguin's Avatar
linuxpenguin linuxpenguin is offline Forum Advisor  
Registered User
  
 

Join Date: May 2002
Location: India
Posts: 295
in the .exrc file you may have a entry like

set tabstop=
or se ts=

which means set the tabstop. You may set it and then check.
also check if your vi is vi and not vim. sometimes vi is aliased to vim or soft linked to vim. in that case your configuration file will not be .exrc. it will be .vimrc

There are a couple of more things that set the tabs
1. autoindent
2. smartindent
3. cindents

to know more of these you can simple type h cindents in the vi editor's command mode i.e. the : mode

hope this helps
  #4 (permalink)  
Old 11-29-2003
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
I believe smartindent is what you need. Try to enter the command

set smartindent

and see if this is what you want.
  #5 (permalink)  
Old 12-04-2003
HOUSCOUS HOUSCOUS is offline
Registered User
  
 

Join Date: Feb 2002
Location: Houston TX
Posts: 123
Thank you, guys. I didn't find the .exrc file. I think I might delete or damage it by incident. I think I just install vi again to see what will happen. Thanx again.

HOUSCOUS
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0