Reputation: 5167
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?
Upvotes: 5
Views: 636
Reputation: 32986
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")
Upvotes: 4