2

I have rebound "SPC m c" so it opens a file (from How to a create keybinding to open a particular file?):

(spacemacs/set-leader-keys "mc" (lambda () (interactive) (find-file "~/capture.org")))

And it opens the file as intended, because spacemacs/set-leader-keys is for binding with the leader key SPC.

Now I want to bind the same thing to ", c". How to bind a key when the leader key is comma?

I am using Emacs 25.2.1 with Evil Spacemacs on Linux.

UPDATE_1

I put this in ~/.spacemacs but then Emacs would say "Spacemacs encountered an error while loading your ~/.spacemacs file.":

(define-key evil-normal-state-map ",c" (lambda () (interactive) (find-file "~/capture.org")))

I put this in ~/.spacemacs but it had no effect (", c" opened agenda dispatcher as usual):

(with-eval-after-load 'evil-maps
  (define-key evil-normal-state-map ",c" (lambda () (interactive) (find-file "~/capture.org"))))
2

You can install evil-leader package and create your own leader apart from SPC. Or you can use

(define-key evil-normal-state-map (kbd ", m c") 'command)

ps: check the quotes, I am not sure about them

  • I attempted this with the ",mc" key sequence bound to (lambda () (interactive) (find-file "~/capture.org")). See the attempt in question's UPDATE_1. – wolfv Jul 9 '17 at 16:21
  • I tried it as well. But it works well for me. Check if you have any other commands for the same key binding – Harindu Dilshan Jul 9 '17 at 17:14
  • Default Evil Spacemacs ",c" keybinding is org-capture. So that could could be a conflict. Are you using Evil Spacemacs? – wolfv Jul 9 '17 at 22:30
  • yeah I am using evil spacemacs and I haven't enabled org layer. Check the org layer config and try to override it. – Harindu Dilshan Jul 10 '17 at 1:16
  • Where is ""org layer config"? Google did not find it. – wolfv Jul 10 '17 at 6:20
2

Assuming you have changed the SPC to , already. M-m is the other name for spacemacs/set-leader-keys

(define-key evil-normal-state-map (kbd "M-m c") (lambda () (interactive) 
(find-file "~/capture.org")))
  • "these kinds of questions" what? Please explain. I am new to Emacs and the Emacs community and want to use the appropriate forum. – wolfv Aug 9 '17 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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