summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2015-01-27 18:44:16 +0100
committerBram Moolenaar <bram@vim.org>2015-01-27 18:44:16 +0100
commitf9d449193f3a7363d33eb028cd00390438136559 (patch)
tree4ad5f589201005b625e2ce380c17cfb0830b3b3c
parent01bfa579fc865ef14a52fb5ed2f4462064684b78 (diff)
downloadvim-f9d449193f3a7363d33eb028cd00390438136559.tar.gz
updated for version 7.4.605v7.4.605v7-4-605
Problem: The # register is not writable, it cannot be restored after jumping around. Solution: Make the # register writable. (Marcin Szamotulski)
-rw-r--r--runtime/doc/change.txt42
-rw-r--r--src/buffer.c2
-rw-r--r--src/globals.h1
-rw-r--r--src/ops.c26
-rw-r--r--src/version.c2
5 files changed, 56 insertions, 17 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index de340ec8..4fc79128 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1,4 +1,4 @@
-*change.txt* For Vim version 7.4. Last change: 2014 Jun 26
+*change.txt* For Vim version 7.4. Last change: 2015 Jan 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1103,11 +1103,12 @@ There are nine types of registers: *registers* *E354*
2. 10 numbered registers "0 to "9
3. The small delete register "-
4. 26 named registers "a to "z or "A to "Z
-5. four read-only registers ":, "., "% and "#
-6. the expression register "=
-7. The selection and drop registers "*, "+ and "~
-8. The black hole register "_
-9. Last search pattern register "/
+5. three read-only registers ":, "., "%
+7. alternate buffer register "#
+7. the expression register "=
+8. The selection and drop registers "*, "+ and "~
+9. The black hole register "_
+10. Last search pattern register "/
1. Unnamed register "" *quote_quote* *quotequote*
Vim fills this register with text deleted with the "d", "c", "s", "x" commands
@@ -1153,7 +1154,7 @@ letters to replace their previous contents or as uppercase letters to append
to their previous contents. When the '>' flag is present in 'cpoptions' then
a line break is inserted before the appended text.
-5. Read-only registers ":, "., "% and "#
+5. Read-only registers ":, ". and "%
These are '%', '#', ':' and '.'. You can use them only with the "p", "P",
and ":put" commands and with CTRL-R. {not in Vi}
*quote_.* *quote.* *E29*
@@ -1164,8 +1165,6 @@ and ":put" commands and with CTRL-R. {not in Vi}
('textwidth' and other options affect what is inserted).
*quote_%* *quote%*
"% Contains the name of the current file.
- *quote_#* *quote#*
- "# Contains the name of the alternate file.
*quote_:* *quote:* *E30*
": Contains the most recent executed command-line. Example: Use
"@:" to repeat the previous command-line command.
@@ -1174,8 +1173,23 @@ and ":put" commands and with CTRL-R. {not in Vi}
the command was completely from a mapping.
{not available when compiled without the |+cmdline_hist|
feature}
-
-6. Expression register "= *quote_=* *quote=* *@=*
+ *quote_#* *quote#*
+6. Alternate file register "#
+Contains the name of the alternate file for the current window. It will
+change how the |CTRL-^| command works.
+This register is writable, mainly to allow for restoring it after a plugin has
+changed it. It accepts buffer number: >
+ let altbuf = bufnr(@#)
+ ...
+ let @# = altbuf
+It will give error |E86| if you pass buffer number and this buffer does not
+exist.
+It can also accept a match with an existing buffer name: >
+ let @# = 'buffer_name'
+Error |E93| if there is more than one buffer matching the given name or |E94|
+if none of buffers matches the given name.
+
+7. Expression register "= *quote_=* *quote=* *@=*
This is not really a register that stores text, but is a way to use an
expression in commands which use a register. The expression register is
read-only; you cannot put text into it. After the '=', the cursor moves to
@@ -1196,7 +1210,7 @@ If the "= register is used for the "p" command, the String is split up at <NL>
characters. If the String ends in a <NL>, it is regarded as a linewise
register. {not in Vi}
-7. Selection and drop registers "*, "+ and "~
+8. Selection and drop registers "*, "+ and "~
Use these registers for storing and retrieving the selected text for the GUI.
See |quotestar| and |quoteplus|. When the clipboard is not available or not
working, the unnamed register is used instead. For Unix systems the clipboard
@@ -1218,12 +1232,12 @@ GTK GUI}
Note: The "~ register is only used when dropping plain text onto Vim.
Drag'n'drop of URI lists is handled internally.
-8. Black hole register "_ *quote_*
+9. Black hole register "_ *quote_*
When writing to this register, nothing happens. This can be used to delete
text without affecting the normal registers. When reading from this register,
nothing is returned. {not in Vi}
-9. Last search pattern register "/ *quote_/* *quote/*
+10. Last search pattern register "/ *quote_/* *quote/*
Contains the most recent search-pattern. This is used for "n" and 'hlsearch'.
It is writable with `:let`, you can change it to have 'hlsearch' highlight
other matches without actually searching. You can't yank or delete into this
diff --git a/src/buffer.c b/src/buffer.c
index 0d147060..e4230fc4 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1150,7 +1150,7 @@ do_buffer(action, start, dir, count, forceit)
{
/* don't warn when deleting */
if (!unload)
- EMSGN(_("E86: Buffer %ld does not exist"), count);
+ EMSGN(_(e_nobufnr), count);
}
else if (dir == FORWARD)
EMSG(_("E87: Cannot go beyond last buffer"));
diff --git a/src/globals.h b/src/globals.h
index a26a8b53..474f74fc 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1571,6 +1571,7 @@ EXTERN char_u e_nbreadonly[] INIT(= N_("E744: NetBeans does not allow changes in
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 %ld does not exist"));
#ifdef FEAT_EX_EXTRA
EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
diff --git a/src/ops.c b/src/ops.c
index 6df1121a..a4261cb5 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 == '=')
{
diff --git a/src/version.c b/src/version.c
index 18c41c74..17e442f8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 605,
+/**/
604,
/**/
603,