Solved

Using vi to write programs?

Posted on 2000-02-21
4
252 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now