This is my elpy-config

 1Elpy Configuration                                                                                                                                       
 3Virtualenv........: None                                                                                                                                 
 4RPC Python........: 3.7.3 (/usr/bin/python3)                                                                                                             
 5Interactive Python: /usr/bin/python3 (/usr/bin/python3)                                                                                                  
 6Emacs.............: 26.1                                                                                                                                 
 7Elpy..............: 1.28.0                                                                                                                               
 8Jedi..............: 0.17.2                                                                                                                               
 9Rope..............: Not found                                                                                                                            
10Autopep8..........: 1.5.3                                                                                                                                
11Yapf..............: Not found                                                                                                                            
12Black.............: Not found                                                                                                                            
13Syntax checker....: flake8 (/usr/local/bin/flake8)     

It runs on Debian 10.

When typing TAB nothing happens. No message. No change in the mode line or status line.

Is it default that elpy do not work with TAB and why?

How can I turn this on?

EDIT: I expect 4 empty chars when typing TAB.

EDIT2: M-x describe-key <kbd>TAB</kbd> results in

TAB (translated from <tab>) runs the command evil-jump-forward (found in
evil-motion-state-map), which is an interactive compiled Lisp function in

It is bound to TAB.

(evil-jump-forward &optional COUNT)

Go to newer position in jump list.
To go the other way, press C-o.

I have evil-mode installed and activated. So there must be a reason why TAB is used by evil-mode but do not work.

3 Answers 3


I'm not sure but probably one of your minor modes overrides the TAB key.

You can find the bound function via M-x describe-key and TAB. Default should be indent-for-tab-command. If it is not, you should find which minor mode overrides the TAB binding (you can probably understand using describe-key) and unbind it on the minor-mode keymap or rebind TAB to indent-for-tab-command.

ex: https://stackoverflow.com/a/14316669/7216840

  • Thanks for your hint. I updated my question with new information's.
    – buhtz
    Nov 1, 2020 at 12:58

This answer is based on this evil-mode mailinglist post

Short answer: This is expected behavior.

Long answer: In python-mode (and elpy), when you start typing, hitting TAB will not do anything, presumably preventing you from accidental TAB inserts which will trigger errors in Python interpreter. The other way arround TAB results in a "Tab" (e.g. 4 chars) in cases where it is allowed in python context.

e.g. type this two lines

def foo():

after hitting RET the cursor jumps in the next (3rd) line but at the first character/column. Now you are "allowed" to hit TAB and it works as expected: A "Tab" (4 empty chars) are inserted. Hitting TAB again is like pressing BACKSPACE: The "Tab" is deleted and the cursor is back at column 1.

However, if you want to insert TAB forcefully see the section Indentation Controlled by Major Mode in the emacs-documentation. E.g. setting (setq tab-always-indent nil) will force TAB to be inserted, but will also adjust other indentation.

However, if you want vi-like TAB behavior with evil-mode, python and without too much of TAB science, set this in your init file:

(define-key evil-insert-state-map (kbd "TAB") 'tab-to-tab-stop)

If you are keen to look further for customization, check The Ultimate Guide To Indentation in Emacs.

  • Or you could like, customize evil-want-C-i-jump and Evil will stop interfering with TAB completely, exposing you to the mess that configuring indentation is.
    – wasamasa
    Nov 3, 2020 at 22:47
  • Sorry, but I still do not understand the evil-want-C-i-jump thing. I think miss some background/basic knowledge here. Even the docu doesn't help me.
    – buhtz
    Nov 4, 2020 at 7:44

Evil faithfully emulates Vim, including the part of C-i and C-o being bound in normal state to commands going through the jump list. C-i happens to be equivalent to TAB for reasons (hello terminals), so another thing you'll observe is it being bound in insert state to something else, like an indentation command. If you dislike that behavior, you've got two options:

  • Sorry, I do not understand anything.
    – buhtz
    Nov 2, 2020 at 21:19
  • If you don't understand what normal/insert states are, I recommend reading Evil's manual first.
    – wasamasa
    Nov 2, 2020 at 21:57
  • I understand the vi-states of course. Using vim science over 20 years. I do not see the logic behind C-i and TAB.
    – buhtz
    Nov 3, 2020 at 7:20
  • OK, so you do understand that part at least. C-i and TAB are considered the same in terminals and Emacs pretends it's running in one, even when in graphical mode. See catern.com/posts/terminal_quirks.html and garbagecollected.org/2017/01/31/four-column-ascii for a detailed explanation of the former.
    – wasamasa
    Nov 3, 2020 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.