I want to create a minor mode to resize windows in emacs, like the resize mode of i3. I try many things, but evil shortcuts always override my minor mode...

My minor mode:

(defvar my-window-resize-mode-map
  (let ((m (make-sparse-keymap)))
    (evil-define-key 'normal m (kbd "h") 'shrink-window-horizontally)
    (evil-define-key 'normal m (kbd "k") 'enlarge-window)
    (evil-define-key 'normal m (kbd "j") 'shrink-window)
    (evil-define-key 'normal m (kbd "l") 'enlarge-window-horizontally)
    (evil-define-key 'normal m (kbd "M-r") 'window-resize-mode)

(define-minor-mode my-window-resize-mode
  :initial-value nil
  :lighter " Window-resize-mode"
  :keymap my-window-resize-mode-map)

(add-to-list 'emulation-mode-map-alists
         `((my-window-resize-mode . ,my-window-resize-mode-map)))

(provide 'my-window-resize-mode)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.