emacs/lisp/mir-defuns.el

37 lines
1.2 KiB
EmacsLisp
Raw Permalink Normal View History

;;; mir-defuns.el --- custom-defined functions
2022-06-19 14:13:36 -08:00
;;; Commentary:
2024-01-23 10:06:00 -09:00
2022-06-19 14:13:36 -08:00
;; Some functions to run when loading packages...
;;; Code:
(defun mir/evil-config ()
2022-06-19 14:13:36 -08:00
"A batch of commands to run as the :config of evil's `use-package'.
Made solely to reduce lines in the init-file."
;; Visual moving
(defun move-screen-down-line ()
"Scroll down line but keep cursor in same visual position."
(interactive)
(evil-previous-line)
(scroll-down-line))
(defun move-screen-up-line ()
"Scroll up line but keep cursor in same visual position."
(interactive)
(evil-next-line)
(scroll-up-line))
2023-03-13 14:47:06 -08:00
;; Search showing
(defun mir/search-and-rebalance (&optional &rest flush)
2023-03-13 14:47:06 -08:00
(evil-scroll-line-to-center (car flush)))
(advice-add 'evil-search-next :filter-return #'mir/search-and-rebalance)
(add-hook 'isearch-mode-end-hook #'mir/search-and-rebalance))
2022-06-19 14:13:36 -08:00
(defun toggle-ja-input ()
"Switch between english and japanese. Not broken."
2022-06-19 14:13:36 -08:00
(interactive)
(if (eq current-input-method 'japanese)
(setq current-input-method 'japanese-ascii)
(setq current-input-method 'japanese)))
;; This one line cost me over an hour of frustration...
(provide 'mir-defuns)
2022-06-19 14:13:36 -08:00
;;; mir-defuns.el ends here