No color in vi when called from python script

When I edit the file with vi, like:

vi .bashrc 

I have colors.

When in a python script I have:

 os.system("vi .bashrc") 

I dont know.

Why (I assume that I open another shell, but I can’t understand why the settings are different)? And how to solve it?

I am running Fedora, and my shell is bash.

 vi --version 

gives:

 VIM - Vi IMproved 7.3 
+7
source share
1 answer

I assume this is because you have a vim alias, so calling vi .bashrc from bash means vim .bashrc

os.system has no information about your aliases, so it invokes the vi editor with color highlighting

+5
source

All Articles