Thread: [Vim-latex-devel] View document in another directory
Brought to you by:
srinathava,
tmaas
From: Luc H. <her...@fr...> - 2004-06-18 20:26:40
|
Hello, I'm trying to configure g:Tex_ViewRule_html. The situation is that into the current directory I have a file foo.tex and that I use TeX4HT to generate several HTML pages into the subdirectory ./html/ My first attempt (Win32-vim + cygwin on Windows XP) was to define this option to: 'cygstart html/' Unfortunatelly, LaTeXSuite inserts a space just after g:Tex_ViewRule_html, and thus tries to execute: :!start cygstart html/ "foo.html" (It would have been the same with iexplorer) Then, I read the man page of cygstart and found out about the =AB-d=BB option. Unfortunatelly $>cygstart -d html foo.html result in IE trying to open http://html/foo.html. Definitivelly not what I expected. Playing with cygstart, I found out that =AB$PWD/html=BB was the argument = I was looking for. Unfortunatelly, while :!cygstart $PWD/html/ "foo.html" works very well, :!start cygstart $PWD/html/ "foo.html" does not. :( Does anybody know a way to configure g:Tex_ViewRule_html to open the file ./html/foo.html ? BTW, I have a request: I'd like an option to disable the default opening of the preview windows as the quickfix windows is enough for me 99% of the time. --=20 Luc Hermitte http://hermitte.free.fr/vim/ |
From: Srinath A. <sr...@fa...> - 2004-06-18 22:35:09
|
On Fri, 18 Jun 2004, Luc Hermitte wrote: > I'm trying to configure g:Tex_ViewRule_html. > The situation is that into the current directory I have a file foo.tex > and that I use TeX4HT to generate several HTML pages into > the subdirectory ./html/ > Okay, this seems like a reasonable thing to want latex-suite to do by default. I just looked at compiler.vim and it turns out that I use something like: :let execString =3D '!start '.s:viewer.' "'.mainfname.'.'.s:target.'"' :exec execString (here s:viewer =3D Tex_ViewRule_html and s:target =3D 'html') But I think it would have been better to use the strategy for Tex_CompileRule_dvi. Basically something like: :let _mp =3D &mp :let &mp =3D Tex_ViewRule_dvi :exec 'make '.mainfname This way you could have set Tex_ViewRule_html to something like :let Tex_ViewRule_html =3D '!start cygstart html/$*.html' and have things work OOTB. Maybe have a seperate setting in addition to Tex_ViewRule_html? Something like Tex_ViewRuleComplete_html which if exists takes precedence over Tex_ViewRule_html? > Playing with cygstart, I found out that =AB$PWD/html=BB was the argument = I > was looking for. > Unfortunatelly, while > :!cygstart $PWD/html/ "foo.html" > works very well, > :!start cygstart $PWD/html/ "foo.html" > does not. :( > As a hack in the while it takes me to modify latex-suite, why don't you make a little scriptlet which calls cygstart the way you want it to? It would be a solution for the time being... Something like #!/usr/bin/bash cygstart $PWD/html/$* and then point Tex_ViewRule_html to it... > BTW, I have a request: I'd like an option to disable the default opening > of the preview windows as the quickfix windows is enough for me 99% of > the time. > This should also be an easy thing to modify. I'll put it on the TODO. --=20 Srinath |
From: Luc H. <her...@fr...> - 2004-06-18 23:30:16
|
* On Fri, Jun 18, 2004 at 03:38:16PM -0700, Srinath Avadhanula <sr...@fa...> wrote: > > I'm trying to configure g:Tex_ViewRule_html. > > The situation is that into the current directory I have a file > > foo.tex and that I use TeX4HT to generate several HTML pages into > > the subdirectory ./html/ > [...] > But I think it would have been better to use the strategy for > Tex_CompileRule_dvi. Basically something like: > :let _mp = &mp > :let &mp = Tex_ViewRule_dvi > :exec 'make '.mainfname > > This way you could have set Tex_ViewRule_html to something like > :let Tex_ViewRule_html = '!start cygstart html/$*.html' > and have things work OOTB. That's neat. But a bit problematic. While this works perfectly with cygstart (because this program forks), it can not be used with start (execution error) which would be required with programs that do not fork like AcroRd32 -- I've just made some experiments. It seems we will need our own make-like command. Its only work beeing to substitute $* by the name of the result of the compilation. In the long run, it can even be extended to support custom formats like %pwd, %line, %col, ... > Maybe have a seperate setting in addition to Tex_ViewRule_html? > Something like Tex_ViewRuleComplete_html which if exists takes > precedence over Tex_ViewRule_html? Having both approaches to maintain may require more work than necessary. However, it present the avantage to be more easy to upgrade LaTeXSuite for end-users. Moreover, I do not think the complete rule must unhide details like how the viewer is launched into the background > [...] > As a hack in the while it takes me to modify latex-suite, why don't > you make a little scriptlet which calls cygstart the way you want it > to? It would be a solution for the time being... Something like > #!/usr/bin/bash > cygstart $PWD/html/$* Indeed. Thanks! (I should have though of it ... a few hours ago I wrote a wrapper for gvim in order to add "--servername=LATEX" when gvim is launched with (La)TeX files as parameters.) > > [Request: option for the preview window] > This should also be an easy thing to modify. I'll put it on the TODO. Thanks. -- Luc Hermitte http://hermitte.free.fr/vim/ |
From: Srinath A. <sr...@fa...> - 2004-06-18 23:55:46
|
On Sat, 19 Jun 2004, Luc Hermitte wrote: > * On Fri, Jun 18, 2004 at 03:38:16PM -0700, Srinath Avadhanula <sr...@fa...> wrote: > > This way you could have set Tex_ViewRule_html to something like > > :let Tex_ViewRule_html = '!start cygstart html/$*.html' > > and have things work OOTB. > > That's neat. But a bit problematic. > While this works perfectly with cygstart (because this program forks), > it can not be used with start (execution error) which would be required > with programs that do not fork like AcroRd32 -- I've just made some > experiments. Actually you can make it work with !start too. Here's a little demo: Open vim (not necessarily with latex-suite activated) and do: let &mp = 'start gvim $*' silent! make! % you will need gvim.exe to be in your windows $PATH of course. You should see another instance of gvim startup and attempt to reread the file.... The silent! is necessary because vim tries to redirect the output of "!start gvim file" to some temp file and then parse it for errors. Without the "silent!" it gives an error that the temp file cannot be opened. I got carried away and have already implemented this in CVS. > It seems we will need our own make-like command. Its only work beeing to > substitute $* by the name of the result of the compilation. > In the long run, it can even be extended to support custom formats like > %pwd, %line, %col, ... > As of right now, I have made it substitute the substring '{v:servername}' in &mp with v:servername. We could extend it to something like: :function! Eval(expr) : exec 'return '.a:expr :endfunction :let mp = substitute(&mp, '{\(.\{-}\)}', '\=Eval(submatch(1))', 'g') > > > > [Request: option for the preview window] > > This should also be an easy thing to modify. I'll put it on the TODO. > This is also done in CVS. Should be uploading shortly. Srinath |
From: Luc H. <her...@fr...> - 2004-06-19 00:14:49
|
* On Fri, Jun 18, 2004 at 04:58:55PM -0700, Srinath Avadhanula <srinath@f= astmail.fm> wrote: > Actually you can make it work with !start too. Here's a little demo: >=20 > Open vim (not necessarily with latex-suite activated) and do: > let &mp =3D 'start gvim $*' > silent! make! % > you will need gvim.exe to be in your windows $PATH of course. You shoul= d > see another instance of gvim startup and attempt to reread the file.... I though of this solution, but it does not indicate us if the file is not found, and neither v:shell_error nor :copen are of any help [1]. And even more important: let &makeprg=3D'AcroRd32 $*.pdf' =20 silent make foo works, but=20 let &makeprg=3D'start AcroRd32 $*.pdf' =20 silent make foo does not. AcroRd32 seems to receive an incorrect filename in the latter case. [1] This issue is raised by: :let &mp=3D'start! cygstart incorrectpath/$*.html' :silent! make foo And by extension, if the file to view has not been generated yet, \lv would not even tell us there is nothing to view. Without =ABstart=BB, the error can be retrieved with :copen --=20 Luc Hermitte http://hermitte.free.fr/vim/ |
From: Srinath A. <sr...@fa...> - 2004-06-19 00:52:35
|
On Sat, 19 Jun 2004, Luc Hermitte wrote: > * On Fri, Jun 18, 2004 at 04:58:55PM -0700, Srinath Avadhanula <sr...@fa...> wrote: > > Actually you can make it work with !start too. Here's a little demo: > > > > Open vim (not necessarily with latex-suite activated) and do: > > let &mp = 'start gvim $*' > > silent! make! % > > you will need gvim.exe to be in your windows $PATH of course. You should > > see another instance of gvim startup and attempt to reread the file.... > > I though of this solution, but it does not indicate us if the file is > not found, and neither v:shell_error nor :copen are of any help [1]. And > even more important: > let &makeprg='AcroRd32 $*.pdf' > silent make foo > works, but > let &makeprg='start AcroRd32 $*.pdf' > silent make foo > does not. > Yes. You're right... I have followed your previous idea of just creating an imitation of vim's native :make utility. For now, we just substitute $* with the main file name, but in the future it could be as general purpose as vim's own. Srinath |
From: Luc H. <her...@fr...> - 2004-06-19 14:58:49
|
Hi. * On Fri, Jun 18, 2004 at 05:55:34PM -0700, Srinath Avadhanula <srinath@f= astmail.fm> wrote: > I have followed your previous idea of just creating an imitation of > vim's native :make utility. For now, we just substitute $* with the > main file name, but in the future it could be as general purpose as > vim's own. Thanks! So far it works fine. BTW, I'm testing the files on the CVS (v1.69 IIRC). I have not set Tex_ViewRule_html, but Tex_ViewRuleComplete_html. And =AB:TTarget html=BB gives me the following error: =ABNo View rule defined for target html Please specify a rule in texrc.vim :help Tex_CompileRule_format for more information.=BB Where I see the following problems: - I think we should not get any error message in this case - the file to modify is not texrc.vim but texrc - as the help for Tex_CompileRule_format does not say that a view rule must be specified, shouldn't the error message point to Tex_ViewRule_format ? --=20 Luc Hermitte http://hermitte.free.fr/vim/ |
From: Luc H. <her...@fr...> - 2004-06-19 16:35:56
|
* On Sat, Jun 19, 2004 at 05:05:18PM +0200, Luc Hermitte <her...@fr...> wrote: > Thanks! So far it works fine. Actually, there is one problem line 239 of compiler.vim. On Windows, the extension is no more used while it is required -- AcroRd32 complains now. The line :let execString = 'start '.s:viewer.' "$*.'.s:target.'"' seems to fix the problem Regarding the log file, vim should not complain when the file has changed. In order to fix this, I've added the following hack into one tex-ftplugin: augroup autoreadLog au! au BufReadPost *.log :setlocal autoread |:setlocal nomodifiable aug END but I guess there is a simplier and less invasive solution. -- Luc Hermitte http://hermitte.free.fr/vim/ |