#StackBounty: #key-bindings #python #indentation #shell How to define global keybinding for `C-c >` and `C-c <` using defhydra

Bounty: 50

I am trying to apply following solutions’s keybinding to overwrite all mode’s keybindings for C-c > and C-c <.


From the answer for Can we do C-c > and > and > to continue indentation:

(defhydra python-indent (global-map "C-c")
  "Adjust python indentation."
  (">" python-indent-shift-right "right")
  ("<" python-indent-shift-left "left"))

which works for the python-mode; but it does not overwrite into thhe global bindings and such as in shell-mode, its bind remain as to sh-learn-line-indent.

Is there any way to force to overwrite the keybinding for C-c > and C-c <?


I have also tried following with the help of (https://emacs.stackexchange.com/a/68029/18414), which did not work:

(with-eval-after-load "sh-script"
    (defhydra python-indent (sh-mode-map "C-c")
      (">" python-indent-shift-right "right")
      ("<" python-indent-shift-left "left"))


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.