Vim Tips Wiki
Register
Advertisement

Previous TipNext Tip

Tip: #745 - Find VIMRUNTIME in a bash script

Created: June 15, 2004 19:05 Complexity: advanced Author: Steve Hall Version: 6.0 Karma: 13/4 Imported from: Tip#745

I recently needed the value of $VIMRUNTIME in a bash shell script and was forwarded these two terrific solutions I wanted to post publically:

1. by Luc St-Louis

 vim --cmd 'echo $VIMRUNTIME' --cmd 'quit' 2> /tmp/VIMRUNTIME.txt 
 VIMRUNTIME=`perl -pe 's/\r\n//g' /tmp/VIMRUNTIME.txt` 
 rm -f /tmp/VIMRUNTIME.txt 

2. by Jacob Lerner

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


Both properly capture Vim's output and handle the trailing line feed, although in remarkable different ways. Feel free to post additional solutions below.

Comments

what use is the variable? when you have vim?

motim , June 15, 2004 19:13


Advertisement