":b {bufname}" tab-completion uses whole filepath

Enan Ajmain <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
I use ':b' quite often.  And I use a substring of the bufname to jump to
that buffer.  Works quite well.

But a problem is that the substring I provide isn't only matched with
the buffer names but also the filenames.  See these examples:

    :ls
      1 #h   "example\predict.py"           line 25
      2  a   "deeplog\deeplog.py"           line 0
      4 %a   "example\train.py"             line 37
    :b deep<tab>

Then when I type ":b deep<tab>", the matches shown are:

    E:\projects\log-parsing\deeplog\example\predict.py
    deeplog\deeplog.py
    E:\projects\log-parsing\deeplog\example\train.py

We can see that vim is matching the filepaths instead of only the buffer
names.  Can I change this behavior?  Preferably with vimscripting, but
I'm willing to change source code too since I use this too often.

To be clear: I want only this match to be shown:

    deeplog\deeplog.py

Here's the version info:

    :ver
    VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 21 2024 02:04:14)
    MS-Windows 64-bit console version
    Included patches: 1-426
    Compiled by ACER@JUDAS
    Huge version without GUI.  Features included (+) or not (-):
    +acl                +ex_extra           +multi_lang         -tag_any_white
    +arabic             +extra_search       -mzscheme           -tcl
    +autocmd            -farsi              -netbeans_intg      +termguicolors
    +autochdir          +file_in_path       +num64              -terminal
    +autoservername     +find_in_path       +packages           -termresponse
    -balloon_eval       +float              +path_extra         +textobjects
    +balloon_eval_term  +folding            -perl               +textprop
    -browse             -footer             +persistent_undo    -tgetent
    ++builtin_terms     -gettext            +popupwin           +timers
    +byte_offset        -hangul_input       -postscript         +title
    +channel            +iconv/dyn          +printer            -toolbar
    +cindent            +insert_expand      +profile            +user_commands
    +clientserver       +ipv6               -python             +vartabs
    +clipboard          +job                -python3            +vertsplit
    +cmdline_compl      +jumplist           +quickfix           +vim9script
    +cmdline_hist       +keymap             +reltime            +viminfo
    +cmdline_info       +lambda             +rightleft          +virtualedit
    +comments           +langmap            -ruby               +visual
    +conceal            +libcall            +scrollbind         +visualextra
    +cryptv             +linebreak          +signs              +vreplace
    -cscope             +lispindent         +smartindent        +vtp
    +cursorbind         +listcmds           -sodium             +wildignore
    +cursorshape        +localmap           -sound              +wildmenu
    +dialog_con         -lua                +spell              +windows
    +diff               +menu               +startuptime        +writebackup
    +digraphs           +mksession          +statusline         -xattr
    -dnd                +modify_fname       -sun_workshop       -xfontset
    -ebcdic             +mouse              +syntax             -xim
    +emacs_tags         -mouseshape         +tag_binary         -xpm_w32
    +eval               +multi_byte_ime/dyn -tag_old_static     -xterm_save
       system vimrc file: "$VIM\vimrc"
         user vimrc file: "$HOME\_vimrc"
     2nd user vimrc file: "$HOME\vimfiles\vimrc"
     3rd user vimrc file: "$VIM\_vimrc"
          user exrc file: "$HOME\_exrc"
      2nd user exrc file: "$VIM\_exrc"
           defaults file: "$VIMRUNTIME\defaults.vim"
    Compilation: gcc -I. -Iproto -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DHAVE_PATHDEF -DFEAT_HUGE -DHAVE_STDINT_H -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -march=x86-64 -Wall -O3 -fomit-frame-pointer -freg-struct-return
    Linking: gcc -I. -Iproto -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DHAVE_PATHDEF -DFEAT_HUGE -DHAVE_STDINT_H -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -march=x86-64 -Wall -O3 -fomit-frame-pointer -freg-struct-return -s -municode -o vim.exe -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lws2_32 -lole32 -luuid      

--
Enan

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20240614124918.000005b6%40gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.