-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmy-buffers.el
66 lines (58 loc) · 2.39 KB
/
my-buffers.el
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;; From the docs:
;;
;; Narrowing means focusing in on some portion of the buffer, making
;; the rest temporarily inaccessible. The portion which you can still
;; get to is called the accessible portion. Canceling the narrowing,
;; which makes the entire buffer once again accessible, is called
;; widening. The bounds of narrowing in effect in a buffer are called
;; the buffer's restriction.
(put 'narrow-to-region 'disabled nil)
;; better buffer names for duplicates
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward
uniquify-separator "/"
uniquify-ignore-buffers-re "^\\*" ; leave special buffers alone
uniquify-after-kill-buffer-p t)
(use-package ibuffer
:commands ibuffer
:ensure ibuffer
:config
(progn
(setq ibuffer-expert t)
(setq ibuffer-saved-filter-groups
(quote (("default"
("dired" (mode . dired-mode))
("haskell" (mode . haskell-mode))
("python" (mode . python-mode))
("nasa" (or
(name . ".nasa.")
(filename . ".nasa.")))
("wiki" (or
(filename . (concat (getenv "HOME") "/wiki"))
(filename . (concat (getenv "HOME") ".gitit"))))
("notes" (or
(name . "^\\*Calendar\\*$")
(name . "^diary$")
(mode . org-mode)))
("*buffer*" (name . "\\*.*\\*"))
)))
)
(defvar my-ibuffer-use-vc-groups t
"Use filter groups detected from vc root when non-nil.
This will be done with `ibuffer-vc-set-filter-groups-by-vc-root'
If this is nil, then filter groups will be restored from `ibuffer-saved-filter-groups'.")
(defun my-ibuffer-setup ()
"Configure ibuffer the way I want it.
This sets `ibuffer-auto-mode' and restores the chosen filter group settings,
according to the values of `my-ibuffer-use-vc-groups' and
`ibuffer-saved-filter-groups'."
(ibuffer-auto-mode 1)
(if my-ibuffer-use-vc-groups
(ibuffer-vc-set-filter-groups-by-vc-root)
(ibuffer-switch-to-saved-filter-groups "default")))
(add-hook 'ibuffer-mode-hook 'my-ibuffer-setup)
(setq ibuffer-show-empty-filter-groups nil)
(use-package ibuffer-vc
:ensure ibuffer-vc
:config)))
(provide 'my-buffers)