🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #3342

Re: vi on ms-dos

#3342
From: Mark Dobie
Date: Mon, 10 Jun 1991 12:12
149 lines
7868 bytes
In <1991Jun7.172233.7978@welch.jhu.edu> glenn@welch.jhu.edu (Glenn M. Mason) writes:

>Then I have a few questions for you which are directed at a standard
>implementation of vi on a Unix platform. If vi can do "anything that can
>be done" via mocro customization, please show me how to accomplish the
>following things ... because if you can, I may actually *use* vi:

Here's my best shot at some of them. If you want better answers, ask in
comp.editors where the REAL(tm) vi gurus live. I learned most of what
I know there. By the way, we should only really talk about things that
*manipulate the files*, rather than how the editor displays things
etc.

>Can you show me how to customize vi to display 2 or more files for
>simultaneous editing?

I assume you mean *editing* 2 or more files for simultaneous
*display*. No way that I know of. This isn't to do with the files.

>Can you tell me how to get vi to use filename completion when I forget the
>name of a file I want to edit when I am already in vi ... like commanding
>vi to "e <partial_filename>" , then tell vi to display for me a list of
>files in the working directory that match that expression?

If you will settle for wildcards, then :n file will work. If not, you
could write a macro that ran ls, showed you the output (in a temp
file), let you pick one and then loaded it with :e. Not quite the
same, but nearly there.

>Can you show me how to customize vi to split the display and allow me to
>edit 1 or more files in multiple windows/buffers while giving me an inter-
>active shell in another window to access the OS while I am editing ... all
>accomplished by never leaving the editor?

Is this really necessary? If you do it, each window is tiny, unless
you have a windowing system, in which case you don't need to do it.

>Can you show me how to get vi to run an OS command in a window so that I
>can edit, cut and paste, etc. the OS command output for use within a file
>that I am editing?

:.!dir should replace the current line with the output of dir (or
whatever) in your file.

>Can you show me how to customize vi to run 'make' and automatically bring
>into the editor source files and move the cursor to the point of syntax
>errors ... and move forward/backward from/to next error and/or source
>file tracking each error (just like many integrated edit/compile/debug
>environments that come with many PC-based language systems?

Macros for doing this basically take the compiler output into another
file and then you have macros to move between the error positions. The
macros must know about the format of the compiler error messages. Some
vi's have this built in (stevie?, maybe elvis).

>Can you show me how to edit a document in vi and ask vi to invoke 'spell'
>over the text and then move the cursor forward/backward tracking possible
>spelling errors at the touch of a key (only after I have been given a
>chance to edit the list of possible mistakes, deleting the entries that
>I know are spelled correctly and may not be in the dictionary)?

Similar to the make problem. spell is run over the entire file
(:%!spell -b) and the output saved somewhere. Macros search for the
misspelled words in the original text. Of course you can edit the
spelling errors wherever they are saved (either on the end of the
original, or in a temp file).

>Can you tell me how to make vi push and pop directories so that I can
>move around easily and edit different files in different directories
>without leaving ther editor (oh yeah ... and if I forget the name of the
>directories, I want vi to help me out with their names as well)?

No way (I think). Not file manipulation though.

>Can you tell me how I can make vi map any particular function that it
>is capable of to a keystroke that I am comfortable with?

:map <key> <commands>

Key can be almost any key, special ones escaped by ctrl-V. Commands
are simply the keystrokes you would type to do it manually (again.
special ones (like escape and return) escaped with ctrl-V). This can
work in command mode and editing mode (if you use :map!)

>Can you show me how to make vi *warn* me that the file I am attempting
>to save has been saved to disk after I invoked vi on the file (which
>means that someone edited and saved the file within the time I was
>editing the same file)?

On a PC? Not sure on a UNIX machine either. Maybe it could ls -l and
check the timestamps. (YUK).

>Can you tell me how to customize vi to give on-line, context-sensitive
>help text for *any* possible function that vi has?

Tags would be good for this. ctrl-] looks up the current word in a
file called "tags" and jumps to a specific place in another file
(specified in the tags file). ctrl-^ takes you back to where you were.
You would need a tutorial on vi and a program to generate the tags
file of places to jump to for each command.

Tags are usually used for jumping to function definitions in C
programs. Elvis comes with a ctags program which lets you do this. Its
brill. I know of no other system that has it (emacs probably does).

>Can you show me how to make vi aware that when I type a certain word
>abbreviation, vi really knows that I want the abbreviation expanded?

:abbrev <abbreviation> <expansion> will do it as you type. If you have
lots of these set up it can slow things down a little. One use might
be for common programming constructs (eg a function definition).

>Can you show me how to make vi display the time or date in an obscure
>portion of the screen, or notify me that new mail has arrived, or display
>the name of the file I am editing, or tell me what editing mode I am in?

Many vi's have :set showmode (or something similar) to display the
editing mode. ctrl-G will display details of the file you are
editing. The rest you can do with other programs (both on PC and UNIX
systems).

>If you can show me how to do any of these things, I'd really like to
>know how! Because these are just *some* of the features that I want in an
>editor and already have with no customization at all. These features are
>all available within Jove which is a free, public-domain program ... and
>Jove is an excellent editor but is really just an emacs implementation
>that is merely a subset of most of the more powerful emacs implementations
>available. 

Well, if you are happy with emacs you should be able to have most of
it. I have never got to grips with emacs (one day...).

>If these things can be done in vi, show me *how* it can be done, because
>I would be very interested in knowing how to customize vi to do some of
>these things ... and I'm sure there are other vi users out there that
>would like to know as well! Show me!!

Alas, I have not provided much detail because I am (relatively) new to
vi macros and have never implemented anything like this. There are
macro sets to do some of the things you want (spelling and error messages)
and the rest are mostly possible, but with work.

Last but not least, my recommended PC vi is elvis. It does all this
and more.

				Mark. (phew)
-- 
Mark Dobie                              M.Dobie@uk.ac.soton.ecs (JANET)
University of Southampton		M.Dobie@ecs.soton.ac.uk (Bitnet)
Technical Details
Message-ID: <8075@ecs.soton.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!icdoc!sot-ecs!mrd
References: <1991Jun01.110117.19901@cavebbs.gen.nz> <1991Jun3.143356.26128@welch.jhu.edu> <1991Jun05.153324.25760@chinet.chi.il.us> <1991Jun7.111929.8902@news.cs.indiana.edu> <1991Jun7.172233.7978@welch.jhu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!icdoc!sot-ecs!mrd
From: mrd@ecs.soton.ac.uk (Mark Dobie)
Newsgroups: comp.os.msdos.misc
Subject: Re: vi on ms-dos
Message-ID: <8075@ecs.soton.ac.uk>
Date: 10 Jun 91 12:12:40 GMT
References: <1991Jun01.110117.19901@cavebbs.gen.nz> <1991Jun3.143356.26128@welch.jhu.edu> <1991Jun05.153324.25760@chinet.chi.il.us> <1991Jun7.111929.8902@news.cs.indiana.edu> <1991Jun7.172233.7978@welch.jhu.edu>
Organization: University of Southampton, UK
Lines: 149