I'm struggling with using .vimrc to apply specific configurations based on the filetype. Following the autocmd FileType suggestion here, I have attempted to apply a configuration based on filetype. Here is what I have in my .vimrc:
autocmd FileType tex call Tex_config()
function Tex_config()
let g:LatexBox_viewer = 'skim'
let g:LatexBox_latexmk_options = '-pvc'
let g:tex_flavor = "latex"
setlocal spell spelllang=en_ca
endfunction
I can call the function Tex_config() with :debug Tex_config: Vim happily spets through the function. So, everything seems like it should work.
But, when I issue :set filetype=tex something strange happens: spell checking turns off. And when I issue :set filetype=foo spell checking turns on. Just the reverse of what I expect to happen from this configuration snippet!
Any assistance would be greatly appreciated. Here is the full vimrc (function at 44-50). Thanks.
filetype plugin offbefore you invoke the pathogen functions in case your system wide vim settings turn it on before pathogen runs. I don't think this is causing your problem but it's good habit with pathogen.