susam/vimer

allow for portable installation of gVim

Closed this issue · 0 comments

If gvim is run as a protable application, say installed by scoop, for users without admin rights to access the HKCM branch of the registry, then the vim executable cannot be found. How about a check using where such as

IF DEFINED EDITOR (
  IF EXIST "%EDITOR%" (
    SET E=%EDITOR%
  ) ELSE (
    where /q %EDITOR%
    IF NOT ERRORLEVEL 1 (
      SET E=%EDITOR%
    )
  )
)
IF NOT DEFINED E (
  where /q vim
  IF ERRORLEVEL 1 (
    SET E=start /b notepad
  ) ELSE (
    SET E=vim
  )
)

to look for it in the (user's) %PATH%?