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

The pyenv keybinds conflict with magit/org #35

Open
hjpotter92 opened this issue Dec 30, 2020 · 7 comments
Open

The pyenv keybinds conflict with magit/org #35

hjpotter92 opened this issue Dec 30, 2020 · 7 comments

Comments

@hjpotter92
Copy link

The key binding for C-c C-s is bound to git-commit-signoff when editing a commit message in magit, however, if we're working in a python project, the same gets overwritten by pyenv mode.

@CeleritasCelery
Copy link
Contributor

You can bind it to something else with

(setq pyenv-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c C-m") 'pyenv-mode-set)
    (define-key map (kbd "C-c C-u") 'pyenv-mode-unset)
    map))

@hjpotter92
Copy link
Author

My issue is with pyenv-mode overriding keybinds for other major modes, when it is set as a hook for python-mode only.

@CeleritasCelery
Copy link
Contributor

It is actually a global minor mode, which is why you are seeing the conflict.

@grauschnabel
Copy link

It would be great to make it only enable with python-mode and not global. It is also conflicting with org-schedule (C-c C-s) - and when I'm inside org, I'm not at all working on any python project - no need of pyenv, but projectile is on. So can we use it as python-mode hook too?

@hjpotter92 hjpotter92 changed the title The pyenv keybinds conflict with magit's commit sign-off The pyenv keybinds conflict with magit/org Feb 10, 2021
@CeleritasCelery
Copy link
Contributor

It looks like #31 was submitted to do exactly that.

@wenzlawski
Copy link

For anyone still annoyed by the overriding of keys, a workaround I've found is to delete the keymap of pyenv-mode-map and rebind the commands in the python-mode-map. One obvious downside to this is having the keys mapped permanently, whether in pyenv-mode or not, but since I use it pretty much all the time it works for me.

(use-package pyenv-mode
  :init
  (setq pyenv-mode-map
	(let ((map (make-sparse-keymap)))
	  map))
  :hook python-ts-mode python-mode
  :bind
  (:map python-ts-mode-map
	("C-c C-s" . pyenv-mode-set)
	("C-c C-u" . pyenv-mode-unset)))

@CeleritasCelery
Copy link
Contributor

I don't use pyenv-mode so I can't answer this myself, but would making this mode buffer local be the right solution? If so, we can do that.

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

4 participants