[oak perl] vi: materials, tab conversions, etc.

Elijah Griffin oaklandpm at eli.users.panix.com
Sun Jun 18 23:52:25 PDT 2006


Michael Paoli <Michael.Paoli at cal.berkeley.edu> wrote:
> At the last Oakland Perl Mongers meeting, a couple folks asked about 

Which I missed...

> nvi and vim have distinct design goals, ... nvi is
> highly vi compatible, vim adds lots of bells and whistles, but isn't
> as compatible (keystroke sequences in vim are sufficiently different
> that vim often slows me down significantly,

That's funny. I find vim needs to be .exrc'ed into having sane settings
(nohighlightsearch, syntax off, etc) but other than how 'u' undos work
it is pretty close on the keystrokes.

nvi has irked me for years since it claims to be bug-for-bug compatible
but also says of modelines "will never be implemented" (huge security
hole there, but what's bug-for-bug mean really, if you don't implement
the buggy features?). Vim has a syntactically differnt implementation
of modelines to reduce the issue. Modelines are not on by default.

> The O'Reilly book spells out some of nvi's differences/additions, but
> these are the key ones I note, and also why I prefer nvi to vi:
> vi                                nvi

  forgets marks after sufficent     always remembers marks
  editing (still an issue in
  Sun's true vi)

> I think vim, nvi, and most(/all?) vi clones omit including the old
> crypt(1) functionality which is built-in to the non-free vi(1)/ex(1)

In college I was forced to write some code in a case-sensitive
lanugage that used upper case syntax (bleh). I once mistakenly
tried to use capslock in vi. Besides things just being wrong after
you hit <esc>, the encrypt command is :X while save and quit is :x.
Also random control keys are a valid encryption password.

Fortunately I had a terminal with a good scroll-back buffer and I
recovered most of my file that way. 

> I could probably easily do a whole article of various things in vim
> that annoy me, but probably >~=90% of vim users wouldn't be annoyed by

Lots of vim is annoying to me, but on the whole I prefer it to other
clones. Remembering the unnamed register between files and the multi-
window mode are my favorite bits of vim. I also am fond of history
on the : line, 'q' to make macros dynamically, and multiple undo, but
I could live without them.

> $ ls -flL /bin/ed /usr/bin/vi /usr/bin/nvi /boot/vmlinuz \
> > /usr/bin/vim /usr/bin/emacs

http://www.gnu.org/fun/jokes/ed.msg.html :
  And ed doesn't waste space on my Timex Sinclair.  Just look:

  -rwxr-xr-x  1 root          24 Oct 29  1929 /bin/ed
  -rwxr-xr-t  4 root     1310720 Jan  1  1970 /usr/ucb/vi
  -rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs

One thing I always need for my editing in vi or clones is this
macro:

:map * "yyy at y

	"y	yank into register y
	yy	the current line
	@y	execute it

It allows me to enter lines like the above (:map...) then hit *
and run them. Often lines will start something like:

:+,$s/
or
:g/

and have a complex expression. If I get it wrong, 'u', edit, redo.

Elijah


More information about the Oakland mailing list