I turned off line wrapping in Vim by adding this to my vimrc :
set nowrap
But I would like the automatic line feed to be turned on automatically when editing *.tex files. So, I added this to my vimrc:
augroup WrapLineInTeXFile autocmd! autocmd FileType tex set wrap augroup END
This should include line wrapping when the file type is defined as TeX. This works as expected for tex files, but if I open the non-tex file in the same Vim session, it will include line termination!
Enabling and disabling word wrap automatically in different file extensions on Vim involves the use of BufRead. But even this has the same effect: if I open the TeX file first and then the file without TeX, the file without TeX will include a wrapper.
How to enable line wrapping only for a certain type of file?
source share