Change default viewdir on Windows to $HOME/vimfiles/view

311 views
Skip to first unread message

Rob Owens

unread,
Mar 28, 2014, 11:32:57 AM3/28/14
to vim...@googlegroups.com
The default viewdir on Windows is $VIM/vimfiles/view, which is to say C:\Program Files (x86)\Vim\vimfiles\view.  When a user runs :mkview, Vim attempts to write to the viewdir, but the user most likely does not have write permission to this directory.  The following errors are issued:

E739: Cannot create directory C:\Program Files (x86)\Vim/vimfiles/view
E190: Cannot open "C:\Program Files (x86)\Vim/vimfiles/view\~=+_vimrc=" for writing

In order to use the default viewdir, the system administrator needs to create C:\Program Files (x86)\Vim\vimfiles and C:\Program Files (x86)\Vim\vimfiles\view, and give the user write permission for C:\Program Files (x86)\Vim\vimfiles\view.  In a multi-user system, users could edit each other's view files, which is a security concern.

As a non-expert user of Vim, it took me a while to discover the viewdir setting so I could work around this.

In order to make Vim work better out of the box, I think it would be sensible to make the default viewdir $HOME/vimfiles/view, as it is in Unix.  I would suggest that you also consider creating $HOME/vimfiles and $HOME/vimfiles/view by default (again, in the interest of making Vim work better out of the box).  If there is a policy in place that prevents creating the viewdir automatically, at least an informed user will be able to create the needed directories manually without requiring admin privileges.

There are several other OS's which have $VIM/vimfiles/view as the default viewdir, but I cannot comment on whether that creates the same problems it does on Windows. 

Thanks for the great software!

-Rob

Bram Moolenaar

unread,
Mar 29, 2014, 8:27:48 AM3/29/14
to Rob Owens, vim...@googlegroups.com
I agree that for MS-Windows the default 'viewdir' value was not a good
choice. Unfortunately, we cannot change it now without users losing the
files they had already stored there.

I suppose we either need to make 'viewdir' a list of directory names, or
add another option for a 'viewdir' read-only directory.

--
Q: What's a light-year?
A: One-third less calories than a regular year.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages