Create the following file structure
mkdir test-vim-1
cd test-vim-1
mkdir -p src/app/jargon/views/
mkdir -p src/app/jargon/views/ProfileEditBottomSheetView/
mkdir -p src/app/jargon/views/ProfileEditBottomSheetView/
mkdir -p src/app/jargon/views/CheckInBottomSheetView/
mkdir -p src/app/jargon/views/pages/my-account/
mkdir -p src/app/jargon/views/ProfileEditBottomSheetView/
mkdir -p src/app/jargon/views/pages/home/
mkdir -p src/app/jargon/views/LanguagesBottomSheetView/
mkdir -p src/app/jargon/views/pages/coffee-house-detail/
mkdir -p src/app/jargon/views/
mkdir -p src/app/jargon/views/pages/chat/
mkdir -p src/app/jargon/views/pages/coffee-house-detail/
touch src/app/jargon/views/ShareWithFriendsBottomSheetView.js
touch src/app/jargon/views/ProfileEditBottomSheetView/ProfileEditBottomSheetView.js
touch src/app/jargon/views/ProfileEditBottomSheetView/ProfileImageControl.js
touch src/app/jargon/views/CheckInBottomSheetView/CheckInBottomSheetView.js
touch src/app/jargon/views/pages/my-account/OptionsMenuBottomSheetView.js
touch src/app/jargon/views/ProfileEditBottomSheetView/profile-edit-bottom-sheet-view-terms.js
touch src/app/jargon/views/pages/home/CoffeeHouseSearchBottomSheetView.js
touch src/app/jargon/views/LanguagesBottomSheetView/LanguagesBottomSheetView.js
touch src/app/jargon/views/pages/coffee-house-detail/ViewMemberBottomSheetView.js
touch src/app/jargon/views/BottomSheetLayout.js
touch src/app/jargon/views/pages/chat/AllReactionsBottomSheetView.js
touch src/app/jargon/views/pages/coffee-house-detail/AddAdminBottomSheetView.js
Now, open vim, and open all the files (replace with your $PWD or test-vim-1):
:e /<path-to-dir>/src/app/jargon/views/ShareWithFriendsBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/ProfileEditBottomSheetView/ProfileEditBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/ProfileEditBottomSheetView/ProfileImageControl.js | e /<path-to-dir>/src/app/jargon/views/CheckInBottomSheetView/CheckInBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/pages/my-account/OptionsMenuBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/ProfileEditBottomSheetView/profile-edit-bottom-sheet-view-terms.js | e /<path-to-dir>/src/app/jargon/views/pages/home/CoffeeHouseSearchBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/LanguagesBottomSheetView/LanguagesBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/pages/coffee-house-detail/ViewMemberBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/BottomSheetLayout.js | e /<path-to-dir>/src/app/jargon/views/pages/chat/AllReactionsBottomSheetView.js | e /<path-to-dir>/src/app/jargon/views/pages/coffee-house-detail/AddAdminBottomSheetView.js
Finally, now type : b Bot
, and <C-d>
will somehow only produce src/app/jargon/views/BottomSheetLayout.js
even though every other buffer contains the substring "Bot", and pressing Enter will produce the E93: More than one match
.
: b Bot
, and <C-d>
should produce all the other loaded buffers. When <C-d>
shows a single file, executing the command should not produce E93: More than one match
.
Tested on NixOS with "VIM - Vi IMproved 9.0", "Included patches: 1-1441" and macOS with "VIM - Vi IMproved 8.2)", "Included patches: 1-5032"
NixOS with "VIM - Vi IMproved 9.0", "Included patches: 1-1441"
TERM: xterm
shell: GNU bash, version 5.2.15(1)-release
macOS with "VIM - Vi IMproved 8.2)", "Included patches: 1-5032"
TERM: xterm-kitty
shell: zsh 5.8.1 (x86_64-apple-darwin21.0)
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I see what is happening. The buflist_findpat() function tries very hard to find a match. There are several tries:
^
)$
)^
and adding a $
)Now your pattern Bot
already matches in the first round already those 2 files:
AddAdminBottomSheetView.js
andAllReactionsBottomSheetView.js
So it errors out.
However :h c_Ctrl-D uses command line completion (for the :b
command it uses buffer-expansion) and explicitly anchors the pattern to the beginning of the file-name, so that only BottomSheetLayout.js
is matched.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
<C-d>
doesn't just search for the pattern at the beginning though; e.g. with the above test case, : b Adm
followed by <C-d>
returns AddAdminBottomSheetView.js
just fine.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I agree; I’m confident (away from my computer) that C-d can complete from inner text of the buffer name.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Yes that is correct. I found the issue then. Basically, the buffer expansion function tries to anchor the match against the start of word and only if it did not find a match yet tries again to match anywhere: https://github.com/vim/vim/blob/2a65e739447949a7aee966ce8a3b75521b2a79ea/src/buffer.c#L2813-L2814
So how about the following pach:
diff --git a/src/buffer.c b/src/buffer.c index 4a39329c5..09938529a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2934,11 +2934,10 @@ ExpandBufnames( } if (!fuzzy) - { vim_regfree(regmatch.regprog); - if (count) // match(es) found, break here - break; - } + // don't break here even when a match was found, + // we want to collect all matches, so continue + // matching anywhere in the buffer name } if (!fuzzy && patc != pat)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I created #14082 for the fix
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #13894 as completed via 0dc0bff.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.