Wikia

Vim Tips Wiki

Changes: Environment variables

Edit

Back to page

 
Line 33: Line 33:
 
Append to the Existing Path.
 
Append to the Existing Path.
 
<pre>
 
<pre>
:let $PATH .= '/foo:/bar'
+
:let $PATH .= ':/foo:/bar'
 
</pre>
 
</pre>
   

Latest revision as of 13:40, July 14, 2013

Tip 1589 Printable Monobook Previous Next

created 2008 · complexity basic · author Metacosm · version 7.0


Vim can read and write environment variables within your current shell session. Use a $ prefix to identify an environment variable, as in the following examples.

Display the contents of the PATH environment variable:

:echo $PATH

Assign the PATH environment variable to a Vim variable:

:let myvar = $PATH

Change the PATH environment variable for the current session:

:let $PATH = '/foo:/bar'

Insert the contents of the PATH environment variable into the buffer:
Press i to enter insert mode, press Ctrl-r then =$PATH and press Enter.

Append to the Existing Path.

:let $PATH .= ':/foo:/bar'

ReferencesEdit

CommentsEdit

Around Wikia's network

Random Wiki