forked from kaushalmodi/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-ace-window.el
49 lines (40 loc) · 1.59 KB
/
setup-ace-window.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
;; Time-stamp: <2016-05-07 01:13:15 kmodi>
;; Ace Window
;; https://github.com/abo-abo/ace-window
(use-package ace-window
:bind (:map modi-mode-map
("C-x o" . ace-window))
:config
(progn
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
(defface modi/aw-mode-line-face
'((((background dark)) (:foreground "gray50"))
(t (:foreground "black")))
"Face used for displaying the ace window key in the mode-line.")
;; Patch `aw-update' to use the background sensitive face
(defun aw-update ()
"Update ace-window-path window parameter for all windows."
(avy-traverse
(avy-tree (aw-window-list) aw-keys)
(lambda (path leaf)
(set-window-parameter
leaf 'ace-window-path
(propertize
(apply #'string (reverse path))
'face 'modi/aw-mode-line-face)))))
(ace-window-display-mode 1)))
(provide 'setup-ace-window)
;; `ace-window-BINDING' -> `ace-select-window'
;; C-u `ace-window-BINDING' -> `ace-swap-window'
;; C-u C-u `ace-window-BINDING' -> `ace-delete-window'
;; ace-window dispatch operations:
;;
;; | x | aw-delete-window | Ace - Delete Window |
;; | m | aw-swap-window | Ace - Swap Window |
;; | n | aw-flip-window | |
;; | v | aw-split-window-vert | Ace - Split Vert Window |
;; | b | aw-split-window-horz | Ace - Split Horz Window |
;; | i | delete-other-windows | Ace - Maximize Window |
;; | o | delete-other-windows | |
;;
;; Usage: <ace-window BINDING> x <WINDOW-CHAR> will delete that window