Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is $VIM and where do I find it?

Tags:

vim

Likewise, how do I find $VIMRUNTIME?

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

like image 733
itsmarziparzi Avatar asked Oct 26 '25 10:10

itsmarziparzi


2 Answers

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'
like image 120
sudo bangbang Avatar answered Oct 29 '25 08:10

sudo bangbang


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.

like image 45
ronakg Avatar answered Oct 29 '25 07:10

ronakg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!