reddit / emacs
How to manage buffers?
SasukeUchiha231 · 2022-06-10 11:48
I use vertico+consult+marginalia to navigate around. I would like a command that only shows me files, consult-buffer shows a lot of \* buffers, which don't really correspond to any file, and hinder me while switching buffers
Danrobi1 · 2022-06-10 11:55
Did you tried `ibuffer`?
flexibeast · 2022-06-10 12:08
iBuffer is what i use myself, but OP might be looking for something that presents the options in the minibuffer rather than an independent buffer.
SasukeUchiha231 · 2022-06-10 12:12
I think you've misunderstood. I want a function that works exactly like consult-buffer, but filters the unnecessary \* buffers, and only show me those buffers that correspond to a file.
flexibeast · 2022-06-10 12:16
From what i can tell from the `consult` docs, you might be able to modify `consult-buffer-sources` so that there's an option to only show buffers with associated files:
https://github.com/minad/consult#multiple-sources
(Scroll down to the para that begins "Sources can be added directly to the consult-buffer-source list for convenience.")
SasukeUchiha231 · 2022-06-10 12:28
Ah Thanks! Exactly what I needed
vifon · 2022-06-10 12:29
You can customize `consult-buffer-filter` to filter out the buffers you deem unnecessary.
deaddyfreddy · 2022-06-10 12:35
not exactly what you're asking for, but projectile-related functions can narrow buffers/files to a project
FrozenOnPluto · 2022-06-10 14:18
Look up **filetree** package; its fantastic.
https://github.com/knpatel401/filetree
It can run in many forms, but I mostly use it for a buiffer list and manipulator; with some decent config I've got it colour coding each column differently for maximum 80s bbs feel (I prefer to have the filenames versus file attributes different colours, to theme), sorted in the right way, and hiding all the ephemeral buffers. ie: I have it only show legit files, and if I happen to want to go to a \*foo-log\* type buffer I use that by hand with completion (thanks to Selectrum et al)
filetree is fantastic
There is also **bufler** you might want to look into as well, but I picked filetree > bufler for my purposes.
hagerty9009 · 2022-06-11 02:53
You *should* be able to type `f<SPC>` in consult-buffer to narrow the view to files.
SasukeUchiha231 · 2022-06-11 03:48
Yeah I read that in the docs, but unfortunately it doesn't work, it activates orderless
(I think) and starts to filter buffers, instead of the intended function.
hagerty9009 · 2022-06-11 10:26
I mean, yeah. It filters your open buffers to show just the buffers that represent files. Are you trying to see files that don’t have a buffer either? That would be a different command.
SasukeUchiha231 · 2022-06-11 13:37
Nope it doesn't do that. It just shows buffers that have a f in their names
oantolin · 2022-06-12 16:32
That is some issue with your configuration, by default `f SPC` should definitely narrow `consult-buffer`'s list to just buffers that are visiting a file. If you are convinced it is not an issue with your personal configuration, please file a [bug report](https://github.com/minad/consult#bug-reports) in the consult repo.
AblatedSprocket · 2022-06-17 21:59
I'm wanting to do what you're doing, but if I type *, I want those ephemeral buffers to display. Did you do this or is your use case to hide them always and never display these buffers under any circumstance?
SasukeUchiha231 · 2022-06-18 06:12
If you have a space character in the beginning, it will show all hidden buffers, I'm using consult-buffer-filter to filter out the unnecessary buffers.
AblatedSprocket · 2022-06-18 12:56
Thanks! Didn't know space did that. In the meantime, I created a consult-buffer-source consisting of the buffers I excluded which I might like better:
(add-to-list 'consult-buffer-sources
(list :name "Ephemeral"
:narrow ?m
:category 'buffer
:items (list "*dashboard*" "*Messages*" "*scratch*"))
'append)
Edit: formatting