On Wed, Apr 06, 2016 at 10:21:42PM -0700, Ben Fritz wrote:
> On Tuesday, April 5, 2016 at 2:44:23 PM UTC-5, Albert Berger wrote:
> > Greetings!
> > 
> > How does one detect the file type in .vimrc? AFAIU, 'filetype' setting is
> > not yet set when .vimrc is processed. The following check doesn't
> > work in .vimrc:
> > 
> > if &filetype==cpp
> > ...
> > 
> > I want to distinguish between 'c' and 'cpp' for *.h files in which
> > the file type is specified in the modline. Is there a function which
> > can be called for reading the modline? I know that one can use autocmd,
> > when the file type read from the modline is already set, but is there a
> > way to get the modline variables in .vimrc?
> > 
> > Thanks,
> > Albert.
> 
> No, you'll need to use an autocmd. In which case you may as well use a 
> FileType autocmd. The modeline, like the filetype, has not been processed yet 
> while reading the .vimrc.
> 
> Indeed, I'm pretty sure the file itself hasn't been read yet when reading the 
> .vimrc, but I may be wrong about that.
> 

Looks like this is the case. Will use FileType autocmd. Thanks.


Albert.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to