Reputation: 16113
When I edit a LaTex (.tex) file Vim automatically adds a newline at the end of file on write. How do I disable this behavior (just for .tex files)?
Upvotes: 1
Views: 321
Reputation: 15196
That should be (almost) enough:
augroup mytex | au!
autocmd FileType tex setlocal nofixeol
augroup end
But note that if some file already had a newline at the end, then that newline becomes "invisible" in Vim and you cannot remove it normally.
To deal with this you can use setl eol?
and setl noeol
manually, or simply add setl noeol
to the autocommand.
See also embedded help system topics :h eol
and :h fixeol
.
Upvotes: 1