1

I'd like to know how to indent multiple lines while Python is my major mode. The link below answers my question for the most part:

https://stackoverflow.com/questions/2585091/emacs-bulk-indent-for-python

However, is there a way to accomplish this while you have the following line in your .emacs file?

(cua-mode t)

When I attempt C-c > while cue-mode is enabled, nothing happens.

  • 1
    C-h k C-c > when cua-mode is not enabled, to find out what the command is. Then bind that command to some other key (globally or only in cua-mode). – Drew Mar 20 '17 at 4:33
3

There are a couple of ways to do this. The documentation for cua-mode (which can be accessed with C-h f cua-mode) says you have three options:

  • press the prefix key twice very quickly (within 0.2 seconds),
  • press the prefix key and the following key within 0.2 seconds, or
  • use the SHIFT key with the prefix key, i.e. C-S-x or C-S-c.

Alternatively, as others have said, just make your own binding for the python-indent-shift-left and python-indent-shift-right commands.

0

Binding it in use-package worked for me:

(use-package python
  :mode ("\\.py\\'" . python-mode)
  :bind (:map  python-mode-map
         ("C->" . python-indent-shift-right)
         ("C-<" . python-indent-shift-left))

;; more config...

)

The three options described by @stevoooo did not work when I had a region selected.
And I personally do not find practical to type in the 0.2 second range.

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.