[Tutor] Fwd: OT (probably): How to change default tab key value to 4 spaces in GNOME Terminal?
Alex Kleider
akleider at sonic.net
Wed Apr 29 18:27:59 EDT 2020
On 2020-04-26 21:07, boB Stepp wrote:
> OK, I believe that I have a solution that I can live with.
>
> On 4/26/20 4:02 AM, Peter Otten wrote:
>> boB Stepp wrote:
>
>> With readline you can do
>>
>> import readline
>> readline.parse_and_bind("TAB: ' '")
>>
>> but then you lose tab-completion (which you don't seem to use anyway).
>> An alternative might be to keep autocompletion and bind 4-space indent
>> to
>> another key:
>>
>> readline.parse_and_bind("TAB: complete")
>> readline.parse_and_bind("C-h: ' '") # Control-h
>
> I used Peter's latter thought of binding four spaces to a key. My
> .pythonstartup file now looks like this:
Bob, (or do you prefer 'boB'?)
I didn't know there was such a thing as a .pythonstartup file
(although I see there is a .python_history file in my ~ directory.)
(I'm using Debian Stable (10 I believe it is.))
A little research took me here:
https://www.assertnotmagic.com/2018/06/30/python-startup-file/
and indicates that such a file can be called anything one would like:
$ export PYTHONSTARTUP="~/.config/pythonrc.py"
So thanks for the tip!
I'm curious to know if it is run every time the interpreter starts, even
if one is working within a virtualenv?
More information about the Tutor
mailing list