In vim, I can show all the open buffers by running the :buffers
command, however, sometimes the list can get long, is there a way to limit the output to only filenames matching pattern?
For example:
How would I only show the *.c files?
Use Ctrl-D after the wildcard:
:b *.c<Ctrl-D>
You have :buffer *.c^D
(where ^D
mean you type CTRL+D).
Or, if this is about writing a plugin:
echo join(map(filter(copy(range(1, bufnr('$'))), 'buflisted(v:val) && bufname(v:val) =~ ".*\\.c"'), '" ".fnamemodify(bufname(v:val), ":p")'), "\n")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With