Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if filetype == tex

Tags:

vim

latex

I want to run a command in the .vimrc in case a file is a latex file. I think I have something with the syntax, it does not work. Any clue?

if &filetype=='tex'     set spell endif 
like image 687
Jakub M. Avatar asked May 13 '11 22:05

Jakub M.


2 Answers

You can use auto commands to achieve what you want:

autocmd BufNewFile,BufRead *.tex set spell 
like image 90
abcd Avatar answered Oct 01 '22 22:10

abcd


For those who want to check the current filetype and do something while editing, this should work:

if (&ft=='c' || &ft=='cpp')     :!g++ % endif 
like image 42
Chanseok Oh Avatar answered Oct 01 '22 20:10

Chanseok Oh