When I edit a file with vi like :
vi .bashrc
I have colors.
When in python's script I have :
os.system("vi .bashrc")
I don't.
Why (I'm guessing that I open a different shell but I can't figure why the settings are different)? And how to solve this ?
I am running fedora and my shell is bash.
vi --version
gives :
VIM - Vi IMproved 7.3
You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.
Add the text, “syntax on” anywhere in the file to enable syntax highlighting permanently for vim editor. Save and close the file by typing ':x'. For disabling the feature, just re-open . vimrc file, change the text “syntax on” to “syntax off” and save the file.
Turn On or Turn Off Syntax Highlighting in VIYou can Turn On or Turn Off syntax highlighting by pressing ESC button and use command as :syntax on and :syntax off in Vi editor.
To add color and style to text, you should create a class called ANSI, and inside this class, declare the configurations about the text and color with code ANSI. Functions Used: background: allows background formatting. Accepts ANSI codes between 40 and 47, 100 and 107.
I suppose it's because You have alias to vim, so calling vi .bashrc
from bash mean vim .bashrc
os.system
has no information about your aliases, so it calls vi
editor withot color-highlighting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With