3

Tab completion in IPython is practically unusable because the text is so difficult to read.

enter image description here

Here's what I've tried:

  1. I didn't have an ipython configuration file so I created one: ipython profile create.
  2. In my ipython_config.py I set c.InteractiveShell.colors = 'NoColors'. That made all my text white but the completion text didn't change.

enter image description here

I'm using the following software:

  • kitty terminal: 0.14.1
  • IPython: 7.5.0
  • Pygments: 2.4.2
  • prompt-toolkit: 2.0.9
Jacques Kvam
  • 2,856
  • 1
  • 26
  • 31

1 Answers1

9

I found a solution. It seems my terminal is using 24bit color and that must be interacting poorly with the defaults of IPython which defaults to 256 colors. You can test your terminal with this command:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"

If you see 'TRUECOLOR', then your terminal supports true color.

I set that in my ipython_config.py file: c.TerminalInteractiveShell.true_color = True. Now the completion text is readable.

enter image description here

Jacques Kvam
  • 2,856
  • 1
  • 26
  • 31
  • 1
    Thanks for sharing the answer totally works. Just for future reference the file is: ~/.ipython/profile_default/ipython_config.py – danielfrg Feb 28 '21 at 02:34
  • See also https://stackoverflow.com/a/49760043. You can create the config with defaults via `ipython profile create`. Or at least have a `c = get_config()` at the top of a manually created empty `ipython_config.py`. – henrywallace Apr 11 '23 at 01:14