Friday, January 1, 2010

Re: How to find the location of the vim executable?

On 01/12/09 20:33, Sean wrote:
> Hi,
>
> Is it possible to detect the vim executable on which I am running?
>
> The purpose is to drop wget.exe to the same directory as gvim.exe
> and vimrun.exe under Windows. With three executables, I can make
> a simplest "plug and play" CLOUD input method, VimIM, on Windows.
>
> As of now, I ask users to drop wget.exe to the plugin directory, and
> I can detect it by using something like =>
> s:path=expand("<sfile>:p:h")."/"
>
> Thanks
>
> Sean
>
>
>

IIUC, Vim can find executables and shared libraries found:
- on Windows, in the $VIMRUNTIME directory (I think). On Windows, this
directory usually contains the vim executable(s); Vim-related utilities
are placed either in the same directory or in some of its
sub-directories (e.g. $VIMRUNTIME/xxd/xxd.exe).
- on any platform (including Windows), programs can also be found
anywhere in the $PATH (of this I am sure).

On Windows, this may depend on how Vim was installed, but often it is
something like "C:\Program Files\vim\vim72" where "Program Files" may be
different in non-English-language versions of Windows, and "vim72" is
for the current release 7.2 (stable).

On Unix-like platforms (including Cygwin), the vim executable(s) will
usually be in the $PATH; by default in /usr/local/bin if you compile
them yourself, but often in /usr/bin and/or /bin and/or /usr/X11R6/bin
etc. if installed as part of a software distribution. However any
executable anywhere in the $PATH will be found so the exact location of
the wget executable (often /usr/bin) doesn't much matter in this case.

On any platform, trying to execute a program will return a nonzero
status code (ERRORLEVEL in Dos/Windows batch language) if the program
isn't found (typically 127 or maybe 255). This return code can be
examined as the variable v:shell_error, so you can try invoking :!wget
then look at he value of v:shell_error.


Best regards,
Tony.
--
"We had it tough ... I had to get up at 9 o'clock at night, half an
hour before I went to bed, eat a lump of dry poison, work 29 hours down
mill, and when we came home our Dad would kill us, and dance about on
our grave singing Haleleuia ..."
-- Monty Python

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment