I would like to set a projectile find file function to the hotkey C-e, and a elpy-goto-definition function to the hotkey F12, but I'm not sure why spacemacs is not recognizing the config that I'm trying to set. Here's my config:

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (global-set-key "f12" 'elpy-goto-definition)
  (global-set-key (kbd "C-e") 'projectile-find-file))

I've tried various combinations of these. I've read that global keys have low priority, maybe this is why, but I feel a leader key is not the correct option.

2 Answers 2


The reason that the global set key was not working for f12 was because I needed the line to look like

(global-set-key [f12] 'elpy-goto-definition)

and the other line, configuring projectile's find-file function was not working because I simply had to manually enable projectile on startup by running projectile-mode


You can define also like that

(global-set-key (kbd "<f12>") 'it-works)
(defun it-works ()
  (message "It works"))

If you want to define more specific keys, please, look at the link which is below.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.