Add ace-window

This commit is contained in:
Case Duckworth 2021-12-17 18:29:58 -06:00
parent b11adad984
commit 506b6c66fe
2 changed files with 45 additions and 0 deletions

View File

@ -161,6 +161,14 @@
(with-eval-after-load 'embark
(define-key embark-region-map (kbd "U") '0x0-dwim)))
(setup (:straight ace-window)
(:also-load +ace-window)
(:option aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
aw-display-mode-overlay nil)
(:+key "M-o" '+ace-window-or-switch-buffer)
(:face aw-mode-line-face ((t (:foreground "red"))))
(+ace-window-display-mode +1))
(setup (:straight acme-theme)
;; (load-theme 'acme t)
)

37
lisp/+ace-window.el Normal file
View File

@ -0,0 +1,37 @@
;;; +ace-window.el -*- lexical-binding: t; -*-
;;; Code:
(require 'ace-window)
;;;###autoload
(define-minor-mode +ace-window-display-mode
"Minor mode for updating data for `+modeline-ace-window-display'."
;; This is stolen from ace-window.el but with the mode-line stuff ripped out.
:global t
(if +ace-window-display-mode
(progn
(aw-update)
(force-mode-line-update t)
(add-hook 'window-configuration-change-hook 'aw-update)
(add-hook 'after-make-frame-functions 'aw--after-make-frame t)
(advice-add 'aw--lead-overlay :override 'ignore))
(remove-hook 'window-configuration-change-hook 'aw-update)
(remove-hook 'after-make-frame-functions 'aw--after-make-frame)
(advice-remove 'aw--lead-overlay 'ignore)))
;;;###autoload
(defun +ace-window-or-switch-buffer (arg)
"Call `ace-window' with ARG if more than one window is visible.
Switch to most recent buffer otherwise."
;; cribbed from `crux-other-window-or-switch-buffer'
(interactive "p")
(if (one-window-p)
(switch-to-buffer nil)
(ace-window arg)))
(defun +ace-window@disable-overlay (_fn &rest _args)
"ADVICE for FN `aw--lead-overlay' (and ARGS) to not show overlays.")
(provide '+ace-window)
;;; +ace-window.el ends here