Useful keybindings for emacs python-mode

I wrote up this keybinding the other day at work, and found that I missed it when I went home, so I wrote it again from scratch.

It allows you easily indent or undent the current region using M-left and M-right:

(global-set-key [M-left] '(lambda () (interactive)
  (save-excursion
    (py-shift-region-left (region-beginning) (region-end)))))

(global-set-key [M-right] '(lambda () (interactive)
  (save-excursion
     (py-shift-region-right (region-beginning) (region-end)))))
This entry was posted in General and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>