Preface: I enjoy using vim, but am by no means a vim power user. My .vimrc file is largely the result of googling other's solutions and adapting them to my needs.
With that in mind, I'm curious if it's possible to have the .vimrc file set the values for g:Tex_SmartQuoteOpen and g:Tex_SmartQuoteClose based on the presence or absence of a specific keyword or pattern in the file that is being opened.
Context: Most of my .vimrc edits are related to making vim and the vim-latex plugin behave in a way that makes my life easier. The default setting for SmartQuotes within vim-latex is to set the open quote to `` and the close quote to ''. However, when I'm writing .tex files in languages other than english (particular when writing multi-lingual documents) I need to use the csquotes package so that each language gets the correct style of quotes (high vs low vs guillemets, etc.) Thus, my .vimrc currently defines
let g:Tex_SmartQuoteOpen="\\enquote\{"
let g:Tex_SmartQuoteClose="\}"
But, this is a bit heavy handed as I don't always use the csquotes package. I'm sure there must be a way to have vim do a quick search of the document being opened to look for the existence of csquotes (or, more accurately, a regex-like expression along the lines of
\\usepackage.\{-}{csquotes}
and then assign the SmartQuote variables if the search is successful. Is this possible or is it too complex for a simple .vimrc customization?