Refactor/revise ui/window-select
And bind SPC w C-w (or C-w C-w) to other-window.
This commit is contained in:
parent
815fc6ef02
commit
58573a0ce7
3 changed files with 56 additions and 34 deletions
|
@ -320,7 +320,7 @@
|
||||||
"C-j" #'evil-window-down
|
"C-j" #'evil-window-down
|
||||||
"C-k" #'evil-window-up
|
"C-k" #'evil-window-up
|
||||||
"C-l" #'evil-window-right
|
"C-l" #'evil-window-right
|
||||||
"C-w" #'ace-window
|
"C-w" #'other-window
|
||||||
;; Swapping windows
|
;; Swapping windows
|
||||||
"H" #'+evil/window-move-left
|
"H" #'+evil/window-move-left
|
||||||
"J" #'+evil/window-move-down
|
"J" #'+evil/window-move-down
|
||||||
|
|
|
@ -2,22 +2,44 @@
|
||||||
|
|
||||||
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.
|
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
|
* Table of Contents :TOC:
|
||||||
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~.
|
- [[#install][Install]]
|
||||||
|
- [[#module-flags][Module flags]]
|
||||||
|
- [[#usage][Usage]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#ace-window][ace-window]]
|
||||||
|
- [[#switch-window][switch-window]]
|
||||||
|
|
||||||
* Customization
|
* Install
|
||||||
There are two packages that accomplish the same but with a different visual queue.
|
Add =:feature lookup= to your init.el.
|
||||||
|
|
||||||
|
** Module flags
|
||||||
|
This module provides two flags:
|
||||||
|
|
||||||
|
+ ~+ace-window~ Use avy (and ace-window) as the backend.
|
||||||
|
+ ~+switch-window~ Use switch-window as the backend.
|
||||||
|
|
||||||
|
If neither flag is specified, ~+ace-window~ will be used.
|
||||||
|
|
||||||
|
* Usage
|
||||||
|
This module remaps the function ~other-window~ to either ~switch-window~ or
|
||||||
|
~ace-window~, depending on which backend you've enabled.
|
||||||
|
|
||||||
|
~other-window~ is bound to ~C-x o~ and ~SPC w o~.
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
This module provides two backends, both providing the same functionality, but
|
||||||
|
with different visual cues. They are =ace-window= and =switch-window=.
|
||||||
|
|
||||||
** ace-window
|
** ace-window
|
||||||
The first character of the buffers change to a user selectable character.
|
The first character of the buffers changes to a highlighted, user-selectable
|
||||||
|
character.
|
||||||
|
|
||||||
+ Pros: The content of the buffers are always visible.
|
+ Pros: The content of the buffers are always visible.
|
||||||
+ Cons: The displayed characters are small and difficult to see.
|
+ 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
|
** switch-window
|
||||||
The entire buffer is replaced by big letters than enable the user to easily select a desired window.
|
Replaces the entire buffer with large letters.
|
||||||
+ 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))~
|
+ Pros: The displayed characters are /really/ easy to see.
|
||||||
|
+ Cons: You can't see the contents of the buffers.
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
;;; ui/window-select/config.el -*- lexical-binding: t; -*-
|
;;; ui/window-select/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(cond ((featurep! +switch-window)
|
(cond
|
||||||
;; Configure switch-window if that flag is found
|
((featurep! +switch-window)
|
||||||
(def-package! switch-window
|
(def-package! switch-window
|
||||||
:commands (switch-window switch-window-then-maximize switch-window-then-split-below
|
:commands (switch-window switch-window-then-maximize switch-window-then-split-below
|
||||||
switch-window-then-split-right switch-window-then-delete
|
switch-window-then-split-right switch-window-then-delete
|
||||||
switch-window-then-swap-buffer)
|
switch-window-then-swap-buffer)
|
||||||
:init
|
:init
|
||||||
(setq switch-window-shortcut-style 'qwerty
|
(define-key global-map [remap other-window] #'switch-window)
|
||||||
switch-window-qwerty-shortcuts '("a" "s" "d" "f" "g" "h" "j" "k" "l"))
|
:config
|
||||||
;; Redefine how we switch windows with switch-window
|
(setq switch-window-shortcut-style 'qwerty
|
||||||
(define-key global-map [remap other-window] #'switch-window)))
|
switch-window-qwerty-shortcuts '("a" "s" "d" "f" "g" "h" "j" "k" "l"))))
|
||||||
((or (featurep! +ace-window) t)
|
|
||||||
;; Configure ace-window if that flag or no flag is found
|
((or (featurep! +ace-window) t) ; default to ace-window
|
||||||
(def-package! ace-window
|
(def-package! ace-window
|
||||||
:commands (ace-window ace-swap-window ace-delete-window
|
:commands (ace-window ace-swap-window ace-delete-window
|
||||||
ace-select-window ace-delete-other-windows)
|
ace-select-window ace-delete-other-windows)
|
||||||
:init
|
:init
|
||||||
(define-key global-map [remap other-window] #'ace-window)
|
(define-key global-map [remap other-window] #'ace-window)
|
||||||
:config
|
:config
|
||||||
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||||
aw-scope 'frame
|
aw-scope 'frame
|
||||||
aw-background t))))
|
aw-background t))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue