On Thursday, July 23, 2015 at 2:11:05 PM UTC-4, Roland Eggner wrote:
> Hi Bram
...
> v4:
> Further improvements based on imput from Pavol Juhas (mail thread “Issue 385 
> in 
> vim: expansion of environment variables fails in Vim backtick expression”).
> 
> For easier review 6 lines of context instead of the usual 3.
...

diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt

...

+If the expression contains an unquoted environment variable reference without 
+call to |expand()|, the value of this variable -- not only its name -- is 
+evaluated as a Vim expression (3rd and 4th example below).  Single or double 
+quotes can be used to avoid this effect (5th and 6th example below).  See also 
+|expr-env-expand|.
+Some examples illustrate possible usages:
+       :edit ``=tempname()``
+       :edit `=expand('$HOME') . '/.vimrc'`
+       :let home = 2
+       :let user = 3                  " assuming $HOME == '/home/user'
+       :edit `=36 $HOME . '/.vimrc'`  " creates a buffer '6/.vimrc'
+       :edit `=$Hquoted . '/.vimrc'`  " assuming $Hquoted == '"/home/user"'


Hi Roland,

I don't think this is a good solution.  It would be much better to
fix the buggy behavior of environment variables inside the `={expr}`
expressions rather than declaring it a feature -- and having to
describe all the unexpected side effects 
[can anyone possibly expect that  `=36 $HOME`  expands to 6?]
and convoluted quotations that mask up the bug.

If there was a similar problem for the command

    :let v = $HOME . '/.vimrc'

should it be handled by updating the :let documents?


On another page, I propose that an invalid expression in

    :e `=invalid expression`

should raise "E79: Cannot expand wildcards" without opening any new buffer.
This would be consistent with the handling of errors in regular backticks,
such as

    :e `/not/a/command`

I am very busy these days, but hopefully in few weeks I can put
some time into fixing the `= expansion.

Best regards,

Pavol

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui