nex3 / perspective-el

Perspectives for Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change key binding (but not the prefix)

dams opened this issue · comments

Hi,

Thank you for this awesome package. I'm using it with a custom prefix key (so far so good) but I'd like to change the key bindings for "next" and "prev".
I'd like to change it from "n" to "C-n"

I've seen it's definied here: https://github.com/nex3/perspective-el/blob/master/perspective.el#L288
But it doesn't seem to be customizable. Is there any way I can change these bindings without changing the package code ?

Thanks

commented

You can always override the binding after loading the package directly in your Emacs configuration. With use-package, something like this should work:

(use-package perspective
  ;; ...
  :bind (;; ...
         :map perspective-map
         ("n" . nil)
         ("C-n" . persp-next)))

Or without use-package:

(define-key perspective-map (kbd "n") nil)
(define-key perspective-map (kbd "C-n") 'persp-next)

Untested but should give you ideas about how to make it work. :) Feel free to follow up if you have trouble.

thanks !

I know this is closed, but why does using persp-mode-map rather than perspective-map not work. When I use it in use-package, it binds keys to the global key map. You say the map is persp-mode-map in the README.

commented

The README was wrong. I just changed it (4ef2613), and hope it makes more sense now. The prefix is defined in persp-mode-map, but the actual commands are in perspective-map. I'm not sure this is the cleanest solution, but changing it now will break too many people's configurations.

Thanks.