aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-08-11 18:58:26 -0400
committerGitHub <noreply@github.com>2016-08-11 18:58:26 -0400
commita1682281f427ab011930f421e5691cf4bf230df1 (patch)
treebea2bfef53af6182fce4437a3f82ddf2e46879de
parent8c4c366a9ebeff6c549f85316cbc8838fcfae56a (diff)
parent6aefd14482fe58d4c056bd8e1e1651640387a36e (diff)
downloadrneovim-a1682281f427ab011930f421e5691cf4bf230df1.tar.gz
rneovim-a1682281f427ab011930f421e5691cf4bf230df1.tar.bz2
rneovim-a1682281f427ab011930f421e5691cf4bf230df1.zip
Merge #5214 from jamessan/browse-modifier
Re-add ":browse" command modifier and use it with ":oldfiles"
-rw-r--r--runtime/doc/starting.txt3
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/ex_cmds_defs.h31
-rw-r--r--src/nvim/ex_docmd.c3
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua4
6 files changed, 22 insertions, 24 deletions
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 8249f8e71f..c6f51d47b9 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -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
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 3c8b728b95..9bd129a7c2 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -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|
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 38aa587d37..f6545a5ca9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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();
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index f46d1e6d47..421c14b495 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -160,23 +160,22 @@ typedef struct expand {
#define XP_BS_ONE 1 /* uses one backslash before a space */
#define XP_BS_THREE 2 /* uses three backslashes before a space */
-/*
- * Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag.
- * This needs to be saved for recursive commands, put them in a structure for
- * easy manipulation.
- */
+/// Command modifiers ":vertical", ":browse", ":confirm", ":hide", etc. set a
+/// flag. This needs to be saved for recursive commands, put them in a
+/// structure for easy manipulation.
typedef struct {
- int hide; /* TRUE when ":hide" was used */
- int split; /* flags for win_split() */
- int tab; /* > 0 when ":tab" was used */
- int confirm; /* TRUE to invoke yes/no dialog */
- int keepalt; /* TRUE when ":keepalt" was used */
- int keepmarks; /* TRUE when ":keepmarks" was used */
- int keepjumps; /* TRUE when ":keepjumps" was used */
- int lockmarks; /* TRUE when ":lockmarks" was used */
- int keeppatterns; /* TRUE when ":keeppatterns" was used */
- bool noswapfile; /* true when ":noswapfile" was used */
- char_u *save_ei; /* saved value of 'eventignore' */
+ int hide; ///< TRUE when ":hide" was used
+ int split; ///< flags for win_split()
+ int tab; ///< > 0 when ":tab" was used
+ int confirm; ///< TRUE to invoke yes/no dialog
+ int keepalt; ///< TRUE when ":keepalt" was used
+ int keepmarks; ///< TRUE when ":keepmarks" was used
+ int keepjumps; ///< TRUE when ":keepjumps" was used
+ int lockmarks; ///< TRUE when ":lockmarks" was used
+ int keeppatterns; ///< TRUE when ":keeppatterns" was used
+ bool noswapfile; ///< true when ":noswapfile" was used
+ bool browse; ///< TRUE to invoke file dialog
+ char_u *save_ei; ///< saved value of 'eventignore'
} cmdmod_T;
#endif // NVIM_EX_CMDS_DEFS_H
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 8bae817211..1e54f03ba0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1313,8 +1313,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case 'b': if (checkforcmd(&ea.cmd, "belowright", 3)) {
cmdmod.split |= WSP_BELOW;
continue;
- }
+ }
if (checkforcmd(&ea.cmd, "browse", 3)) {
+ cmdmod.browse = true;
continue;
}
if (!checkforcmd(&ea.cmd, "botright", 2))
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index b7109f2f98..716c1ebfb2 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -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()