Re: [Vim-latex-cvs] vimfiles/ftplugin/latex-suite/packages ngerman,NONE,1.1
Brought to you by:
srinathava,
tmaas
|
From: Benji F. <be...@me...> - 2003-01-16 17:47:55
|
Mikolaj Machowski wrote:
> On Wed, Jan 15, 2003 at 06:39:00PM -0800, Srinath Avadhanula wrote:
>
>>On Wed, 15 Jan 2003, Benji Fisher wrote:
>>
>>>:execute "source" expand("%:p:h") . "/german"
>>>
>>
>>Agreed. Although it should be:
>>execute 'source '.expand('<sfile>:p:h').'/german'
>>(<sfile> instead of %)
>>
>>>\usepackage[german]{babel}
>>>
>>>instead of
>>>
>>>\usepackage{german}
>>>
>>
>>As of now, there isn't. During the scan for \usepcackage's, the
>>g:Tex_pack_supported is created which lists the packages detected...
>>Unless a variable like g:Tex_{pack}_options or something similar is
>>created, this is not possible. This is actually not too hard to
>>implement, but even if it is implemented, I dont know how to make
>>the tex quotes function use this information. We will have to revert to
>>the strategy of modifying that function itself... (But I dont like that
>>strategy too much because its not really scalable).
>>Any ideas?
>
>
> Here simple solution
> package file 'babel':
> -------
> function! Lookfor()
> let g:pos = line('.').' | normal! '.virtcol('.').'|'
> let g:line = search('\\usepackage.*{babel}', 'w')
> if getline(g:line) =~ 'german'
> source $VIMLATEXMAINPATH/packages/german
> endif
> exe g:pos
> endfunction
>
> call Lookfor()
>
> " vim:ft=vim:ff=unix:
> ---------
> Works for me. Aha, small cheat: $VIMLATEXMAINPATH is defined
> in main.vim. IMO this is not bad idea - calculating path in each file
> which needs this information in not very clear.
>
> But this in not necessarily good solution. This sources whole package
> file with its menus and specific commands which is not always cause with
> babel package. IIRC this turns on only hyphenation, gives access to
> special letters, and redefines \chapter and similar commands. For
> (n)german it works. I have wonderful polski package which does many,
> many more. Maybe Luc can say more?
>
> m.
>
> ps. To Srinath: g: variables are only for debugging purposes ;)
I was going to ask about the g: vars.
Why wrap it in a function? Just use s: instead of g: . Or do
you see the Lookfor() function as being needed in other scripts?
I only write in English, so I am not familiar with the difference
between \usepackage[mylang]{babel} and \usepackage{mylang} . That said,
I have a suggestion: have files babel, german, and german-babel (or
babel-german or even babel/german) in the packages directory. The
german file, and the babel file if german is given as an option, will
:source the german-babel file. So far, the german file will not do
anything else, but it may in the future.
I would rather parse the \usepackage[...]{babel} line more
carefully, rather than just test whether it matches 'german'.
--Benji
|