Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Using vi to write programs?

Posted on 2000-02-21
4
Medium Priority
?
288 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 60 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

647 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