installing/running gvim on USB key (Windows)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

installing/running gvim on USB key (Windows)

Stephen M. Brooks
I read a recent article on the "Ultimate USB Key" which talks about
carrying applications on the larger flash drives to serve as a personal
portable office.  You can get portable versions of most stuff you need
to handle e-mail, browsing, and office applications like spreadsheets, etc.

Has any tried installing and running gvim/vim on a removable USB key for
portable use on Windows PCs?  What works?  What doesn't work?

Thanks,

Steve
Reply | Threaded
Open this post in threaded view
|

Re: installing/running gvim on USB key (Windows)

A.J.Mechelynck
----- Original Message -----
From: "Stephen M. Brooks" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, September 22, 2005 5:35 PM
Subject: installing/running gvim on USB key (Windows)


>I read a recent article on the "Ultimate USB Key" which talks about
>carrying applications on the larger flash drives to serve as a personal
>portable office.  You can get portable versions of most stuff you need to
>handle e-mail, browsing, and office applications like spreadsheets, etc.
>
> Has any tried installing and running gvim/vim on a removable USB key for
> portable use on Windows PCs?  What works?  What doesn't work?
>
> Thanks,
>
> Steve

I think it may work for single-user use, if you leave $VIM and $VIMRUNTIME
both unset in your environment and use the default directory names
(...something.../vim/vim63/ or ...something.../vim/vim70aa/). Vim will then
set these environment variables internally on the basis of the directory
from which its executable was loaded and of its version number.

Place your _vimrc (and your _gvimrc, if any) in $VIM, and if you have any
user scripts, place them at the proper place in $VIM/vimfiles or its
subdirectories.

If you want to call Vim without a full path, you may have to include the
directory where its executable(s) reside into your PATH, or else to have a
batch file do the proper redirection, similar to the following

@"Q:\Program Files\vim\vim63\%0 %1 %2 %3 %4 %5 %6 %7 %8 %9

Place one copy of the above one-line file in some directory in your PATH
(with the proper full path filled-in) for each Vim executable you have,
e.g., vim.bat to call vim.exe, gvim.bat to call gvim.exe etc. Invoke them as
vim gvim etc. with no extension.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: installing/running gvim on USB key (Windows)

Halim, Salman
In reply to this post by Stephen M. Brooks
I'm on a Windows environment, and have Gvim installed on my USB drive.
I use this batch file to set up the environment:

-- Begin --
@echo off
setlocal ENABLEEXTENSIONS

set VIMVERSION=70

if "%1"=="63" set VIMVERSION=63

set VIM=%~dp0
set VIMVERSIONDIRECTORY=%VIM%vim%VIMVERSION%
set VIMRUNTIME=%VIMVERSIONDIRECTORY%

if "%1"=="63" set VIMRUNTIME=%VIMRUNTIME%\runtime

set PATH=%VIMVERSIONDIRECTORY%;%PATH%

if "%1"=="63" shift

rem To start with correct parameters and skip the first, %*
rem doesn't work -- need to stick with %1 %2 etc.
start gvim.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

endlocal
-- End --

There are few quirks:

- You may pass in 63 as the first parameter if you're running Gvim 6.3
-- I'm not, but I haven't got around to updating this batch file.
- When I ran 6.3, I had a directory called runtime under my main Vim
directory -- I don't in Vim 7.
- On Windows XP (which is what I use, though I'm sure this will work on
2000 also), 'shift' shifts the arguments, but %* still returns the
original set, forcing the %1 %2 %3 %4 bit at the bottom.

