-
In code, how can I query Lem to see if it's in vi-mode or not? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You can use |
Beta Was this translation helpful? Give feedback.
-
Switch Between Emacs and Vi Modes QuicklyHere's something similar in the spirit to evil's C-z which toggles evil's emacs state. I put it on Ctrl-Shift-Z in Lem, because Ctrl-z was already taken by a bunch of frame commands. It's useful in situations where something doesn't work well in vi-mode, and you need to quickly switch to emacs-mode. (in-package :lem-user)
(import 'lem:define-command)
(define-command toggle-between-emacs-and-vi () ()
(let ((mode (lem:current-global-mode)))
(if (typep mode 'lem-vi-mode/core:vi-mode)
(lem-core::emacs-mode)
(lem-vi-mode/core:vi-mode))))
(define-key *global-keymap* "C-Z" 'toggle-between-emacs-and-vi) |
Beta Was this translation helpful? Give feedback.
-
related: to change vi mode's state we can do (lem-vi-mode:change-state 'lem-vi-mode:insert) |
Beta Was this translation helpful? Give feedback.
You can use
(lem:current-global-mode)