aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/ops.c23
-rw-r--r--src/nvim/version.c2
4 files changed, 26 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 762cd3efd3..f498fca6ad 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -920,7 +920,7 @@ do_buffer (
if (start == DOBUF_FIRST) {
/* don't warn when deleting */
if (!unload)
- EMSGN(_("E86: Buffer %" PRId64 " does not exist"), count);
+ EMSGN(_(e_nobufnr), count);
} else if (dir == FORWARD)
EMSG(_("E87: Cannot go beyond last buffer"));
else
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 52eebebf41..d68e952693 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -2,6 +2,7 @@
#define NVIM_GLOBALS_H
#include <stdbool.h>
+#include <inttypes.h>
// EXTERN is only defined in main.c. That's where global variables are
// actually defined and initialized.
@@ -1239,6 +1240,7 @@ EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s"));
EXTERN char_u e_maxmempat[] INIT(= N_(
"E363: pattern uses more memory than 'maxmempattern'"));
EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer"));
+EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
EXTERN char_u e_invalpat[] INIT(= N_(
"E682: Invalid search pattern or delimiter"));
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 52b4fed9d7..159b4c03e7 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -705,8 +705,9 @@ bool valid_yank_reg(int regname, bool writing)
{
if ( (regname > 0 && ASCII_ISALNUM(regname))
|| (!writing && vim_strchr((char_u *)
- "/.%#:="
+ "/.%:="
, regname) != NULL)
+ || regname == '#'
|| regname == '"'
|| regname == '-'
|| regname == '_'
@@ -4658,6 +4659,26 @@ void write_reg_contents_ex(int name,
return;
}
+ if (name == '#') {
+ buf_T *buf;
+
+ if (ascii_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;
+ }
+
if (name == '=') {
size_t offset = 0;
size_t totlen = (size_t) len;
diff --git a/src/nvim/version.c b/src/nvim/version.c
index b097ac4702..93222ae143 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -388,7 +388,7 @@ static int included_patches[] = {
608,
// 607,
606,
- // 605,
+ 605,
604,
// 603,
602,