0

Good day,

I am struggling with remapping the space key functionality. In particular, when I am using emacs with the evil mode I want to be able to use space when moving around in normal mode. I would like to map insert whitespace to M-SPC. However, since there seems to be no function for inserting space I don't know how to make it work. Your help is appreciated.

1 Answer 1

1

You can use kbd for defining the keybinding. You can look up the string that kbd expects by using C-h k M-SPC. Subsequently, you can just use the insert function inside a command to insert some string. A command is just a function starting with an interactive special form.

Finally, you can either define your custom named command and bind that, or use an anonymous command directly as follows:

(evil-global-set-key 'normal (kbd "M-SPC") (lambda () (interactive) (insert " "))) 
1
  • Wow, this is genius, this works right of the scratch. Commented Jun 12, 2022 at 12:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.