Tom Purl wrote:
I'm trying to use Gvim on Windows from a USB thumbdrive.  I found and
installed
the GvimPortable project (http://portablegvim.sourceforge.net/), and it works
pretty well.

The only problem is that I would like to use a non-standard location for
my vimfiles directory.  Here's the basic directory layout that I would
like to use:

USB_ROOT
|
|__/Apps
   |
   |__/conf
   |  |
   |  |__/vim
   |     |
   |     |__vimrc
   |     |
   |     |__/vimfiles (my custom vimfiles dir)
   |
   |__/GVimPortable
      |
      |__GVimPortable.exe (which launches gvim)
      |__GVimPortable.ini (which has some config options)

Using this custom directory structure, I hope to protect my custom
vimfiles directory when I upgrade GvimPortable (or any other app on my
thumbdrive).

I'm currently able to set the location of the vimrc file using the
GVimPortable.ini file, but I'm unable to specify the location of my
custom vimfiles directory.  Since my vimfiles directory is usually
placed in my $HOME directory, I tried putting both of the following
commands into my vimrc:

    let $HOME = "."
    let $HOME = "E:/Apps/_conf/vim"

Both commands seems to change the value of the $HOME dir, but it does
nothing to load the plugins and such in my custom vimfiles directory.

Does anyone know how to fix this?

Thanks in advance!

Tom Purl



I suggest the following variation, which I think will work:

USB_ROOT
\__ Apps
    \__ Vim
        |__ vimrc (optional: system vimrc)
        |__ _vimrc (user vimrc, if not in %HOME%)
        |__ vimfiles
        |   \__ user scripts, not distributed with vim
        |       no executables; otherwise
        |       same directory astructure as below
        \__ vim70
            |__ gvim.exe
            |__ vim.exe
            |__ various global scripts and programs
            |__ autoload
            |   \__ autoload scripts
            |__ colors
            |   \__ colorschemes
            |__ compiler
            |   \__ compiler scripts
            |__ doc
            |   \__ help files
            |__ ftplugin
            |   \__ filetype-plugins
            |__ indent
            |   \__ indent scripts
            |__ keymap
            |   \__ keymaps
            |__ lang
            |   \__ menu translations
            |       in subdirectories: message translations
            |__ macros
            |   \__ miscellaneous
            |__ plugin
            |   \__ global plugins
            |__ print
            |   \__ *.ps
            |__ spell
            |   \__ spelling dictionaries
            |__ syntax
            |   \__ syntax scripts
            |__ tools
            |   \__ various sources, shell scripts, etc.
            \__ tutor
                \__ Vim tutor files

Leave %HOME% at its usual setting. Put neither a _vimrc nor a .vimrc in it if you want to use the _vimrc on the USB key

Set a few other environment variables as follows (you may want to set them from a "startup" script run from somewhere on the USB key if plugged).

        SET VIM_VERSION=70
        SET VIM=%USB_ROOT%\Apps\Vim
        PATH %USB_ROOT%\Apps\Vim\vim%VIM_VERSION%;%PATH%

Invoking "vim" or "gvim" will then load Vim from the USB key. It will spontaneously set $VIMRUNTIME to $USB_ROOT/Apps/Vim/vim70 which is the proper setting for this directory architecture.

Your user files (in $VIM and $VIM/vimfiles but not $VIM/vim70) are kept apart from the distribution (in $VIM/vim70). Startup files peculiar to Vim, but which don't come from the distribution, can reside in $VIM.

When Vim 7.1 comes out, you will install the new distribution in $VIM (which the installer will probably propose as default), it will create a directory tree starting at $VIM/vim71 and install itself into it. You will then change the first "set" line above to

        SET VIM_VERSION=71

, remove the $VIM/vim70 directory tree, and leave the rest unchanged.


Best regards,
Tony.

Reply via email to