-
Notifications
You must be signed in to change notification settings - Fork 52
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
Rebind more commands than just self-insert-command #49
Comments
Even if you decide against god mode remapping more commands, a note in the readme showing how to do this would be really helpful. It took me a wee while to work out, so I'm sure it'd help others too! (Thanks for making god mode by the way, only been using it a few days but I'm really liking it so far!) |
I've had to remap some things too, like |
Ideally god-mode could work in a different way to solve this problem more generally, but I have no idea how to implement that -- I love the idea behind god-mode but it sometimes acts a bit weirdly and sometimes you still need to use ctrl. (For C-g if nothing else, but also sometimes for other things like C-/ in C-mode if you haven't remapped it specifically.) |
Based on this Stackoverflow answer I added this to my god-mode-enabled-hook and it appears to solve this issue. Basically it just makes sure that the god-mode local map is always first in the list of minor mode key maps. (defun god-has-priority ()
"Try to ensure that god mode keybindings retain priority over other minor modes."
(unless (and (consp (car minor-mode-map-alist))
(eq (caar minor-mode-map-alist) 'god-local-mode-map))
(let ((godkeys (assq 'god-local-mode minor-mode-map-alist)))
(assq-delete-all 'god-local-mode minor-mode-map-alist)
(add-to-list 'minor-mode-map-alist godkeys)))) |
In the Emacs Lisp manual I read that First, it could solve what the previously suggested adding of Second, it could help to get God mode in command state of Viper mode (vi emulation). Currently the second is not possible because the keymaps of Viper mode are in (add-to-ordered-list 'emulation-mode-map-alists 'god-local-mode-map 50) and it added |
The following solution has worked for me in evil-mode/evil-god-state, but should be adaptable generally:
|
Some modes bind some keys to functions other than self-insert-command. This is so that they can do something clever as well as insert the character. eg. in c-mode "/" is bound to c-electric-slash. This means that when in god-mode, pressing these keys will still insert the character instead of doing C-key.
I have these workarounds in my init.el:
This appears to have been encountered by people before (tickets #16 and #41). I'd imagine that "/" doing c-electric-slash instead of undo is a common problem. Perhaps it would be sensible to have a customisable list of commands god-mode should remap, and maintain a default list (which people are encouraged to submit pull requests to modify, like for god-exempt-major-modes).
Or perhaps not, in which case feel free to close and I'll just stick with remapping some commands myself.
The text was updated successfully, but these errors were encountered: