Solved

Using vi to write programs?

Posted on 2000-02-21
4
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.

732 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