Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to append a folder to the PATH environment variable in vimrc?

Tags:

vim

I'm running portable python and portable gvim. When I run gVimPortable, I want it to append python to the PATH environment variable. This is the command I would run in a command prompt:

path=%path%;C:\portable\PortablePython_1.1_py2.5.4

Is there a way to automate this in the vimrc file or some other way?

like image 524
Jim Avatar asked May 07 '10 16:05

Jim


1 Answers

You can change environment variables inside Vim using the :let command.

let s:portablepy = 'C:\portable\PortablePython_1.1_py2.5.4'
" Add PortablePython's path to $PATH if running on Windows and PortablePython exists
if (has('win32') || has('win64')) && isdirectory(s:portablepy)
    let $PATH .= ';' . s:portablepy
endif
like image 151
jamessan Avatar answered Sep 22 '22 12:09

jamessan