How to make gVIM portable

3

1

Is it possible to make a default gVIM installation (Windows) portable so that I can carry it on a USB stick?

I know there are a few portable distributions out there, but they all seem to be unmaintained.

guillermooo

Posted 2009-10-15T10:05:00.933

Reputation: 2 093

Since you are not mentioning what platform you are on, I assume it is some incarncation of Windows? – innaM – 2009-10-15T11:24:59.553

Edited question to add platform (Windows). – guillermooo – 2009-10-15T13:06:37.070

Answers

3

gVim Portable is a feature rich and not-too-hard-to-use text editor, and a very feature rich one at that. With gVim you can code, highlight syntax, and do everything else you would expect of a text editor worth its weight in megabytes.

joe

Posted 2009-10-15T10:05:00.933

Reputation: 11 615

1i liked gvim portable. but i hated the fact that you can't rename the .exe file. – Rook – 2009-10-15T11:34:06.680

ya .its true ;) – joe – 2009-10-15T11:38:32.600

2

gVim is pretty much portable as is. If you download the binaries from vim.org, from the zip file (or .tz, I'm not sure now). and start using it you'll notice the only thing it leaves is your backup and swap and similar files in ... documents and settings ... directory.

Put this in your vimrc

set nobackup
set nowritebackup
set noswapfile
set viminfo=

and, if I'm not mistaken, it should work like a charm.

Rook

Posted 2009-10-15T10:05:00.933

Reputation: 21 622

1"gVim is pretty much portable as is" .. well, thats pretty much true for all software :) – akira – 2009-10-15T13:05:28.117

?? ... what I ment was that gvim is portable even in its non-portable binaries distribution, if you take the above into consideration. That is hardly true for most software. ... what did you mean ? – Rook – 2009-10-15T14:11:51.977

i meant that you can actually move around the folders in %PROGRAMFILES% (or their equivalent in other OS) pretty freely. i am doing this even with visual studio, the 'only' thing to do is setting some enviromnet variables... thats the normal way of deploying software: "copy it into a folder". that fact is nothing special for vim, thats all i was trying to say... dont take it too seriously. – akira – 2009-10-15T15:20:29.073

no, no ... non taken :)

But I don't understand ... you're saying one can for example, rename a folder in program files and move it somewhere else or ... I din't quite catch your meaning ...

please, do explain. – Rook – 2009-10-15T16:58:03.993

exactly, take a folder, rename it and most software will work. thats the reason why portableapps.com can take the software and 'repack' it. – akira – 2009-10-15T18:03:47.950

1

To make gvim portable you need only change the HOME directory. It does not take more than a small batch script to accomplish this.

Suppose you have already downloaded the gvim archive as well as its runtime files and installed them. Your gvim installation is something like this:

C:\path\to\your\vim\vim81\gvim.exe

where 81 is the version number which may change accordingly.

Create a home directory just parallel to the folder containing gvim.exe, and a batch file (named portable_gvim.bat, say) right into the gvim.exe folder, like this:

vim
├─home
│      _viminfo
│      _vimrc
│      
└─vim81
    │  gvim.exe
    │  portable_gvim.bat
    │  
    ├─autoload
    ............

then enter the contents of portable_gvim.bat as following:

:: Changing gvim's home directory to make it portable
:: Put this file next to gvim.exe 

@echo off
setlocal

pushd %~dp0..
set "HOME=%CD%\home"
popd

start "" "%~dp0gvim.exe" %*

endlocal
echo on

and that's it. put your _vimrc in that portable home, launch the batch, and enjoy.

Y.Lin

Posted 2009-10-15T10:05:00.933

Reputation: 13