I'm trying to understand using the autocmd
to modify properties for certain files. Here is a basic example I have in my vimrc
:
syntax on
autocmd BufRead *.py syntax off
However, when I then open up a new python file, all files in that window (whether python or not) have their syntax highlighting removed. For example:
Why does this occur, and what would be the proper way to change something for only the filetype I'm referencing and not other windows/splits?
Note: the same thing also happens with:
autocmd FileType python syntax off
From Learn Vimscript the Hard Way:
One of the most useful events is the
FileType
event. This event is fired whenever Vim sets a buffer'sfiletype
.
But if the user has to manually set the ft
everytime a file is opened, it seems quite useless (if I'm understanding things correctly).