emacs/lisp/mir-evil.el

129 lines
3.7 KiB
EmacsLisp

;;; mir-evil.el --- personal settings for evil-mode -*- lexical-binding: t; -*-
;; Copyright (C) 2023 mir
;; Author: mir <mir@marq42.xyz>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; put here because git branches are hard
;;; Code:
(use-package evil
:general
;; Visual lines. Redefined for auto-scrolling madness.
(general-define-key
:states 'normal
"<escape>" 'evil-beginning-of-line
"j" 'evil-next-visual-line
"k" 'evil-previous-visual-line
"C-n" 'move-screen-up-line
"C-p" 'move-screen-down-line)
(general-define-key
:states 'insert
"C-w" 'evil-window-map
"C-V" (general-key-dispatch
'evil-quoted-insert
"u" 'insert-char))
:diminish visual-line-mode
:custom
(echo-keystrokes 0.5)
(evil-want-integration t)
(evil-want-keybinding nil)
(evil-want-C-u-scroll nil)
(evil-want-C-i-jump nil)
;; (evil-vsplit-window-right t)
;; (evil-split-window-below t)
(evil-undo-system
(if (>= (string-to-number emacs-version) 28)
(quote undo-redo)
(quote undo-fu)))
:init (evil-mode t)
:config (mir/evil-config)
(advice-add #'evil-line-move :around
(lambda (orig &rest args)
(ignore-errors
(apply orig args)))))
(use-package evil-collection
:after evil
:diminish evil-collection-unimpaired-mode
:config (evil-collection-init))
(use-package evil-commentary
:after evil
:diminish 'evil-commentary-mode
:config (evil-commentary-mode)
:hook (prog-mode . evil-commentary-mode))
(use-package evil-surround
:after evil
:diminish 'global-evil-surround-mode
:hook (prog-mode . evil-surround-mode)
:config (global-evil-surround-mode 1))
(use-package evil-matchit
:after evil
:diminish 'evil-matchit-mode
:config (global-evil-matchit-mode 1))
(use-package evil-terminal-cursor-changer
:after evil
:diminish
:if (not (display-graphic-p))
:custom
(evil-motion-state-cursor 'box) ; █
(evil-visual-state-cursor 'box) ; █
(evil-normal-state-cursor 'box) ; █
(evil-insert-state-cursor 'bar) ; ⎸
(evil-emacs-state-cursor 'hbar) ; _
:config
(evil-terminal-cursor-changer-activate)
(xterm-mouse-mode))
(use-package evil-goggles
:diminish
:after evil
:init (evil-goggles-mode)
:custom-face
(evil-goggles-default-face
((t (:background "#303030" :foreground "#2233aa")))))
;; edwina window manager, like the kool kids
(use-package edwina
;; :after evil
:custom
(edwina-mfact 0.59)
;; (display-buffer-base-action '(display-buffer-below-selected))
:init
(advice-add 'balance-windows
:override 'edwina-arrange)
(add-hook 'server-after-make-frame-hook #'edwina-arrange)
(add-hook 'after-init-hook #'edwina-arrange)
(add-hook 'elpaca-after-init-hook #'edwina-arrange)
:config
(edwina-mode)
(edwina-arrange)
:general
(general-define-key
[remap split-window-right] 'edwina-clone-window
[remap evil-window-move-far-left] 'edwina-zoom
[remap evil-window-move-far-right] 'edwina-zoom
[remap evil-window-increase-height] 'edwina-inc-mfact
[remap evil-window-decrease-height] 'edwina-dec-mfact
[remap balance-windows] 'edwina-arrange))
(provide 'mir-evil)
;;; mir-evil.el ends here