int heredoc;
char_u *swp;
- if (*eap->cmd == '&')
+ if (*eap->cmd == '&' || (eap->cmd[0] == '@'
+ && (valid_yank_reg(eap->cmd[1], FALSE)
+ || eap->cmd[1] == '@')))
{
- p = to_name_end(eap->cmd + 1, FALSE);
+ if (*eap->cmd == '&')
+ {
+ p = eap->cmd + 1;
+ if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
+ p += 2;
+ p = to_name_end(p, FALSE);
+ }
+ else
+ p = eap->cmd + 2;
if (ends_excmd(*skipwhite(p)))
{
- // "&option <NL>" is the start of an expression.
+ // "&option <NL>" and "@r <NL>" is the start of an
+ // expression.
eap->cmdidx = CMD_eval;
return eap->cmd;
}
// "&opt = expr"
// "var = expr" where "var" is a variable name or we are skipping
// (variable declaration might have been skipped).
- if (*eap->cmd == '@')
- p = eap->cmd + 2;
- else if (*eap->cmd == '&')
- p = skiptowhite_esc(eap->cmd + 1);
oplen = assignment_len(skipwhite(p), &heredoc);
if (oplen > 0)
{
CheckDefAndScriptSuccess(lines)
enddef
+def Test_register_use_linebreak()
+ var lines =<< trim END
+ new
+ @a = 'one'
+ @a->setline(1)
+ @b = 'two'
+ @b ->setline(2)
+ @c = 'three'
+ @c
+ ->setline(3)
+ assert_equal(['one', 'two', 'three'], getline(1, '$'))
+ bwipe!
+ END
+ CheckDefAndScriptSuccess(lines)
+enddef
+
def Test_skipped_expr_linebreak()
if 0
var x = []