Using `TabEnter` and `FileType` in the same `autocmd`

2018-02-23 10:13:34

I would like to set set spell whenever I open a tex file.

My first attempt is

autocmd FileType tex setlocal spell

I am using setlocal here because I may open other files in new tabs after opening a tex file and I don't want spell in the new files.

This works well, but I notice that if I open another tex file in new tab, the spell is not enabled.

I tried

autocmd TabEnter,FileType tex setlocal spell

but it does not work.

I've got the desired behavior using

autocmd BufReadPre *.tex setlocal spell

  • I've got the desired behavior using

    autocmd BufReadPre *.tex setlocal spell

    2018-02-23 12:50:14