summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-28 22:11:26 +0200
committerThanos Apollo <[email protected]>2024-01-28 22:11:26 +0200
commitfdd60578bd30df160150e310e111191fa380ccae (patch)
treedbe7e5913cb516279d0fb9be273949a99b4b0313 /.emacs.d
parente0a613267f0bb2459b1de1a659e730e212fa144c (diff)
emacs:(commands) Add thanos/input-methods
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/modules/thanos-commands.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/.emacs.d/modules/thanos-commands.el b/.emacs.d/modules/thanos-commands.el
index 7dba0c7..3cb0f8c 100644
--- a/.emacs.d/modules/thanos-commands.el
+++ b/.emacs.d/modules/thanos-commands.el
@@ -232,6 +232,31 @@
(replace-regexp-in-string "\\.json" ".m3u8" url) name)
nil 0)))))
+;; Input methods
+(defvar thanos/input-methods
+ '("greek" "bulgarian-phonetic" "nil")
+ "List of input methods to toggle.")
+
+(defvar thanos/input-methods-index 0
+ "Index of the next input method in `thanos/input-methods' to use.")
+
+(defun thanos/toggle-input-method ()
+ "Switch to the next input method in `thanos/input-methods'."
+ (interactive)
+ (setf thanos/input-methods-index
+ (mod (1+ thanos/input-methods-index) (length thanos/input-methods)))
+ (let ((input-method (nth thanos/input-methods-index thanos/input-methods)))
+ (set-input-method (if (string= "nil" input-method) nil input-method))))
+
+(defun thanos/toggle-input-method ()
+ "Switch to the next input method in `thanos/input-methods'."
+ (interactive)
+ (setf thanos/input-methods-index
+ (mod (1+ thanos/input-methods-index) (length thanos/input-methods)))
+ (let ((input-method (nth thanos/input-methods-index thanos/input-methods)))
+ (set-input-method (if (string= "nil" input-method) nil input-method))))
+
+(define-key global-map (kbd "C-\\") #'thanos/toggle-input-method)
(provide 'thanos-commands)
;;; thanos-commands.el ends here