2024-01-23 08:01:12 -09:00
|
|
|
;;; 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:
|
2024-01-23 08:01:12 -09:00
|
|
|
(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."
|
2022-10-10 12:16:37 -08:00
|
|
|
;; 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
|
2024-01-23 08:01:12 -09:00
|
|
|
(defun mir/search-and-rebalance (&optional &rest flush)
|
2023-03-13 14:47:06 -08:00
|
|
|
(evil-scroll-line-to-center (car flush)))
|
2024-01-23 08:01:12 -09:00
|
|
|
(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 ()
|
2024-01-23 21:17:35 -09:00
|
|
|
"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...
|
2024-01-23 08:01:12 -09:00
|
|
|
(provide 'mir-defuns)
|
2022-06-19 14:13:36 -08:00
|
|
|
|
2024-01-23 08:01:12 -09:00
|
|
|
;;; mir-defuns.el ends here
|