On Mon, Sep 2, 2019 at 11:16 PM Bram Moolenaar <[email protected]> wrote: > > > Tony wrote: > > > I just noticed that hitting : without a command name is a valid > > ex-command which does nothing (other than going to a range if there is > > one). I propose to document it, see attached patch. > > > > The range (if present) can IIUC be any valid range, not just an > > absolute line number but also e.g. a relative line number or even a > > search command. If there is not even a range, then no error is given > > and nothing happens, just like when reading an empty line in a sourced > > script. > > > > I don't know of what use it would be to type : with neither a range > > nor a command, but who knows? OTOH it "makes logical" what happens > > when typing :1234 (go to line 1234) or even :1000;/sometext (go to the > > first line containing "sometext" after line 1000); and IIUC the "Vim > > philosophy" is that every feature should be documented, and to my mind > > "this isn't a bug, it's a feature". ;-) > > Using the range to jump to a line is documented at ":help :range". > > Weirdly ":" does nothing, but ":|" prints the current line.
Actually, using a naked range is documented at "help :[range]" (with brackets). The way I read it, ":help :range" (without brackets) seems to imply that some unspecified command follows the range. And I don't know where ":|" is documented; maybe it should be mentioned at ":help :bar". And maybe also at ":help :print" since apparently it is a shortcut for it. Oh, found it: about one screen page or a little more after ":help :bar", at cmdline.txt line 644; maybe it should have a help tag. However, experiment shows that unlike what is said there, ":3|" goes to line 3 even with a bar. Maybe it's "Improved" behaviour compared to Vi, maybe it's a bug: you judge. Oh, a use for the no-op ex-command is documented under another name, at ":help :exe-comment" (the way I understand it now, the comment after the bar implies that between the | and the " there is an empty ex-command). Seeing the empty ex-command as a no-op makes several things fit better in my mind; I still think it should be documented somewhere, with a mention there that just :| is (by exception) not two empty commands on one line but an abbreviation for the :print command. Maybe put it, with a helptag, just above what is now line 644 of cmdline.txt. Best regards, Tony. -- -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAJkCKXuguLhfnBeGgio4cvmPTiEigdy4ahNqn_bN0mFYXMAK%3Dw%40mail.gmail.com.
