Hello,

I was wondering for some time why the :buffer command does not allow for
+cmd argument (:help +cmd), like :edit does.  Though this is not
strictly necessary since one can always do
:buffer1|cmd
but the same is true for :edit command; one can do both:
:edit +cmd file
:edit file|cmd

I attach a patch as a proof of concept and to let it try.

Best regards,
Marcin Szamotulski
diff -r 18fd959b07ef -r 1c58235619f2 src/ex_cmds.h
--- a/src/ex_cmds.h	Wed Aug 13 22:05:54 2014 +0200
+++ b/src/ex_cmds.h	Mon Aug 18 12:07:52 2014 +0100
@@ -132,7 +132,7 @@
 EX(CMD_aunmenu,		"aunmenu",	ex_menu,
 			EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
 EX(CMD_buffer,		"buffer",	ex_buffer,
-			BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR),
+			BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR),
 EX(CMD_bNext,		"bNext",	ex_bprevious,
 			BANG|RANGE|NOTADR|COUNT|TRLBAR),
 EX(CMD_ball,		"ball",		ex_buffer_all,
diff -r 18fd959b07ef -r 1c58235619f2 src/ex_docmd.c
--- a/src/ex_docmd.c	Wed Aug 13 22:05:54 2014 +0200
+++ b/src/ex_docmd.c	Mon Aug 18 12:07:52 2014 +0100
@@ -5115,6 +5115,8 @@
 	    goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
 	else
 	    goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
+	if (eap->do_ecmd_cmd != NULL)
+	    do_cmdline_cmd(eap->do_ecmd_cmd);
     }
 }
 

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui