12
1
I wanted to set the VIMHOME
variable this way (common to Windows and Linux),
let $VIMHOME=expand("%:p")."/..",
so that VIMHOME
is "~/.vim" in Linux or "path/to/vimfiles" in Windows.
I put this in a var.vim
file and placed this in the plugin directory.
It loads properly, but VIMHOME is set only to "./..".
How do I get the full path of a file using expand
?
Is there an easy way to set VIMHOME
?
Edit: I changed the expression to:
let $VIMHOME=expand("<sfile>:p:h")
Now, VIMHOME
is set to "~/.vim/plugin" in Linux.
My requirement is setting VIMHOME to "~/.vim" or "path/to/vimfiles". But,
let $VIMHOME=expand("<sfile>:p:h")
let $VIMHOME=expand("$VIMHOME:p:h")
is not working.
How can I resolve this?
Add another
:h
. I have updated my answer. – Chris Johnsen – 2010-03-15T09:30:44.153oh.. Thanx thats working as well.. – asdfg – 2010-03-15T09:55:04.973