Home » Questions » Computers [ Ask a new question ]

How to make gVIM portable

How to make gVIM portable

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

Asked by: Guest | Views: 191
Total answers/comments: 2
bert [Entry]

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.
bert [Entry]

"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."