Saturday, May 5, 2012

Getting the value of runtimepath from the command line

I'm writing a script to generate my own version of the vim docs and I'm trying to find a better way of getting the information I need.

The variable 'runtimepath' contains the paths of all the directories that will be searched for doc and tags files. So, I want to check each of these directories.

If I run the following command I get the default or base set of directories.

$ vim --cmd 'echo &rtp' --cmd 'q' /dev/null
/home/harleypig/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/harleypig/.vim/after

But that's incomplete. The '--cmd' is run *before* any configuration files are parsed and handled. However, if I run the same command with the '-c' switch, which is run *after* configuration files are handled, I get all the correct directories--I also get a bunch of ANSI escape sequences. I have to dump it in a file to see it, the codes clear the screen.

$ vim -c 'echo &rtp' -c 'q' /dev/null > t
Vim: Warning: Output is not to a terminal

I've tried filtering it through 'col' and 'col -b' but that just strips the ESC codes, leaving a jumbled mess.

I'm using perl's Regexp::Common::ANSIescape to strip out the escape codes, and it seems to be reliable so far. But it would be better if there weren't any ansi codes in the first place.

So. Is there a way to get the value from vim without the ansi codes?

--
You received this message from the "vim_use" 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

No comments: