On Fri, Jun 12, 2020 at 1:36 PM Bram Moolenaar <[email protected]> wrote: > Peter Whittaker wrote: > > > vimrntm=$(vim --not-a-term -T dumb --cmd 'echo $VIMRUNTIME' --cmd quit | \ > > tr -d '\n\r' |sed -E 's,[^/]+,,') > > > > What I'd really like is "vimrntm=$(vim --get-vimruntime)" > > I think you already found a way that works: > vi --not-a-term -c 'echo $VIMRUNTIME' -c q > > Why would a command line argument be needed that would do the same > thing?
It's not exactly doing the same thing: The existing capability requires post-processing to remove extraneous characters, which isn't surprising, since those characters aren't extraneous for vim's default behaviour, which is managing a graphical display. Based on a 10+ year old example I found online, I hacked together a double pipeline of tr and sed to remove those characters, but that's definitely ugly, and it also feels fragile: I'm hardcoding in knowledge of what those characters are; it works everywhere I need it to right now, but it feels iffy. So the difference is that --get-default-runtime would just spit out exactly that, no screen driving characters; this would be directly assignable without further filtering. There should be difference between what is displayed on the screen or what is written to a file; right now, with the "echo" method, there is. My first, simplest thought was to add an appropriate function to version.c, since version.c already has code to do this it's done as part of list_version(): list_version() doesn't add the extraneous format controls (unless it is called as a vim function, e.g., as ":version", not on the command line). It occurs to me we do define a vim function for this as well. I started pulling together the list of files that should be changed, e.g., code, documentation, for both cases. If we decide this is worthwhile, I'll create a github issue and add the design thoughts and file list therein, and then bash away at it a while. Thoughts? P Peter Whittaker EdgeKeep Inc. www.edgekeep.com -- -- 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/CAGeouKGSn%3DFXo%2BLTYEbQoeGqNKQ%3D49H83bFcxuw0Gts1DRcS5Q%40mail.gmail.com.
