diff --git a/core/core-editor.el b/core/core-editor.el index 3355619f6..e5a4af288 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -242,14 +242,6 @@ with functions that require it (like modeline segments)." (def-package! ace-link :commands (ace-link-help ace-link-org)) -(def-package! ace-window - :commands (ace-window ace-swap-window ace-delete-window - ace-select-window ace-delete-other-windows) - :config - (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) - aw-scope 'frame - aw-background t)) - (def-package! avy :commands (avy-goto-char-2 avy-goto-line) :config diff --git a/init.example.el b/init.example.el index 86169ab31..14e968b0d 100644 --- a/init.example.el +++ b/init.example.el @@ -59,6 +59,7 @@ ;unicode ; extended unicode support for various languages ;tabbar ; FIXME an (incomplete) tab bar for Emacs vi-tilde-fringe ; fringe tildes to mark beyond EOB + (window-select +ace-window) ; visually switch windows :tools dired ; making dired pretty [functional] diff --git a/modules/ui/window-select/README.org b/modules/ui/window-select/README.org new file mode 100644 index 000000000..57cba1db9 --- /dev/null +++ b/modules/ui/window-select/README.org @@ -0,0 +1,23 @@ +#+TITLE: :ui window-select + +This module provides the user with a visual way to switch windows. By default, the module only kicks in if there are more than two windows open at the same time. + +* Keybindings +The default function to switch windows is automatically changed to work with this module. More specifically, the function ~other-window~ is automatically remapped. This function is bounded by default to ~C-x o~. + +* Customization +There are two packages that accomplish the same but with a different visual queue. + +** ace-window +The first character of the buffers change to a user selectable character. + + Pros: The content of the buffers are always visible. + + Cons: The displayed characters are small and difficult to see. + +This is the module's default if no module flag is specified. To explicitly enable this, write in *init.el*: ~(doom! :ui (window-select +ace-window))~ + +** switch-window +The entire buffer is replaced by big letters than enable the user to easily select a desired window. + + Pros: The displayed characters are easy to see. They will never be missed. + + Cons: The contents of the buffers is entirely replaced by a big character. + +To enable this, write in *init.el*: ~(doom! :ui (window-select +switch-window))~ diff --git a/modules/ui/window-select/config.el b/modules/ui/window-select/config.el new file mode 100644 index 000000000..4436b4fa6 --- /dev/null +++ b/modules/ui/window-select/config.el @@ -0,0 +1,24 @@ +;;; ui/window-select/config.el -*- lexical-binding: t; -*- + +(cond ((featurep! +switch-window) + ;; Configure switch-window if that flag is found + (def-package! switch-window + :commands (switch-window switch-window-then-maximize switch-window-then-split-below + switch-window-then-split-right switch-window-then-delete + switch-window-then-swap-buffer) + :init + (setq switch-window-shortcut-style 'qwerty + switch-window-qwerty-shortcuts '("a" "s" "d" "f" "g" "h" "j" "k" "l")) + ;; Redefine how we switch windows with switch-window + (define-key global-map [remap other-window] #'switch-window))) + ((or (featurep! +ace-window) t) + ;; Configure ace-window if that flag or no flag is found + (def-package! ace-window + :commands (ace-window ace-swap-window ace-delete-window + ace-select-window ace-delete-other-windows) + :init + (define-key global-map [remap other-window] #'ace-window) + :config + (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) + aw-scope 'frame + aw-background t)))) diff --git a/modules/ui/window-select/packages.el b/modules/ui/window-select/packages.el new file mode 100644 index 000000000..fc1c5fd9f --- /dev/null +++ b/modules/ui/window-select/packages.el @@ -0,0 +1,11 @@ +;; -*- no-byte-compile: t; -*- +;;; ui/window-select/packages.el + +(cond ((featurep! +switch-window) + ;; Install switch-window if the user indicated the '+switch-window' module flag + (package! switch-window)) + ((or (featurep! +ace-window) t) + ;; Install ace-window if the user selects the flag '+ace-window' or by default + ;; ... if the user did not specify a module flag + (package! ace-window))) +