dotfiles/emacs/.emacs.modular/config/init-windows.el

39 lines
1.0 KiB
EmacsLisp
Raw Normal View History

;; Window-related configuration
;; winum-mode allows selecting windows by number
(use-package winum
:config
(winum-mode)
:custom
(winum-scope 'frame-local))
;; winner-mode lets you undo and redo changes to the window layout
(winner-mode 1)
;; Keybindings
(leader-def-key
"0" #'winum-select-window-0-or-10
"1" #'winum-select-window-1
"2" #'winum-select-window-2
"3" #'winum-select-window-3
"4" #'winum-select-window-4
"5" #'winum-select-window-5
"6" #'winum-select-window-6
"7" #'winum-select-window-7
"8" #'winum-select-window-8
"9" #'winum-select-window-9
"w" '(nil :which-key "window")
"w/" #'split-window-horizontally
"w-" #'split-window-vertically
"wm" #'delete-other-windows
"wd" #'delete-window
"wp" #'winner-undo
"wn" #'winner-redo)
;; Condense the which-key display for window selection bindings
(push '(("\\(.*\\) 0" . "select-window-0") . ("\\1 0..9" . "window 0..9"))
which-key-replacement-alist)
(push '((nil . "select-window-[1-9]") . t) which-key-replacement-alist)
(provide 'init-windows)