Skip to content

Instantly share code, notes, and snippets.

@agzam
Last active March 27, 2020 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agzam/a9b7062f8785d733777132a216d99891 to your computer and use it in GitHub Desktop.
Save agzam/a9b7062f8785d733777132a216d99891 to your computer and use it in GitHub Desktop.
Custom iBuffer filter for unsaved buffers
(define-ibuffer-filter unsaved-file-buffers
"Toggle current view to buffers whose file is unsaved."
(:description "file is unsaved")
(ignore qualifier)
(and (buffer-local-value 'buffer-file-name buf)
(buffer-modified-p buf)))
(define-key ibuffer-mode-map (kbd "/ u") #'ibuffer-filter-by-unsaved-file-buffers)
;; Then you can press </ u> in iBuffer
;; Note that in Spacemacs you'd have to use <\ u>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment