summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/ops.c b/src/ops.c
index 6df1121a5..a4261cb56 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -856,11 +856,12 @@ valid_yank_reg(regname, writing)
if ( (regname > 0 && ASCII_ISALNUM(regname))
|| (!writing && vim_strchr((char_u *)
#ifdef FEAT_EVAL
- "/.%#:="
+ "/.%:="
#else
- "/.%#:"
+ "/.%:"
#endif
, regname) != NULL)
+ || regname == '#'
|| regname == '"'
|| regname == '-'
|| regname == '_'
@@ -6514,6 +6515,27 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
return;
}
+ if (name == '#')
+ {
+ buf_T *buf;
+
+ if (VIM_ISDIGIT(*str))
+ {
+ int num = atoi((char *)str);
+
+ buf = buflist_findnr(num);
+ if (buf == NULL)
+ EMSGN(_(e_nobufnr), (long)num);
+ }
+ else
+ buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str),
+ TRUE, FALSE, FALSE));
+ if (buf == NULL)
+ return;
+ curwin->w_alt_fnum = buf->b_fnum;
+ return;
+ }
+
#ifdef FEAT_EVAL
if (name == '=')
{