2016-10-05 8:18 GMT+09:00 João Miguel <jmcf...@openmailbox.org>: > A 2016-10-04T22:49:10 +0200, Bram Moolenaar escreveu: > > > > João Miguel wrote: > > > > > While I thought "-" was an option, it actually isn't (see > > > http://lists.gnu.org/archive/html/bug-coreutils/2016-10/msg00002.html > ). > (...) > > > > If "vim -- -" reads from stdin, then how do you edit a file name "-"? > > The current behavior is needed for that. > That's what I thought, it was a bug in the coreutils ("cat -- -" does > the same as "cat -"). But no, POSIX specifies this precisely (- should > be consistent). To open a file named "-", use "vim ./-", the same way > you would use "cat ./-" to dump a file's contents to stdout, or "vim > ../-" to open a file named "-" in the directory above. > > The point is, "-" is specified not to be an option by POSIX. If you used > getopt, making it an option would actually be impossible (by design). As > appealing as it may sound, "vim -- -" should therefore *not* have the > effect of "vim ./-" - also note the latter is 1 character shorter. >
According to another part of the same document that the coreutils dev referred to in reply to your another bug report to bug-coreutils, namely, the subsection OPERANDS of 1.4 Utility Description Defaults, http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html, they say: > If an operand naming a file can be specified as '-', which means to use the standard input instead of a named file, this is explicitly stated in this section. where, judging from the context around the sentence there, "this section" stands for a section called OPERANDS. Meanwhile, Vim explicitly states it in the section of OPTIONS of vim(1) like this: > -- Denotes the end of the options. Arguments after this will be handled as a file name. This can be used to edit a filename that starts with a '-'. True, there's an obvious difference in section names to have used. Apart from that, Vim seemingly complies with the standard in an allowable deviation, IMHO. Best, Kazunobu Kuriyama > Regards, > João Miguel > > -- > -- > 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 vim_dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.