Merge #5214 from jamessan/browse-modifier

Re-add ":browse" command modifier and use it with ":oldfiles"
This commit is contained in:
Justin M. Keyes 2016-08-11 18:58:26 -04:00 committed by GitHub
commit a1682281f4
6 changed files with 22 additions and 24 deletions

View File

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

View File

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

View File

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

View File

@ -160,23 +160,22 @@ typedef struct expand {
#define XP_BS_ONE 1 /* uses one backslash before a space */ #define XP_BS_ONE 1 /* uses one backslash before a space */
#define XP_BS_THREE 2 /* uses three backslashes before a space */ #define XP_BS_THREE 2 /* uses three backslashes before a space */
/* /// Command modifiers ":vertical", ":browse", ":confirm", ":hide", etc. set a
* Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag. /// flag. This needs to be saved for recursive commands, put them in a
* This needs to be saved for recursive commands, put them in a structure for /// structure for easy manipulation.
* easy manipulation.
*/
typedef struct { typedef struct {
int hide; /* TRUE when ":hide" was used */ int hide; ///< TRUE when ":hide" was used
int split; /* flags for win_split() */ int split; ///< flags for win_split()
int tab; /* > 0 when ":tab" was used */ int tab; ///< > 0 when ":tab" was used
int confirm; /* TRUE to invoke yes/no dialog */ int confirm; ///< TRUE to invoke yes/no dialog
int keepalt; /* TRUE when ":keepalt" was used */ int keepalt; ///< TRUE when ":keepalt" was used
int keepmarks; /* TRUE when ":keepmarks" was used */ int keepmarks; ///< TRUE when ":keepmarks" was used
int keepjumps; /* TRUE when ":keepjumps" was used */ int keepjumps; ///< TRUE when ":keepjumps" was used
int lockmarks; /* TRUE when ":lockmarks" was used */ int lockmarks; ///< TRUE when ":lockmarks" was used
int keeppatterns; /* TRUE when ":keeppatterns" was used */ int keeppatterns; ///< TRUE when ":keeppatterns" was used
bool noswapfile; /* true when ":noswapfile" was used */ bool noswapfile; ///< true when ":noswapfile" was used
char_u *save_ei; /* saved value of 'eventignore' */ bool browse; ///< TRUE to invoke file dialog
char_u *save_ei; ///< saved value of 'eventignore'
} cmdmod_T; } cmdmod_T;
#endif // NVIM_EX_CMDS_DEFS_H #endif // NVIM_EX_CMDS_DEFS_H

View File

@ -1313,8 +1313,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case 'b': if (checkforcmd(&ea.cmd, "belowright", 3)) { case 'b': if (checkforcmd(&ea.cmd, "belowright", 3)) {
cmdmod.split |= WSP_BELOW; cmdmod.split |= WSP_BELOW;
continue; continue;
} }
if (checkforcmd(&ea.cmd, "browse", 3)) { if (checkforcmd(&ea.cmd, "browse", 3)) {
cmdmod.browse = true;
continue; continue;
} }
if (!checkforcmd(&ea.cmd, "botright", 2)) if (!checkforcmd(&ea.cmd, "botright", 2))

View File

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