The key thing is the %~dp0, which basically sets $VIM to the path of the
batch file.  So, if the batch file resides in c:\vim, $VIM becomes
c:\vim...  (That's what the ENABLEEXTENSIONS does.)

Hope this helps,

Salman.

> -----Original Message-----
> From: Tony Mechelynck [mailto:[hidden email]]
> Sent: Thursday, September 22, 2005 12:05 PM
> To: Stephen M. Brooks; [hidden email]
> Subject: Re: installing/running gvim on USB key (Windows)
>
> ----- Original Message -----
> From: "Stephen M. Brooks" <[hidden email]>
> To: <[hidden email]>
> Sent: Thursday, September 22, 2005 5:35 PM
> Subject: installing/running gvim on USB key (Windows)
>
>
> >I read a recent article on the "Ultimate USB Key" which talks about
> >carrying applications on the larger flash drives to serve as
> a personal
> >portable office.  You can get portable versions of most
> stuff you need to
> >handle e-mail, browsing, and office applications like
> spreadsheets, etc.
> >
> > Has any tried installing and running gvim/vim on a
> removable USB key for
> > portable use on Windows PCs?  What works?  What doesn't work?
> >
> > Thanks,
> >
> > Steve
>
> I think it may work for single-user use, if you leave $VIM
> and $VIMRUNTIME
> both unset in your environment and use the default directory names
> (...something.../vim/vim63/ or ...something.../vim/vim70aa/).
> Vim will then
> set these environment variables internally on the basis of
> the directory
> from which its executable was loaded and of its version number.
>
> Place your _vimrc (and your _gvimrc, if any) in $VIM, and if
> you have any
> user scripts, place them at the proper place in $VIM/vimfiles or its
> subdirectories.
>
> If you want to call Vim without a full path, you may have to
> include the
> directory where its executable(s) reside into your PATH, or
> else to have a
> batch file do the proper redirection, similar to the following
>
> @"Q:\Program Files\vim\vim63\%0 %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> Place one copy of the above one-line file in some directory
> in your PATH
> (with the proper full path filled-in) for each Vim executable
> you have,
> e.g., vim.bat to call vim.exe, gvim.bat to call gvim.exe etc.
> Invoke them as
> vim gvim etc. with no extension.
>
> Best regards,
> Tony.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Re: installing/running gvim on USB key (Windows)

A.J.Mechelynck
In reply to this post by Stephen M. Brooks
Stephen, please make sure to accept all vim-list messages, whoever their
author.

Tony.

----- Original Message -----
From: [hidden email]
To: [hidden email]
Sent: Thursday, September 22, 2005 6:04 PM
Subject: Re: Re: installing/running gvim on USB key (Windows)


I apologize for this automatic reply to your email.


To control spam, I now allow incoming messages only from senders I have
approved beforehand.


If you would like to be added to my list of approved senders, please fill
out the short request form (see link below). Once I approve you, I will
receive your original message in my inbox. You do not need to resend your
message. I apologize for this one-time inconvenience.


Click the link below to fill out the request:


https://webmail.atl.earthlink.net/wam/addme?a=stephenbrooks@...&id=1eitz5Oj3Nl3r10 


Reply | Threaded
Open this post in threaded view
|

Re: installing/running gvim on USB key (Windows)

A.J.Mechelynck
In reply to this post by Halim, Salman
For 7.0, the version-dependent directory should be "vim70aa" not "vim70"; so
the 3rd non-blank line should be "set VIMVERSION=70aa".

Best regards,
Tony.
----- Original Message -----
From: "Halim, Salman" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Stephen M. Brooks"
<[hidden email]>; <[hidden email]>
Sent: Thursday, September 22, 2005 6:34 PM
Subject: RE: installing/running gvim on USB key (Windows)


> I'm on a Windows environment, and have Gvim installed on my USB drive.
> I use this batch file to set up the environment:
>
> -- Begin --
> @echo off
> setlocal ENABLEEXTENSIONS
>
> set VIMVERSION=70
>
> if "%1"=="63" set VIMVERSION=63
>
> set VIM=%~dp0
> set VIMVERSIONDIRECTORY=%VIM%vim%VIMVERSION%
> set VIMRUNTIME=%VIMVERSIONDIRECTORY%
>
> if "%1"=="63" set VIMRUNTIME=%VIMRUNTIME%\runtime
>
> set PATH=%VIMVERSIONDIRECTORY%;%PATH%
>
> if "%1"=="63" shift
>
> rem To start with correct parameters and skip the first, %*
> rem doesn't work -- need to stick with %1 %2 etc.
> start gvim.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> endlocal
> -- End --
>
> There are few quirks:
>
> - You may pass in 63 as the first parameter if you're running Gvim 6.3
> -- I'm not, but I haven't got around to updating this batch file.
> - When I ran 6.3, I had a directory called runtime under my main Vim
> directory -- I don't in Vim 7.
> - On Windows XP (which is what I use, though I'm sure this will work on
> 2000 also), 'shift' shifts the arguments, but %* still returns the
> original set, forcing the %1 %2 %3 %4 bit at the bottom.
>
> The key thing is the %~dp0, which basically sets $VIM to the path of the
> batch file.  So, if the batch file resides in c:\vim, $VIM becomes
> c:\vim...  (That's what the ENABLEEXTENSIONS does.)
>
> Hope this helps,
>
> Salman.
>
>> -----Original Message-----
>> From: Tony Mechelynck [mailto:[hidden email]]
>> Sent: Thursday, September 22, 2005 12:05 PM
>> To: Stephen M. Brooks; [hidden email]
>> Subject: Re: installing/running gvim on USB key (Windows)
>>
>> ----- Original Message -----
>> From: "Stephen M. Brooks" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Thursday, September 22, 2005 5:35 PM
>> Subject: installing/running gvim on USB key (Windows)
>>
>>
>> >I read a recent article on the "Ultimate USB Key" which talks about
>> >carrying applications on the larger flash drives to serve as
>> a personal
>> >portable office.  You can get portable versions of most
>> stuff you need to
>> >handle e-mail, browsing, and office applications like
>> spreadsheets, etc.
>> >
>> > Has any tried installing and running gvim/vim on a
>> removable USB key for
>> > portable use on Windows PCs?  What works?  What doesn't work?
>> >
>> > Thanks,
>> >
>> > Steve
>>
>> I think it may work for single-user use, if you leave $VIM
>> and $VIMRUNTIME
>> both unset in your environment and use the default directory names
>> (...something.../vim/vim63/ or ...something.../vim/vim70aa/).
>> Vim will then
>> set these environment variables internally on the basis of
>> the directory
>> from which its executable was loaded and of its version number.
>>
>> Place your _vimrc (and your _gvimrc, if any) in $VIM, and if
>> you have any
>> user scripts, place them at the proper place in $VIM/vimfiles or its
>> subdirectories.
>>
>> If you want to call Vim without a full path, you may have to
>> include the
>> directory where its executable(s) reside into your PATH, or
>> else to have a
>> batch file do the proper redirection, similar to the following
>>
>> @"Q:\Program Files\vim\vim63\%0 %1 %2 %3 %4 %5 %6 %7 %8 %9
>>
>> Place one copy of the above one-line file in some directory
>> in your PATH
>> (with the proper full path filled-in) for each Vim executable
>> you have,
>> e.g., vim.bat to call vim.exe, gvim.bat to call gvim.exe etc.
>> Invoke them as
>> vim gvim etc. with no extension.
>>
>> Best regards,
>> Tony.
>>
>>
>>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: installing/running gvim on USB key (Windows)

A. S. Budden
In reply to this post by Stephen M. Brooks
On 22/09/05, Stephen M. Brooks <[hidden email]> wrote:
> I read a recent article on the "Ultimate USB Key" which talks about
> carrying applications on the larger flash drives to serve as a personal
> portable office.  You can get portable versions of most stuff you need
> to handle e-mail, browsing, and office applications like spreadsheets, etc.
>
> Has any tried installing and running gvim/vim on a removable USB key for
> portable use on Windows PCs?  What works?  What doesn't work?

I have a USB key with GVim on it (along with various other things like
firefox, putty, a PDF reader, the "unixutils" suite, perl...), it
works absolutely fine for me.

All I did to get it going was install gvim 6.3 onto my computer and
copy the vim directory (with the vim63 subdirectory) across onto the
USB key.  I then took my ~/.vim and put it in the \vim directory named
as vimfiles and copied my .vimrc into the same place as _vimrc.  When
I log onto a machine, I simply have to open Windows Explorer and
right-drag gvim.exe onto the desktop and click "Create Shortcut
Here"... no other configuration needed (although to be honest my
.vimrc was already fairly carefully "tuned" to work with Linux and
Windows).

Hope that helps a bit, happy to send you a copy of the vim directory
if it helps.

Al
Reply | Threaded
Open this post in threaded view
|

RE: installing/running gvim on USB key (Windows)

Halim, Salman
In reply to this post by Stephen M. Brooks
Good point.  However, this script is what I have on my machine, and I
don't use vim70aa, but rather vim70 (the script works as is on my
system).  I figured that would be one less thing to worry about once we
got a release of Gvim 7 :)

