E138: Can't write viminfo file $HOME/.viminfo!
any suggestions would be appreciated.
thx.
Jim Epler
San Diego,CA
http://www.mytechmusings.com
You are quitting vim, not vi.
> E138: Can't write viminfo file $HOME/.viminfo!
:h E138
[...]
When you get error "E138: Can't write viminfo file"
check that no old temp files were left behind (e.g.
~/.viminf*) and that you can write in the directory of
the .viminfo file.
--
JR
JR, thanks for the reply. I guess I should have also noted that I'm
editing as the root user on the machine which makes it more strange to
me. I don't see any temp files in the root user's home directory
related to .vmi. I'm running Darwin Kernel Version 7.9.0 (OS 10.3.9
Server).
Did you become root by doing "su" or "su -"? What is the
HOME variable set to when you edit?
See:
:h viminfo-write
and the notes that follow. Esp:
- Vim will not overwrite a viminfo file that is not writable
by the current "real" user. This helps for when you did
"su" to become root, but your $HOME is still set to a
normal user's home directory. Otherwise Vim would create
a viminfo file owned by root that nobody else can read.
--
JR
I typed "sudo -s" and authenticated using the admin's password to
arrive at the root prompt. I'm not sure exactly how to determine the
$HOME variable. I typed:
[www:~/] root# echo $HOME;
but was returned an empty line. I then typed "cd" and was returned
tcsh: cd: No home directory.
I'm going to go out on a limb here and guess this *might* be related
to the error I'm receiving?
This is most likely your problem. Looks like root doesn't
have a home defined in /etc/passwd (though I know nothing
about OS X, to be frank.)
In vim, doing:
:set viminfo=n/tmp/viminfo
should at least make the error stop.
--
JR
> In vim, doing:
> :set viminfo=n/tmp/viminfo
>
> should at least make the error stop.
>
when entering above I receive E518: Unknow option: viminfo=n/tmp/
viminfo. I've been using pico but have been trying to do more with vi
(vim) to broaden my horizons. I've begun to appreciate its nuances
which clearly reveal why it is a superior text editor. I guess I can
go back to pico or just close my eyes and ignore the warning.
Or set $HOME before invoking vim:
env HOME=/tmp vim ...
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
still getting the error. I even chmod'd 777 the .viminfo file found
in /tmp and to the .viminfo file in ~/var/root.
both these .viminfo files are universally writeable yet vim still
complains viminfo file $HOME/.viminfo!
What other directories might the .viminfo file reside?
You have somehow defined viminfo as the literal string '$HOME/.viminfo',
not the value of $HOME/.viminfo. For instance, if the root home directory
was /root, the message would have been
E138: Can't write viminfo file /root/.viminfo!
Dan Mercer
:
: any suggestions would be appreciated.
:
that makes sense. is there a preference or profile somewhere where I
can remove the quotes to set the value from a string back to the way
it should be represented?
-Jim
--
Minors in Kansas City, Missouri, are not allowed to purchase cap pistols;
they may buy shotguns freely, however.
--
"Well I don't see why I have to make one man miserable when I can make so many
men happy."
-- Ellyn Mustard, about marriage
AFAIK, OS X is based on freeBSD; so a quite typical Unix.
You don't need to change the complete OS, just fix some settings,
as far as I see. Maybe your /etc/passwd has no home directory for
root (add it and create the directory if not existing). What does
this command show on your box...?
$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/ksh
^^^^^
Maybe your profile is not set correctly; you seem to be using tcsh
as your default shell, so I cannot tell you about the specific tcsh
profile that you would have to add to your (root's) home directory,
but usually you find settings for the login shells in /etc/profile,
and perhaps also links to the shell specific profiles.
Elsethread you wrote:
> I tried setenv HOME=/tmp vi
> but received a syntax error, and then tried to add it to my
> csh.cshrc profile by hand, both to no avail.
Cannot tell about syntax for tcsh/csh but I had tried something like
$ setenv HOME /tmp
$ vi
or
$ setenv HOME=/tmp
$ vi
But better to use a non-dummy HOME directory.
Janis
You could do it with an alias:
alias hvi env HOME=/tmp vi
but that's bash-speak; I don't know tcsh.
--
-eben QebWe...@vTerYizUonI.nOetP royalty.mine.nu:81
When we've nuked the world to a cinder, the cockroaches picking
over the remains will be crawling over the remaining artifacts
and wondering what "PC LOAD LETTER" means. -- PC / ASR