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

Unable to set keybindings #15963

Closed
Midnight1938 opened this issue Apr 3, 2023 · 3 comments
Closed

Unable to set keybindings #15963

Midnight1938 opened this issue Apr 3, 2023 · 3 comments

Comments

@Midnight1938
Copy link

Midnight1938 commented Apr 3, 2023

Unable to set custom keybindings using emacs mode, tried using the following:

  • (define-key global-map (kbd "C-c C-l") 'org-insert-link)
  • (define-key evil-emacs-state-map (kbd "C-c C-l") 'org-insert-link)
  • (global-set-key (kbd "C-c C-l") 'org-insert-link)

Also unable to change leader key to C-c

@lebensterben
Copy link
Collaborator

What do you mean by cannot set key bindings?

What do you see M-x describe-key C-c C-l?


You should not change leader key to C-c because by Emacs convention it's special. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Prefix-Keymaps.html

@Midnight1938
Copy link
Author

Midnight1938 commented Apr 8, 2023

What do you mean by cannot set key bindings?

What do you see M-x describe-key C-c C-l?

You should not change leader key to C-c because by Emacs convention it's special. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Prefix-Keymaps.html

The description states: C-c C-l is undefined

@smile13241324
Copy link
Collaborator

Basically you can set keybindings in your dotfile, you just need to hit the right keymap and you have to make sure that you don't create any issues by accessing resources which are not yet existing, if this happens your code is only partially executed and you will see no results, check your message buffer for exceptions if this happens.

Here is a small example how you would set keybindings:

(defun dotspacemacs/user-config ()
  "Configuration for user code:
This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
  (define-key global-map (kbd "C-c C-l") 'org-insert-link)
  (define-key evil-emacs-state-map (kbd "C-c C-l") 'org-insert-link)
  (global-set-key (kbd "C-c C-l") 'org-insert-link)

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

No branches or pull requests

3 participants