0

I really like god-mode (https://github.com/emacsorphanage/god-mode), but one thing that bothers me about it is that i use commands such as C-x k, C-x b, C-x 1 ect. all the time. It doesnt feel efficient to have to use 3 key presses in god-mode to execute them (x 'space' 'someKey').

I never use the C-q command (Quoted-insert), so How can I make the 'q' key do the equivalent of "x 'space'" when in god-mode?

I would like to be able to do the following:

q 1 === x 'space' 1 === C-x 1 === delete-other-windows

q o === x 'space' o === C-x o === other-window

ect. Without having to write a lot of individual bindings in my init.el.

Here is an excerpt from my current god-mode config:

(defcustom god-mode-alist '((nil . "C-") ;;Control ("g" . "M-") ;;Meta ("G" . "C-M-") ;;Control+Meta ("m" . "C-M-") ("z" . "s-") ;;Super ("i" . "H-") ;;Hyper ("t" . "A-") ;;Alt ("q" . "A-") ;;Alt ) "List of keys and their associated modifer." :group 'god :type '(alist)) (require 'god-mode) (god-mode) (global-set-key (kbd ";") #'god-mode-all) (global-set-key (kbd "C-;") #'god-mode-all) (global-set-key (kbd "C-'") (lambda ()(interactive)(insert-char #x3B))) ;"insert semicolon" (setq god-exempt-major-modes nil) (setq god-exempt-predicates nil) (define-key god-local-mode-map (kbd ".") #'repeat) ... (global-set-key (kbd "A-o") (kbd "C-x o")) ;other-window (global-set-key (kbd "A-b") (kbd "C-x b")) ;switch-to-buffer (global-set-key (kbd "A-u") (kbd "C-x u")) ;undo (global-set-key (kbd "A-0") (kbd "C-x 0")) ;delete-window (global-set-key (kbd "A-1") (kbd "C-x 1")) ;delete-otherwindows (global-set-key (kbd "A-2") (kbd "C-x 2")) ;split-window-below (global-set-key (kbd "A-3") (kbd "C-x 3")) ;split-window-right ... 

So right now I just bind q to the "Alt" modifier key, and then create a lot of manual bindings, which is also a sad waste of a good modifier key.

If it is possible to create a function for it, then I think I could bind the function to the q key like this: (define-key god-local-mode-map (kbd "q") #'some-function) like I did when I bound the "." key to the repeat function.

1
  • Somehow, this feels like a duplicate question... Commented Jul 25, 2021 at 14:54

1 Answer 1

0

One option is:

(with-eval-after-load "god-mode" (define-key god-local-mode-map "q" ctl-x-map)) 

That won't account for keys bound in non-global keymaps, which may or may not be an issue.

If you need this to work for arbitrary key bindings, https://emacs.stackexchange.com/a/66633/454 is an answer to a similar question, and you could use the same unread-command-events approach here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.