;;; mir-meow.el --- my meow settings -*- lexical-binding: t; -*- ;; Copyright (C) 2023 mir ;; Author: mir ;; 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 . ;;; Commentary: ;; Extracted from ./mir-packages.el because maintaining separate git branches ;; is too hard. ;;; Code: (use-package meow :custom (meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) (meow-keypad-self-insert-undefined nil) :init ;; (require 'esc-intercept) ;; Visual moving (defun move-screen-down-line () "Scroll down line but keep cursor in same visual position." (interactive) (meow-prev 1) (scroll-down-line)) (defun move-screen-up-line () "Scroll up line but keep cursor in same visual position." (interactive) (meow-next 1) (scroll-up-line)) ;; actual setup function (defun meow-setup () (interactive) ;; this line cost me days of confusion ;; (define-key key-translation-map (kbd "ESC") (kbd "")) ;; (define-key meow-insert-state-keymap (kbd "ESC") (kbd "")) ;; (evil-esc-mode 100) (meow-motion-overwrite-define-key '("j" . meow-next) '("k" . meow-prev) ;; '("ESC" . mir/meow-esc-dwim) ) (meow-leader-define-key ;; SPC j/k will run the original command in MOTION state. '("j" . "H-j") '("k" . "H-k") ;; Use SPC (0-9) for digit arguments. '("1" . meow-digit-argument) '("2" . meow-digit-argument) '("3" . meow-digit-argument) '("4" . meow-digit-argument) '("5" . meow-digit-argument) '("6" . meow-digit-argument) '("7" . meow-digit-argument) '("8" . meow-digit-argument) '("9" . meow-digit-argument) '("0" . meow-digit-argument) '("/" . meow-keypad-describe-key) '("?" . meow-cheatsheet) '("g" . magit)) ;; (meow-define-keys ;; 'insert ;; '("ESC" . mir/meow-esc-dwim)) ;; (meow-define-keys ;; 'beacon ;; '("ESC" . mir/meow-esc-dwim)) (meow-normal-define-key '("0" . meow-expand-0) '("9" . meow-expand-9) '("8" . meow-expand-8) '("7" . meow-expand-7) '("6" . meow-expand-6) '("5" . meow-expand-5) '("4" . meow-expand-4) '("3" . meow-expand-3) '("2" . meow-expand-2) '("1" . meow-expand-1) '("-" . negative-argument) '(";" . meow-reverse) '("," . meow-inner-of-thing) '("." . meow-bounds-of-thing) '("[" . meow-beginning-of-thing) '("]" . meow-end-of-thing) '("a" . meow-append) '("A" . meow-open-below) '("b" . meow-back-word) '("B" . meow-back-symbol) '("c" . meow-change) '("d" . meow-delete) '("D" . meow-backward-delete) '("e" . meow-next-word) '("E" . meow-next-symbol) '("f" . meow-find) '("g" . meow-cancel-selection) '("G" . meow-grab) '("h" . meow-left) '("H" . meow-left-expand) '("i" . meow-insert) '("I" . meow-open-above) '("j" . meow-next) '("J" . meow-next-expand) '("k" . meow-prev) '("K" . meow-prev-expand) '("l" . meow-right) '("L" . meow-right-expand) '("m" . meow-join) '("n" . meow-search) '("o" . meow-block) '("O" . meow-to-block) '("p" . meow-yank) '("q" . meow-quit) '("Q" . meow-goto-line) '("r" . meow-replace) '("R" . meow-swap-grab) '("s" . meow-kill) '("t" . meow-till) '("u" . meow-undo) '("U" . meow-undo-in-selection) '("v" . meow-visit) '("w" . meow-mark-word) '("W" . meow-mark-symbol) '("x" . meow-line) '("X" . meow-goto-line) '("y" . meow-save) '("Y" . meow-sync-grab) '("z" . meow-pop-selection) '("'" . repeat) ;; '("ESC" . mir/meow-esc-dwim) )) (defun mir/meow-esc-dwim () "Escape the current search, action, or state. γ€γΎγ‚Šγ€ - When in insert mode, return to normal mode. - When in normal mode, return to beginning of line. - When region is visible, pop it. - When grabbing, ungrab." (interactive) (if (meow-keypad-mode-p) (meow-keypad-quit) (if (bound-and-true-p meow-selection) (meow-pop-selection) (if (meow-insert-mode-p) (meow-escape-or-normal-modal) (goto-char (pos-bol))))) nil) ;; (require 'esc-intercept) :config (add-to-list 'meow-mode-state-list '(eshell-mode . insert)) (add-to-list 'meow-mode-state-list '(helpful-mode . motion)) (add-to-list 'meow-mode-state-list '(magit-mode . motion)) (meow-setup) (meow-global-mode 1) (add-hook 'meow-insert-mode-hook (lambda () (setq-local evil-state 'insert))) (add-hook 'meow-normal-mode-hook (lambda () (setq-local evil-state 'normal))) (add-hook 'meow-motion-mode-hook (lambda () (setq-local evil-state 'motion))) (add-hook 'meow-beacon-mode-hook (lambda () (setq-local evil-state 'beacon))) (add-hook 'meow-keypad-mode-hook (lambda () (setq-local evil-state 'keypad))) ) (provide 'mir-meow) ;;; mir-meow.el ends here