[Tutor] OT (probably): How to change default tab key value to 4 spaces in GNOME Terminal?

boB Stepp robertvstepp at gmail.com
Sun Apr 26 15:40:02 EDT 2020


On Sun, Apr 26, 2020 at 4:18 AM Peter Otten <__peter__ at web.de> wrote:
>
> Peter Otten wrote:
>
> > With readline you can do
> >
> > import readline
> > readline.parse_and_bind("TAB: '    '")
>
> The moment I sent that suggestion I had a clever idea (I thought): Change
> Python's completer to insert 4 spaces if there's no text to complete yet.
>
> But then I saw that this is already implemented for interpreters newer than
> my aging default 3.4:
>
> [rlcomplete.py]
>         if not text.strip():
>             if state == 0:
>                 if _readline_available:
>                     readline.insert_text('\t')
>                     readline.redisplay()
>                     return ''
>                 else:
>                     return '\t'
>
> You might try replacing the '\t's with '    ' though.

Do you mean replace "\t" within rlcomplete.py?


-- 
boB


More information about the Tutor mailing list