Salman.

> -----Original Message-----
> From: Tony Mechelynck [mailto:[hidden email]]
> Sent: Thursday, September 22, 2005 8:01 PM
> To: Halim, Salman; Stephen M. Brooks; [hidden email]
> Subject: Re: installing/running gvim on USB key (Windows)
>
> For 7.0, the version-dependent directory should be "vim70aa"
> not "vim70"; so the 3rd non-blank line should be "set
> VIMVERSION=70aa".
>
> Best regards,
> Tony.
> ----- Original Message -----
> From: "Halim, Salman" <[hidden email]>
> To: "Tony Mechelynck" <[hidden email]>;
> "Stephen M. Brooks"
> <[hidden email]>; <[hidden email]>
> Sent: Thursday, September 22, 2005 6:34 PM
> Subject: RE: installing/running gvim on USB key (Windows)
>
>
> > I'm on a Windows environment, and have Gvim installed on my
> USB drive.
> > I use this batch file to set up the environment:
> >
> > -- Begin --
> > @echo off
> > setlocal ENABLEEXTENSIONS
> >
> > set VIMVERSION=70
> >
> > if "%1"=="63" set VIMVERSION=63
> >
> > set VIM=%~dp0
> > set VIMVERSIONDIRECTORY=%VIM%vim%VIMVERSION%
> > set VIMRUNTIME=%VIMVERSIONDIRECTORY%
> >
> > if "%1"=="63" set VIMRUNTIME=%VIMRUNTIME%\runtime
> >
> > set PATH=%VIMVERSIONDIRECTORY%;%PATH%
> >
> > if "%1"=="63" shift
> >
> > rem To start with correct parameters and skip the first, %*
> > rem doesn't work -- need to stick with %1 %2 etc.
> > start gvim.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
> >
> > endlocal
> > -- End --
> >
> > There are few quirks:
> >
> > - You may pass in 63 as the first parameter if you're
> running Gvim 6.3
> > -- I'm not, but I haven't got around to updating this batch file.
> > - When I ran 6.3, I had a directory called runtime under my main Vim
> > directory -- I don't in Vim 7.
> > - On Windows XP (which is what I use, though I'm sure this
> will work on
> > 2000 also), 'shift' shifts the arguments, but %* still returns the
> > original set, forcing the %1 %2 %3 %4 bit at the bottom.
> >
> > The key thing is the %~dp0, which basically sets $VIM to
> the path of the
> > batch file.  So, if the batch file resides in c:\vim, $VIM becomes
> > c:\vim...  (That's what the ENABLEEXTENSIONS does.)
> >
> > Hope this helps,
> >
> > Salman.
> >
> >> -----Original Message-----
> >> From: Tony Mechelynck [mailto:[hidden email]]
> >> Sent: Thursday, September 22, 2005 12:05 PM
> >> To: Stephen M. Brooks; [hidden email]
> >> Subject: Re: installing/running gvim on USB key (Windows)
> >>
> >> ----- Original Message -----
> >> From: "Stephen M. Brooks" <[hidden email]>
> >> To: <[hidden email]>
> >> Sent: Thursday, September 22, 2005 5:35 PM
> >> Subject: installing/running gvim on USB key (Windows)
> >>
> >>
> >> >I read a recent article on the "Ultimate USB Key" which
> talks about
> >> >carrying applications on the larger flash drives to serve as
> >> a personal
> >> >portable office.  You can get portable versions of most
> >> stuff you need to
> >> >handle e-mail, browsing, and office applications like
> >> spreadsheets, etc.
> >> >
> >> > Has any tried installing and running gvim/vim on a
> >> removable USB key for
> >> > portable use on Windows PCs?  What works?  What doesn't work?
> >> >
> >> > Thanks,
> >> >
> >> > Steve
> >>
> >> I think it may work for single-user use, if you leave $VIM
> >> and $VIMRUNTIME
> >> both unset in your environment and use the default directory names
> >> (...something.../vim/vim63/ or ...something.../vim/vim70aa/).
> >> Vim will then
> >> set these environment variables internally on the basis of
> >> the directory
> >> from which its executable was loaded and of its version number.
> >>
> >> Place your _vimrc (and your _gvimrc, if any) in $VIM, and if
> >> you have any
> >> user scripts, place them at the proper place in
> $VIM/vimfiles or its
> >> subdirectories.
> >>
> >> If you want to call Vim without a full path, you may have to
> >> include the
> >> directory where its executable(s) reside into your PATH, or
> >> else to have a
> >> batch file do the proper redirection, similar to the following
> >>
> >> @"Q:\Program Files\vim\vim63\%0 %1 %2 %3 %4 %5 %6 %7 %8 %9
> >>
> >> Place one copy of the above one-line file in some directory
> >> in your PATH
> >> (with the proper full path filled-in) for each Vim executable
> >> you have,
> >> e.g., vim.bat to call vim.exe, gvim.bat to call gvim.exe etc.
> >> Invoke them as
> >> vim gvim etc. with no extension.
> >>
> >> Best regards,
> >> Tony.
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: installing/running gvim on USB key (Windows)

David Fishburn
In reply to this post by Stephen M. Brooks
 

> -----Original Message-----
> From: Stephen M. Brooks [mailto:[hidden email]]
> Sent: Thursday, September 22, 2005 11:35 AM
> To: [hidden email]
> Subject: installing/running gvim on USB key (Windows)
>
> I read a recent article on the "Ultimate USB Key" which talks
> about carrying applications on the larger flash drives to
> serve as a personal portable office.  You can get portable
> versions of most stuff you need to handle e-mail, browsing,
> and office applications like spreadsheets, etc.
>
> Has any tried installing and running gvim/vim on a removable
> USB key for portable use on Windows PCs?  What works?  What
> doesn't work?


I just realized I posted my answer on the wrong thread.
I copy my Vim customizations (plugins, vimrc, ftplugins, ...) between Linux,
WinXP, and my USB key.
I copy my entire c:\vim directory to the USB key.


I also have a c:\vim\Tools directory, where I put various utilities that my
Vim uses regularily (ctags.exe, grep.exe, wget.exe, ...).

In that directory I have a batch file, setupVim.bat which does the
following:

*************
@echo off

@rem You can have Windows automatically run a batch file when you open @rem
a new command prompt by:
@rem HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun @rem
and set it to run a BAT script of your choice when it @rem starts up.
@rem
@rem I don't like this option and prefer to setup a shortcut to run:
@rem     %SYSTEMROOT%\system32\cmd.exe /F:ON /K c:\vim\tools\setupVim.bat
@rem The /F:ON enables file/directory completion using CTRL-F.  This @rem is
useful if you do not have any rights on the machine to modify:
@rem     HKEY_LOCAL_MACHINE\Software\Microsoft\Command
Processor\CompletionChar
@rem and set it to hex 9 (TAB)

@rem Determine which drive letter we are executing this from:
@rem % 0 = the cmdline used to launch the cmd file.
@rem for /f %%i in ('echo %0') do @echo curr_dir=%%~di @rem From HELP FOR
(when typed from a cmd.exe prompt) @rem You can now use the following
optional syntax:
@rem     % ~I         - expands %I removing any surrounding quotes (")
@rem     % ~fI        - expands %I to a fully qualified path name
@rem     % ~dI        - expands %I to a drive letter only
@rem
@for /f %%i in ("%0") do @SET cmd_driveletter=%%~di @SET
driveletter=%cmd_driveletter

@echo.
@echo Executing %0 from this drive: %cmd_driveletter% @echo.

@IF %1. NEQ . SET driveletter=%1:
@IF NOT EXIST %driveletter%\ SET driveletter=%cmd_driveletter%

:SETPATH
@echo.
@echo. Check if Vim is already in the PATH @echo.
@echo on
@for %%P in (%PATH%) do @IF EXIST %%P\gvim.exe GOTO ALLREADYINPATH @echo off
@echo.
@echo.Not already in PATH, adding it
@echo.
@goto ADDTOPATH


:ADDTOPATH
@echo.
@echo. Setup path to include $VIM and other standard utilities @echo.
@SET
PATH=%driveletter%\vim\tools;%driveletter%\Vim\Vim63;%driveletter%\util;%dri
veletter%\util\unix_tools;%PATH%
@goto USEDOSKEY

:ALLREADYINPATH
@echo.
@echo. Vim is already in the PATH
@echo.
*************


So I create an icon on the desktop machine that does this:
%SYSTEMROOT%\system32\cmd.exe /F:ON /K f:\vim\tools\setupVim.bat

Assuming f: is the drive the USB key gets mapped as every time.

At the same time, I also install DOSKEY and define all my usual
mappings/aliases that I use on my regular system that uses a 4NT prompt.

So when I am at a different machine, it almost feels like usual.

It is that easy, just run the setupVim.bat file.

HTH,
Dave


Reply | Threaded
Open this post in threaded view
|

Re: installing/running gvim on USB key (Windows)

A.J.Mechelynck
In reply to this post by Halim, Salman

----- Original Message -----
From: "Halim, Salman" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; "Stephen M. Brooks"
<[hidden email]>; <[hidden email]>
Sent: Friday, September 23, 2005 3:24 PM
Subject: RE: installing/running gvim on USB key (Windows)


> Good point.  However, this script is what I have on my machine, and I
> don't use vim70aa, but rather vim70 (the script works as is on my
> system).  I figured that would be one less thing to worry about once we
> got a release of Gvim 7 :)
>
> Salman.
>
[...]

That's dangerous: the only currently extant version of Vim 7 is 7.0aa, and
when determining $VIMRUNTIME from $VIM (or, on Windows, both of them from
the executable directory) it assumes that its "version subdirectory" is
named vim70aa and nothing else. If you use something else, you will have
more "setup hassle" and much more difficulty running 6.3 and 7.0
side-by-side on the same machine.

Since each distribution is supposed to be complete in itself, and we aren't
supposed to add anything to $VIMRUNTIME or under it, when the "stable" Vim
7.0 comes around the fact that it installs in a differently-named
subdirectory won't be a problem: it will install in $VIM/vim70; the "alpha"
version in $VIM/vim70aa (or maybe, by that time, $VIM/vim70bq or whatever)
can be discarded as soon as the "stable" Vim 7.0 is seen to work properly;
and "user files" (in and under $HOME) and "system-wide scripts" (in and
under $VIM/vimfiles) will still be used without change, since their location
is version-independent.

Best regards,
Tony.