[arch-dev-public] Drop VI from [core] (was Re: [arch-general] Winter Cleanup of [community])

Alexander Rødseth rodseth at gmail.com
Tue Jan 29 18:47:43 EST 2013


Hi,


5 days have passed.


There are exactly 8 packages in [core] that falls back on vi.


=== visudo ===

People can either run visudo like this:

# EDITOR=vim visudo

Or this could be added to /etc/sudoers (possibly by default):

Defaults editor=/usr/bin/vim

This can be configured by the user, or changed in the sudo package.

Both methods work, and vi is not needed in either case.


=== cronie and glibc ===

The same goes for crontab. This works fine:

EDITOR=vim crontab -e


In order to set the default editor for crontab at compile time,
_PATH_VI has to be set correctly in glibc.

Here's the relevant code from src/pathnames.h in cronie:

#if defined(_PATH_VI)
# define EDITOR _PATH_VI
#else
# define EDITOR "/usr/ucb/vi"
#endif

For changing the default editor (_PATH_VI) to vim in glibc, just add
this line to the build() function:

sed -i 's:/vi:/vim:' sysdeps/generic/paths.h sysdeps/unix/sysv/linux/paths.h


=== less and util-linux ===

These tries to start an editor when the "v" key is pressed. They both
respect EDITOR and VISUAL but falls back on vi.

(Is less really needed in [core], when more is supplied by util-linux?
It seems a bit redundant).

The fallback editor for less can be changed at compile time by adding
the --with-editor flag:

./configure --with-editor=vim

For the more utility in the util-linux package, set the fallback
editor to vim by adding this line to the build() function:

sed -i 's/"vi"\t/"vim"\t/' text-utils/more.c



=== bash ===

bashbug that comes with bash falls back on vi. Add this line to the
build() function to change this to vim:

sed -i 's/\([^a-zA-Z]\)vi/\1vim/' support/bashbug.sh



For all of the changes for all of the above packages, I've rebuilt the
packages and tested the functionality by unsetting EDITOR and VISUAL
and removing /usr/bin/vi.


=== hairloom-mailx ===

In the build() function in the PKGBUILD, add:

 sed -i 's:"vi":"vim:' edit.c


=== shadow ===

Set the define DEFAULT_EDITOR to "vim" when compiling.



I know that patching files with sed isn't really "The Arch Way" (even
though a large numbers of packages do this), so if the remaining
argument is that the switch from vi to vim has to come from upstream,
I'm willing to submit patches/bug reports for all of the above that
needs changes in the sourcecode (preferably without "vi" being
hardcoded).



=== In summary ===

* All packages should respect the EDITOR or VISUAL environment
variables (or at least _PATH_VI), so users can select whichever editor
they like.
* It's fully possible to change the fallback editor for all [core]
packages to be vim instead of vi.
* Switching from vi to vim should be unproblematic.


+1 for dropping vi from [core] and including vim on the install medium instead.


-- 
Sincerely,
  Alexander Rødseth
  xyproto / TU


More information about the arch-dev-public mailing list