Peter Whittaker wrote:

> Folks, posting here to gauge interest before adding an issue on
> GitHub: What interest is there in adding a command line option that
> causes vim to return the current value of VIMRUNTIME?
> 
> The use case is to find macros, etc., dynamically, e.g., in one's
> .bashrc, et al, with minimum hardcoding. Example: I have the following
> lines in one of my BASH dotfiles (lines broken and \ added for
> readability):
> 
> # if available, use a better less  - warning, this is gross but unavoidable
> vimrntm=$(vim --not-a-term -T dumb --cmd 'echo $VIMRUNTIME' --cmd quit | \
> tr -d '\n\r' |sed -E 's,[^/]+,,')
> vimless=${vimrntm}/macros/less.sh
> [[ -x ${vimless} ]] && alias less=${vimless} || { \
>     echo; echo You may want to find less.sh manually, using pure less
> for now.; \
>     echo; }
> 
> What I'd really like is "vimrntm=$(vim --get-vimruntime)", which would
> simply print out an appropriately terminated string containing the
> value, e.g., /usr/share/vim/vim81.
> 
> Note that I don't set VIMRUNTIME anywhere, I am simply trying to
> retrieve it in the most efficient way. On the various platforms I work
> on, it may be /usr/share/vim/vim74, ...81, ...82, etc., or absent.
> 
> Thoughts?

I think you already found a way that works:
        vi --not-a-term -c 'echo $VIMRUNTIME' -c q

Perhaps add "-e" to make it a little faster.

Why would a command line argument be needed that would do the same
thing?

-- 
GUARD #2:  Wait a minute -- supposing two swallows carried it together?
GUARD #1:  No, they'd have to have it on a line.
GUARD #2:  Well, simple!  They'd just use a standard creeper!
GUARD #1:  What, held under the dorsal guiding feathers?
GUARD #2:  Well, why not?
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202006121736.05CHaSKc372397%40masaka.moolenaar.net.

Raspunde prin e-mail lui