Add ibuffer filter group for the workspace

This introduces the +ibuffer-current-workspace function which open an
ibuffer with only buffers from the current workspace.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
This commit is contained in:
Rudi Grinberg 2019-12-07 23:02:06 +07:00
parent a7d5da494e
commit 0ea1974732

View file

@ -39,6 +39,23 @@
:header-mouse-map ibuffer-size-header-map)
(file-size-human-readable (buffer-size)))
(when (featurep! :ui workspaces)
(define-ibuffer-filter workspace-buffers
"Filter for workspace buffers"
(:reader
(+workspace-get (read-string "workspace name: ")) :description "workspace")
(memq buf (+workspace-buffer-list qualifier)))
(defun +ibuffer/workspace (workspace-name)
"Open an ibuffer window for a workspace"
(ibuffer nil (format "%s buffers" workspace-name)
(list (cons 'workspace-buffers (+workspace-get workspace-name)))))
(defun +ibuffer-current-workspace ()
"Open an ibuffer window for the current workspace"
(interactive)
(+ibuffer/workspace (+workspace-current-name))))
(when (featurep! :completion ivy)
(defadvice! +ibuffer-use-counsel-maybe-a (_file &optional _wildcards)
"Use `counsel-find-file' instead of `find-file'."