7

How can I bind an f-key using jwiegley's use-package package? Any of these combinations produces an error:

 :bind ("f11" . multi-term)
 :bind (<f11> . multi-term)
 :bind ([f11] . multi-term)

(Of course, this falls under the scope of a use-package declaration.)

8

You need to quote "<f11>", like this:

:bind ("<f11>" . multi-term)

And here's a full example, with ace-jump-mode:

(use-package ace-jump-mode
         :commands ace-jump-mode
         :init
         :bind ("<f7>" . ace-jump-mode))
| improve this answer | |
  • 2
    Just for the record, ace-jump-mode is autoloaded, so this code is equivalent to a single global-set-key. – Malabarba Nov 26 '14 at 11:20
1

I just wanted to say that there's value in top-level global-set-key statements. In the screenshot below, I'm able to jump around my Emacs config, including jumping to global-set-key statements. You can see that it matches just ace in all my config files.

And one more thing: many commands, such as ace-jump-mode are autoloaded so you can just bind them without require or use-package.

enter image description here

The function to jump is lispy-goto from lispy.

| improve this answer | |
  • Two tangential remarks : (i) I like use-package because it helps grouping all related settings in one place, so I use it even when not strictly needed. (ii) Even when not using use-package, you can also use bind-key directly. This makes M-x describe-personal-keybindings RET a useful command. – YoungFrog Nov 26 '14 at 12:31

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.