1

How to change the SPC m c (org-capture) key binding to open the ~/capture.org file instead?

F-5 opens file when this is in .spacemacs file:

(global-set-key (kbd "<f5>") (lambda() (interactive)(find-file "~/capture.org")))

My failed attempt to bind SPC m c:

(global-set-key (kbd "SPC m c") (lambda() (interactive)(find-file "~/capture.org")))

got this error:

Key sequence `SPC m c` starts with non-prefix key `SPC`

I am using Emacs 25.2.1 with Evil Spacemacs and Ivy on Linux.

4
  • 1
    Please go into more detail than "did not open file" and describe what exactly happened. Did Emacs display an error in the echo area?
    – wasamasa
    Jul 2, 2017 at 13:37
  • <f6> was bound to ivy-resume. Changing the binding to <f5> fixed it, so now file opens. I updated the question.
    – wolfv
    Jul 2, 2017 at 14:08
  • See function define-prefix-command and, more generally, (elisp) Prefix Keys.
    – Drew
    Jul 2, 2017 at 15:07

2 Answers 2

3

This binds SPC m c to opening the ~/capture.org file:

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

The spacemacs manual explains how spacemacs/set-leader-keys works: https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.org#binding-keys

1

You might be looking for the bookmark feature.

On vanilla emacs, C-x r m will bookmark the current file, and C-x r b will let you choose from a list of bookmarked files. It's amazingly useful

1
  • Not what the question was asking for, but I found it useful nonetheless. +1 Jan 5 at 15:06

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.