summaryrefslogtreecommitdiff
path: root/lisp/init-buffers.el
blob: 98207d1bcc931f18c858999b1ccf7cb33f7530c6 (plain)
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

(require 'uniquify)

(setq uniquify-buffer-name-style 'forward)

(setq ibuffer-expert t
      ibuffer-restore-window-config-on-quit t
      ibuffer-show-empty-filter-groups nil)

(defun km/save-and-kill-buffer ()
  "Save current buffer and then kill it."
  (interactive)
  (save-buffer)
  (kill-this-buffer))

(defun km/kill-buffer (&optional arg)
  "Kill this buffer.
With single C-u, prompt for buffer to kill.  With double C-u,
kill this buffer and the window."
  (interactive "P")
  (cond
   ((not arg)
    (kill-buffer))
   ((equal arg '(16))
    (kill-buffer-and-window))
   (t
    (call-interactively #'kill-buffer))))

(global-set-key (kbd "C-x K") 'km/kill-buffer)

(key-chord-define-global "js" 'save-buffer)

;; Replace `list-buffers' with ibuffer.
(global-set-key (kbd "C-x C-b") 'ibuffer)

(provide 'init-buffers)