Bram,
condsider this:
#v+
~$vim -u NONE -N <((seq 1 10))
[Enter the following normal mode commands:]
!!printf "\%s" "foobar"<cr>
j.
:w !cat
foobar
/proc/26234/fd/11s
3
4
5
...
#v-
Note, that the second line, does not contain the foobar line, but
contains the filename.
This happens, because when saving the command for the redo buffer, the
'%' and '#' in the
command line are no longer escaped and so when redoing the command get
replaced by the buffer
name. If doing this in an empty scratch buffer, you'll even end up with
Error E499
I think, when storing the commmandline for the redo buffer, any
unescaped '%' and '#' needs to be
escaped again, since by the time the command is saved in the redo
buffer, wildcard expansion has
already taken place, so any remaining wildcards must have been escaped
before.
I think, current workaround for that problem is to set the cpo setting
to include the '!' flag.
This problem has been reported at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739656
Best,
Christian
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1012,7 +1012,17 @@
if (bangredo) /* put cmd in redo buffer for ! command */
{
- AppendToRedobuffLit(prevcmd, -1);
+ /* if % or # appear in the command, they must have been escaped
+ * so reescape them, so that redoing them does not substitute them by
+ * the buffername */
+ char_u * cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#");
+ if (cmd != NULL)
+ {
+ AppendToRedobuffLit(cmd, -1);
+ vim_free(cmd);
+ }
+ else
+ AppendToRedobuffLit(prevcmd, -1);
AppendToRedobuff((char_u *)"\n");
bangredo = FALSE;
}