Restore ":browse oldfiles" behavior from Vim

In 3b12bb225a, ":oldfiles" was taught to
behave like Vim's ":browse oldfiles" if ":oldfiles!" was used.  However,
this conflates the use of ! for abandoning a modified buffer with
choosing one file out of a list of oldfiles.

Now that ":browse" is supported again, ":browse oldfiles" will allow the
user to select an old file, while still complaining if that would cause
a modified buffer to be abandoned.  ":browse oldfiles!" will just
abandon the buffer, as expected.
This commit is contained in:
James McCoy 2016-08-11 09:35:17 -04:00
parent b805a71495
commit d0c0930acf
4 changed files with 5 additions and 7 deletions

View File

@ -1200,11 +1200,10 @@ running) you have additional options:
:wv[iminfo][!] [file] Deprecated alias to |:wshada| command.
*:o* *:ol* *:oldfiles*
:o[ldfiles][!] List the files that have marks stored in the ShaDa
:o[ldfiles] List the files that have marks stored in the ShaDa
file. This list is read on startup and only changes
afterwards with ":rshada!". Also see |v:oldfiles|.
The number can be used with |c_#<|.
Use ! to get a file selection prompt.
:bro[wse] o[ldfiles][!]
List file names as with |:oldfiles|, and then prompt

View File

@ -188,7 +188,6 @@ Additional differences:
compatibility reasons.
- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
commands are still kept.
- |:oldfiles| supports !.
- When writing (|:wshada| without bang or at exit) it merges much more data,
and does this according to the timestamp. Vim merges only marks.
|shada-merging|

View File

@ -21722,8 +21722,8 @@ void ex_oldfiles(exarg_T *eap)
/* Assume "got_int" was set to truncate the listing. */
got_int = FALSE;
// File selection prompt on ":oldfiles!"
if (eap->forceit) {
// File selection prompt on ":browse oldfiles"
if (cmdmod.browse) {
quit_more = false;
nr = prompt_for_number(false);
msg_starthere();

View File

@ -47,7 +47,7 @@ describe(':oldfiles', function()
end)
end)
describe(':oldfiles!', function()
describe(':browse oldfiles', function()
local filename
local filename2
local oldfiles
@ -74,7 +74,7 @@ describe(':oldfiles!', function()
ok(filename == oldfiles[1] or filename == oldfiles[2])
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
execute('oldfiles!')
execute('browse oldfiles')
end)
after_each(function()