{
char_u *pskip = skip_option_env_lead(eap->cmd);
- if (vim_strchr((char_u *)"{('[\"@&", *p) != NULL
+ if (vim_strchr((char_u *)"{('[\"@&$", *p) != NULL
|| ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL))
{
int oplen;
int heredoc;
char_u *swp;
- if (*eap->cmd == '&' || (eap->cmd[0] == '@'
+ if (*eap->cmd == '&'
+ || *eap->cmd == '$'
+ || (eap->cmd[0] == '@'
&& (valid_yank_reg(eap->cmd[1], FALSE)
|| eap->cmd[1] == '@')))
{
p += 2;
p = to_name_end(p, FALSE);
}
+ else if (*eap->cmd == '$')
+ p = to_name_end(eap->cmd + 1, FALSE);
else
p = eap->cmd + 2;
if (ends_excmd(*skipwhite(p)))
{
- // "&option <NL>" and "@r <NL>" is the start of an
- // expression.
+ // "&option <NL>", "$ENV <NL>" and "@r <NL>" are the start
+ // of an expression.
eap->cmdidx = CMD_eval;
return eap->cmd;
}
CheckDefAndScriptSuccess(lines)
enddef
+def Test_environment_use_linebreak()
+ var lines =<< trim END
+ new
+ $TESTENV = 'one'
+ $TESTENV->setline(1)
+ $TESTENV = 'two'
+ $TESTENV ->setline(2)
+ $TESTENV = 'three'
+ $TESTENV
+ ->setline(3)
+ assert_equal(['one', 'two', 'three'], getline(1, '$'))
+ bwipe!
+ END
+ CheckDefAndScriptSuccess(lines)
+enddef
+
def Test_skipped_expr_linebreak()
if 0
var x = []
* COMMAND after range
* 'text'->func() should not be confused with 'a mark
* "++nr" and "--nr" are eval commands
+ * in "$ENV->func()" the "$" is not a range
*/
cmd = ea.cmd;
if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)
+ && (*cmd != '$' || starts_with_colon)
&& (starts_with_colon || !(*cmd == '\''
|| (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))))
{