Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support wrapping `evil-execute-in-god-state'. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support wrapping `evil-execute-in-god-state'. #8

wants to merge 1 commit into from

Conversation

fishyfriend
Copy link

This PR makes it possible to wrap evil-execute-in-god-state in another command.

God state's post-command hook checks the name of the last-run command to know whether to exit the state. If I wrap evil-execute-in-god-state inside another command, the last-run command is no longer evil-execute-in-god-state, but rather the name of the command that wraps it. This would break the check as it currently exists. So I have simply updated evil-execute-in-god-state to set the name of the current command in a variable. The check now looks at this variable instead of hardcoding the command name.

I am currently using this feature to make normal-mode keybindings usable via God state. So I can have , bound to regular evil-execute-in-god-state and ' bound to this:

(defun evil-execute-in-god-state-with-evil-bindings ()
  (interactive)
  ;; evil-god-set-transient-bindings sets up an Evil intercept keymap
  ;; that makes the specified keybindings available in god state.
  ;; elsewhere i ensure the intercept map is cleaned up after leaving the state.
  (evil-god-set-transient-bindings
   (make-composed-keymap (current-active-maps)))
  (evil-execute-in-god-state))

Happy to share the full code for the above but it's dirty so not posting for the moment. Perhaps will make another PR for it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant