Solved

Using vi to write programs?

Posted on 2000-02-21
4
272 Views
Last Modified: 2010-04-21
I'm teaching myself vi. I mainly want to use it to write C/C++ programs

I'd like to know how to get it to do a few things automatically for me such as:

-autoindent
-auto-generate closing brace on opening brace input
-auto generate */ on /* input

Is this possible?

Thanks!
0
Comment
Question by:totsubo
  • 2
4 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2542902
Probably not with most of the simple vi implementations. There might be one of the enhanced vi clones vim, elvis, etc that has a Language Sensitive Mode, but the best editor w/respect to programming languages (in my opinion) is either Emacs or Xemacs.
0
 

Expert Comment

by:cartoon022100
ID: 2543611
the first one  is absolutely possible

auto indent is done by giving
"set ai" in the .exrc file

the second one is done by givng set showmatch .This means it wont automatically generate closing bracesbut it will check for the matching(corresponding)opening braces every time when a brace is closed.

i'm sorry about the third one


0
 
LVL 33

Accepted Solution

by:
hongjun earned 20 total points
ID: 2544829
There is actually no way for auto inserting */ and } whenever you enter an opening tag for the corresponding tag.

However, autoindent is possible. Go to command mode by entering Esc key and then enter the below command.

:set autoindent

Note: vi editor is case-sensitive.
Hopes it helps.

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
ID: 2544830
There is actually no way for auto inserting */ and } whenever you enter an opening tag for the corresponding tag.

However, autoindent is possible. Go to command mode by entering Esc key and then enter the below command.

:set autoindent

Note: vi editor is case-sensitive.
Hopes it helps.

hongjun
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question