Wikia

Vim Tips Wiki

Changes: Environment variables

Edit

Back to page

(Assign tip id + convert to TipNew template + minor clean)
(Change <tt> to <code>, perhaps also minor tweak.)
Line 3: Line 3:
 
|previous=1588
 
|previous=1588
 
|next=1590
 
|next=1590
|created=February 16, 2008
+
|created=2008
 
|complexity=basic
 
|complexity=basic
 
|author=Metacosm
 
|author=Metacosm
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
Vim can read and write environment variables within your current shell session. Use a <tt>$</tt> prefix to identify an environment variable, as in the following examples.
+
Vim can read and write environment variables within your current shell session. Use a <code>$</code> prefix to identify an environment variable, as in the following examples.
   
 
Display the contents of the PATH environment variable:
 
Display the contents of the PATH environment variable:
Line 29: Line 29:
   
 
Insert the contents of the PATH environment variable into the buffer:<br>
 
Insert the contents of the PATH environment variable into the buffer:<br>
Press <tt>i</tt> to enter insert mode, press Ctrl-r then <tt>=$PATH</tt> and press Enter.
+
Press <code>i</code> to enter insert mode, press Ctrl-r then <code>=$PATH</code> and press Enter.
   
 
==References==
 
==References==

Revision as of 06:36, July 13, 2012

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.

References

Comments

Around Wikia's network

Random Wiki