summaryrefslogtreecommitdiffstats
path: root/lisp/init-ibuffer.el
blob: e85169b6d76126d61daa6ff112cae7d84f85833d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
;;; init-ibuffer.el --- configure ibuffer and vc integration  -*- lexical-binding:t -*-
;;; Commentary:
;;; Code:

(use-package ibuffer
  :init
  ;; disable confirmation for killing unmodified buffers
  (setq ibuffer-expert t)

  ;; sort buffers by name
  (setq-default ibuffer-default-sorting-mode 'alphabetic)

  ;; hide empty filter groups
  (setq ibuffer-show-empty-filter-groups nil)

  ;; use ibuffer
  :bind (("C-x C-b" . ibuffer-other-window)
         :map ibuffer-mode-map
         ;; make C-o and o behave as in dired
         ("o" . ibuffer-visit-buffer-other-window)
         ("C-o" . ibuffer-visit-buffer-other-window-noselect)))

(use-package ibuffer-vc
  :ensure t
  :init
  ;; enable for remote files
  (setq ibuffer-vc-skip-if-remote nil)

  ;; group ibuffer by repository root
  :hook (ibuffer-mode . ibuffer-vc-set-filter-groups-by-vc-root)

  :bind (:map ibuffer-mode-map
         ;; g updates both buffers and repository groups
         ("g" . ibuffer-vc-set-filter-groups-by-vc-root)))

(provide 'init-ibuffer)

;;; init-ibuffer.el ends here