Upgrade to recent version broke vimrc -- doesnt recognize unix style environmental variables

23 views
Skip to first unread message

tom

unread,
Feb 16, 2021, 2:03:29 AM2/16/21
to v...@vim.org

I was working in vim and tried to sort something. The sort didn't work as I expected.

I thought I would upgrade to version 8.0 in the hopes that would fix it. The upgrade gave me a new problem.

in my vimrc there was the line

set backupdir=$HOME/vim/backup

This no longer works and yields the dreaded "E303: Unable to open swap file"

I fixed it this way

set backupdir=c:\\Users\\myuser\\Documents\\home\\vim\\backup,c:\\TMP


Regards Tom Bodine

joh...@nacs.net

unread,
Feb 17, 2021, 12:58:59 PM2/17/21
to vim...@googlegroups.com, v...@vim.org
I would try running the following as an ex command:

:echo $HOME

It might be that Vim does not see a HOME environment
variable on Windows.

c.wil...@btinternet.com

unread,
Feb 17, 2021, 5:45:55 PM2/17/21
to vim...@googlegroups.com, v...@vim.org
Hi

it seems the equivalent Windows environment variable is HOMEPATH

Chris Willis
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210217180002.GD14859%40linux.site.

Tony Mechelynck

unread,
Feb 17, 2021, 6:42:48 PM2/17/21
to tom, vim_use
On Tue, Feb 16, 2021 at 8:03 AM tom <freeis...@gmail.com> wrote:
>
> I was working in vim and tried to sort something. The sort didn't work as I expected.
>
> I thought I would upgrade to version 8.0 in the hopes that would fix it. The upgrade gave me a new problem.

Upgrade "to" Vim 8.0? That's rather behind the times. The latest Vim
as of this writing is version 8.2.2529. It is not at all impossible
that one of the patches between version 8.0.0 and version 8.2.2529
fixes your problem.

>
> in my vimrc there was the line
>
> set backupdir=$HOME/vim/backup
>
> This no longer works and yields the dreaded "E303: Unable to open swap file"
>
> I fixed it this way
>
> set backupdir=c:\\Users\\myuser\\Documents\\home\\vim\\backup,c:\\TMP

This way, at least, there is a fallback if
C:/Users/myuser/Documents/home/vim/backup is for some reason not
writable; but anyway it is a strange (but IIUC allowable) value. I
never had problems with the default value, which puts the backup file
in the same directory as the original if possible (and usually it is),
which avoids name clashes if you happen to edit files with the same
name in different directories.

On Windows, if Vim finds the HOME environment unset at startup ($HOME
in Vim and Unix terminology, %HOME% in DOS/Windows terminology), that
variable will be set for the duration of the Vim process to the
expansion of $HOMEDRIVE$HOMEPATH if $HOMEDRIVE is defined, or of
$USERPROFILE otherwise, see ":help $HOME-windows".
>
>
>
> Regards Tom Bodine

Best regards,
Tony.

tom

unread,
Feb 19, 2021, 10:36:47 AM2/19/21
to Tony Mechelynck, vim_use
Tony you are correct. When I set this
image.png
Then my old vimrc started working again.

I had had this variable set for years. its also set in my bashrc. When I installed Vim 7.22 some years ago I wrote a wrapper batch file to run vim inside a bash shell. Then I change the association for text and code files to run the script instead of gvim directly. This would insure vim would see the same variables I have in any bash shell I run. When Installed the upgrade to vim this set up was blown away, and I had forgotten what I had done. Its been two years,

Thanks

Tony Mechelynck

unread,
Feb 19, 2021, 1:16:56 PM2/19/21
to tom, vim_use
Happy to know you found what caused your problem. Have fun with Vim, and don't forget to upgrade to some not-too-old version of Vim 8.2, because Vim 8.0 is _still_ out of date.

Best regards,
Tony.

Cameron Simpson

unread,
Feb 20, 2021, 11:38:47 PM2/20/21
to 'c.willis111@btinternet.com' via vim_use, v...@vim.org
On 17Feb2021 22:45, vim_use <vim...@googlegroups.com> wrote:
>I would try running the following as an ex command:
>:echo $HOME
>It might be that Vim does not see a HOME environment variable on
>Windows.
>Hi
>it seems the equivalent Windows environment variable is HOMEPATH

You could see if you can use ~/ instead of $HOME/ - if accepted that
might work in both UNIX and Windows. (Untested suggestion.)

Cheers,
Cameron Simpson <c...@cskk.id.au>
Reply all
Reply to author
Forward
0 new messages