itsmarziparzi
itsmarziparzi

Reputation: 729

What is $VIM and where do I find it?

Likewise, how do I find $VIMRUNTIME?

I installed vim using yum install vim-X11 vim-common vim-enhanced vim-minimal on CentOS 6.3

Upvotes: 4

Views: 1615

Answers (3)

sudo bangbang
sudo bangbang

Reputation: 28229

To find $VIM and $VIMRUNTIME, you can run

:echo $VIM
:echo $VIMRUNTIME

and to answer what is $VIM, you can run

:h $VIM

The environment variable "$VIM" is used to locate various user files for Vim, such as the user startup script ".vimrc". This depends on the system, see startup.

Inorder to set these environment variables, use

:let $VIM = "/path/to/directory"
:let $VIMRUNTIME = "/path/to/directory"

You can also find $VIM and $VIMRUNTIME from console or if you want it in a shell script

vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|echo $VIMRUNTIME|quit' | tr -d '\015'
vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|echo $VIM|quit' | tr -d '\015'

Upvotes: 5

Keith
Keith

Reputation: 43054

Those are built into vim. Try this in vim:

:echo $VIM
:echo $VIMRUNTIME

Upvotes: 1

ronakg
ronakg

Reputation: 4212

These are the environment variables set by vim when you are inside vim and spawn a shell from within vim. You won't find them set in any other case.

For example, if you run :!bash from vim, then the spawned shell will have both these environment variables set.

You should run :help $VIM to know more about both of them.

Upvotes: 2

Related Questions