emacs/lisp/mir-defuns.el

37 lines
1.2 KiB
EmacsLisp

;;; mir-defuns.el --- custom-defined functions
;;; Commentary:
;; Some functions to run when loading packages...
;;; Code:
(defun mir/evil-config ()
"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))
;; Search showing
(defun mir/search-and-rebalance (&optional &rest flush)
(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))
(defun toggle-ja-input ()
"Switch between english and japanese. Not broken."
(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)
;;; mir-defuns.el ends here