I want to source a color file based on the filetype python. How can I do that in .vimrc?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT:
ZyX makes a valid point that the use of
Buf*events will not ensure that the colorscheme is set correctly for python files where the filetype is set after the file is loaded (e.g., python files without the.pyextension or if you begin writing a script in a new buffer and manually setfiletype=python). As per ZyX’s suggestion in the comments below, here’s one that uses theFileTypeevent.My previous answer is here below:
The earlier command changed the colorscheme once you entered a python file and it remained so for the rest of the session. This one lets you have one type of colorscheme for python files and another type for the others.