Like :s//string/ and :g//, :sort // uses the last search pattern when no pattern is given. Unlike :s and :g it doesn't handle well the case where there is no last search pattern.
The attached patch fixes this.
Details
-------
When there is no last search pattern (e.g. on a new installation or when
no viminfo file is present), :s//string/ and :g// both abort with
E35: No previous regular expression
E476: Invalid command
In :sort, this situation isn't handled carefully enough: "//" is
actually compiled to an empty regular expression. Output of regdump():
regcomp():
1:BRANCH(7)
4:NOTHING(7)
7:END(0)
This is not part of the advertised behaviour: "If {pattern} is empty
(e.g. // is specified), the last search pattern is used." The patch
makes :sort // follow the example of :s and :g and bail out with E35
when necessary.
David Bürgin
--
--
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/groups/opt_out.
sort-empty-pattern-errmsg.patch
Description: Binary data
