vi temporary work file location

By default, vi places temporary work files in /var/tmp. You may want to redirect these work files to another location, especially if /var cannot be mounted in case of an error in your system's file system table (e.g. /etc/vfstab, /etc/fstab).

A temporary way to redirect these files:
EXINIT="set dir=directory" vi file

e.g. EXINIT="set dir=/tmp" vi /etc/vfstab


To set this permanently for a user, add the command to the user's ~/.exrc initialization file.
echo "set dir=directory" >> ~/.exrc

e.g. echo "set dir=/tmp" >> ~/.exrc

For more information, read the ex man page.

Back to brandonhutchinson.com.
Last modified: 03/14/2003