Revise :killo, add :killunreal

This commit is contained in:
Henrik Lissner 2016-03-29 23:48:22 -04:00
parent 91ebf03a59
commit fc579f19ea
2 changed files with 12 additions and 2 deletions

View file

@ -204,7 +204,7 @@ left, create a scratch buffer."
(narf/cycle-real-buffers -1)) (narf/cycle-real-buffers -1))
(defun narf--kill-buffers (buffers &optional filter-func) (defun narf--kill-buffers (buffers &optional filter-func)
(let ((buffers (if filter-func (funcall filter-func buffers) buffers)) (let ((buffers (if filter-func (-filter filter-func buffers) buffers))
(affected 0)) (affected 0))
(mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers) (mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers)
(unless (narf/real-buffer-p) (unless (narf/real-buffer-p)
@ -219,6 +219,15 @@ left, create a scratch buffer."
(when bang (when bang
(delete-other-windows))) (delete-other-windows)))
;;;###autoload (autoload 'narf:kill-other-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-other-buffers (&optional bang)
"Kill all other project buffers. If BANG, kill *all* other buffers (in workgroup)."
(interactive "<!>")
(narf--kill-buffers (narf/get-buffers (not bang))
(lambda (b) (not (eq b (current-buffer)))))
(when bang
(delete-other-windows)))
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t) ;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
(evil-define-command narf:kill-buried-buffers (&optional bang) (evil-define-command narf:kill-buried-buffers (&optional bang)
"Kill buried project buffers (in workgroup) and report how many it found. BANG = get all "Kill buried project buffers (in workgroup) and report how many it found. BANG = get all

View file

@ -35,7 +35,8 @@
(exmap "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer (exmap "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer
(exmap "k[ill]all" 'narf:kill-all-buffers) ; Kill all buffers (bang = in project) (exmap "k[ill]all" 'narf:kill-all-buffers) ; Kill all buffers (bang = in project)
(exmap "k[ill]buried" 'narf:kill-buried-buffers) ; Kill all buried buffers (bang = in project) (exmap "k[ill]buried" 'narf:kill-buried-buffers) ; Kill all buried buffers (bang = in project)
(exmap "k[ill]o" 'narf:kill-unreal-buffers) ; kill unreal buffers (exmap "k[ill]o" 'narf:kill-other-buffers) ; kill all other buffers
(exmap "k[ill]unreal" 'narf/kill-unreal-buffers) ; kill unreal buffers
(exmap "k[ill]match" 'narf:kill-matching-buffers) ; kill buffers that match regexp (exmap "k[ill]match" 'narf:kill-matching-buffers) ; kill buffers that match regexp
(exmap "l[ast]" 'narf/popup-last-buffer) ; pop up last popup (exmap "l[ast]" 'narf/popup-last-buffer) ; pop up last popup
(exmap "m[sg]" 'narf/popup-messages) ; open *messages* in popup (exmap "m[sg]" 'narf/popup-messages) ; open *messages* in popup