[Vim-latex-cvs] SF.net SVN: vim-latex: [1039] trunk/vimfiles
Brought to you by:
srinathava,
tmaas
|
From: <tm...@us...> - 2008-06-07 14:09:47
|
Revision: 1039
http://vim-latex.svn.sourceforge.net/vim-latex/?rev=1039&view=rev
Author: tmaas
Date: 2008-06-07 07:09:51 -0700 (Sat, 07 Jun 2008)
Log Message:
-----------
- Enhance forward/inverse searching, patch by Ted Pavlic
http://phaseportrait.blogspot.com/2007/07/vim-latex-modification-forward.html
http://links.tedpavlic.com/patch/VIM-LaTeX-osx-inverse-search-compiler.patch
http://sourceforge.net/mailarchive/message.php?msg_name=48418CD8.6060907%40tedpavlic.com
- Update documentation to mention several viewers that support forward searching
- Mention empty view rule meaning for Windows/Mac users: use system default viewer
Modified Paths:
--------------
trunk/vimfiles/doc/latex-suite.txt
trunk/vimfiles/doc/latex-suite.xml
trunk/vimfiles/ftplugin/latex-suite/compiler.vim
trunk/vimfiles/ftplugin/latex-suite/texrc
Modified: trunk/vimfiles/doc/latex-suite.txt
===================================================================
--- trunk/vimfiles/doc/latex-suite.txt 2008-05-31 17:13:01 UTC (rev 1038)
+++ trunk/vimfiles/doc/latex-suite.txt 2008-06-07 14:09:51 UTC (rev 1039)
@@ -58,7 +58,7 @@
|ls_6_5| Compiling parts of a file
|ls_7| Latex Viewing and Searching
|ls_7_1| Setting Viewing rules
- |ls_7_2| Forward Searching DVI documents
+ |ls_7_2| Forward Searching documents
|ls_7_3| Inverse Searching
|ls_8| Latex Folding
|ls_8_1| Default Folding Scheme in Latex-Suite
@@ -1755,7 +1755,7 @@
*latex-viewing*
|ls_7_1| Setting Viewing rules
-|ls_7_2| Forward Searching DVI documents
+|ls_7_2| Forward Searching documents
|ls_7_3| Inverse Searching
@@ -1781,22 +1781,46 @@
you are attempting to view. See the link above for how to set this according to
your system.
+NOTE: On Windows and OS/X, you can leave the view rule empty to open the
+ document with the default viewer on your system. On Linux/UNIX systems,
+ you can use the xdg-open command to open the document with the default
+ viewer.
+
+
In addition to viewing the files, Latex-Suite also supports forward and inverse
-searching for certain common tools for viewing DVI documents. At the moment,
-there is built-in support for YAP on windows (which ships with MikTeX), and the
-popular xdvi on *nix platforms. See the next few sections for details on forward
-and inverse searching.
+searching for certain common tools for viewing documents. See the next few
+sections for details on forward and inverse searching, including an overview of
+viewers.
--------------------------------------------------------------------------------
-Forward Searching DVI documents *ls_7_2* *ls_a_cg*
+Forward Searching documents *ls_7_2* *ls_a_cg*
*forward-searching*
-Forward searching refers to making a DVI viewer display a given document at a
-given location from within Vim. At present, this functionality is supported for
-YAP on windows and xdvi on *nix machines. Pressing \ls from within Vim should
-make the DVI viewer display the portion of the document where your cursor is
-placed.
+Forward searching refers to making a viewer display a given document at a given
+location from within Vim. At present, these viewers are known to support forward
+searching, but viewers that are not listed here may work, too:Viewer OS Supported documents Comment~
+Skim |ls_u_5| Apple / OS X Tiger PDF Supports also
+ inverse searching
+PDFView |ls_u_6| Apple / OS X PDF No longer in
+ development,
+ supports also
+ inverse searching
+TeXniscope |ls_u_7| Apple PDF, DVI
+YAP |ls_u_8| Windows DVI, PS ships with MikTex
+Sumatra PDF |ls_u_9| Windows PDF
+kdvi |ls_u_10| Linux/UNIX DVI
+okular |ls_u_11| Linux/UNIX DVI, PDF, PS and Included in KDE 4
+ many more
+xdvi |ls_u_12| Linux/UNIX DVI
+xdvik |ls_u_13| Linux/UNIX DVI
+Pressing \ls from within Vim should make the viewer display the portion of the
+document where your cursor is placed.NOTE: OS/X users need to set the g:TreatMacViewerAsUNIX flag to 1 and provide a
+ UNIX-like viewrule, that expects as arguments the document, the linenumber
+ and the sourcefile in this order.
+
+
+
*enabling-searching* *ls_a_ed*
NOTE: Enabling Forward and Inverse Searching
--------------------------------------
@@ -1806,14 +1830,17 @@
Latex-Suite does not supply this argument to the compiler. See the section
on to find out how this option can be set.
+ For pdf viewers you need to use the pdfsync |ls_u_14| package in your
+ LaTeX document.
+
--------------------------------------------------------------------------------
Inverse Searching *ls_7_3* *ls_a_ch*
*inverse-searching*
-Inverse searching refers to the DVI viewer telling Vim to display the LaTeX
-source file at a given location when you double-click in the DVI viewer window.
+Inverse searching refers to the viewer telling Vim to display the LaTeX source
+file at a given location when you double-click in the viewer window.
You will need to enable searching [|ls_a_ed|] in order to use this
functionality.
@@ -3392,9 +3419,19 @@
URLs used in this file
*ls_u_1* : http://vim-latex.sourceforge.net
+*ls_u_10* : http://developer.kde.org/~kdvi/
+*ls_u_11* : http://okular.kde.org/
+*ls_u_12* : http://math.berkeley.edu/~vojta/xdvi.html
+*ls_u_13* : http://xdvi.sourceforge.net/
+*ls_u_14* : http://itexmac.sourceforge.net/pdfsync.html
*ls_u_2* : http://vim-latex.sourceforge.net/index.php?subject=download
*ls_u_3* : http://www.cygwin.com
*ls_u_4* : http://www.google.com/search?q=windows%20gnu%20grep
+*ls_u_5* : http://skim-app.sourceforge.net/
+*ls_u_6* : http://pdfview.sourceforge.net/
+*ls_u_7* : http://www2.ing.unipi.it/~d9615/homepage/texniscope.html
+*ls_u_8* : http://www.miktex.org/
+*ls_u_9* : http://blog.kowalczyk.info/software/sumatrapdf/
================================================================================
About this file
Modified: trunk/vimfiles/doc/latex-suite.xml
===================================================================
--- trunk/vimfiles/doc/latex-suite.xml 2008-05-31 17:13:01 UTC (rev 1038)
+++ trunk/vimfiles/doc/latex-suite.xml 2008-06-07 14:09:51 UTC (rev 1039)
@@ -2180,23 +2180,106 @@
attempting to view. See the link above for how to set this according to
your system.
</para>
+ <note>
+ <para>
+ On Windows and OS/X, you can leave the view rule empty to open the document
+ with the default viewer on your system. On Linux/UNIX systems, you can use
+ the <literal>xdg-open</literal> command to open the document with the default
+ viewer.
+ </para>
+ </note>
<para>
In addition to viewing the files, &ls; also supports forward and inverse
- searching for certain common tools for viewing DVI documents. At the
- moment, there is built-in support for YAP on windows (which ships with
- MikTeX), and the popular <literal>xdvi</literal> on *nix platforms. See
- the next few sections for details on forward and inverse searching.
+ searching for certain common tools for viewing documents.
+ See the next few sections for details on forward and inverse searching,
+ including an overview of viewers.
</para>
</section>
<section id="forward-searching">
- <title>Forward Searching DVI documents</title>
+ <title>Forward Searching documents</title>
<para>
- Forward searching refers to making a DVI viewer display a given document
- at a given location from within &vim;. At present, this functionality is
- supported for <literal>YAP</literal> on windows and
- <literal>xdvi</literal> on *nix machines. Pressing
- <literal>\ls</literal> from within &vim; should make the DVI viewer
- display the portion of the document where your cursor is placed.
+ Forward searching refers to making a viewer display a given document at
+ a given location from within &vim;. At present, these viewers are known to support
+ forward searching, but viewers that are not listed here may work, too:
+ <informaltable frame="all">
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Viewer</entry>
+ <entry>OS</entry>
+ <entry>Supported documents</entry>
+ <entry>Comment</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><ulink url="http://skim-app.sourceforge.net/">Skim</ulink></entry>
+ <entry>Apple / OS X Tiger</entry>
+ <entry>PDF</entry>
+ <entry>Supports also inverse searching</entry>
+ </row>
+ <row>
+ <entry><ulink url="http://pdfview.sourceforge.net/">PDFView</ulink></entry>
+ <entry>Apple / OS X</entry>
+ <entry>PDF</entry>
+ <entry>No longer in development, supports also inverse searching</entry>
+ </row>
+ <row>
+ <entry><ulink url="http://www2.ing.unipi.it/~d9615/homepage/texniscope.html">TeXniscope</ulink></entry>
+ <entry>Apple</entry>
+ <entry>PDF, DVI</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><ulink url="http://www.miktex.org/">YAP</ulink></entry>
+ <entry>Windows</entry>
+ <entry>DVI, PS</entry>
+ <entry>ships with MikTex</entry>
+ </row>
+ <row>
+ <entry><ulink url="http://blog.kowalczyk.info/software/sumatrapdf/">Sumatra PDF</ulink></entry>
+ <entry>Windows</entry>
+ <entry>PDF</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><ulink url="http://developer.kde.org/~kdvi/">kdvi</ulink></entry>
+ <entry>Linux/UNIX</entry>
+ <entry>DVI</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><ulink url="http://okular.kde.org/">okular</ulink></entry>
+ <entry>Linux/UNIX</entry>
+ <entry>DVI, PDF, PS and many more</entry>
+ <entry>Included in KDE 4</entry>
+ </row>
+ <row>
+ <entry><ulink url="http://math.berkeley.edu/~vojta/xdvi.html">xdvi</ulink></entry>
+ <entry>Linux/UNIX</entry>
+ <entry>DVI</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry><ulink url="http://xdvi.sourceforge.net/">xdvik</ulink></entry>
+ <entry>Linux/UNIX</entry>
+ <entry>DVI</entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ Pressing <literal>\ls</literal> from within &vim;
+ should make the viewer display the portion of the document where your
+ cursor is placed.
+ <note>
+ <para>
+ OS/X users need to set the <literal>g:TreatMacViewerAsUNIX</literal> flag
+ to <literal>1</literal> and provide a UNIX-like viewrule, that expects as
+ arguments the document, the linenumber and the sourcefile in this order.
+ </para>
+ </note>
</para>
<anchor id="enabling-searching" />
<note>
@@ -2210,14 +2293,17 @@
<literal><link
linkend="Tex_CompileRule_format">g:Tex_CompileRule_dvi</link></literal>
to find out how this option can be set.
+
+ For pdf viewers you need to use the <ulink url="http://itexmac.sourceforge.net/pdfsync.html">pdfsync</ulink>
+ package in your LaTeX document.
</para>
</note>
</section>
<section id="inverse-searching">
<title>Inverse Searching</title>
<para>
- Inverse searching refers to the DVI viewer telling &vim; to display the
- &latex; source file at a given location when you double-click in the DVI
+ Inverse searching refers to the viewer telling &vim; to display the
+ &latex; source file at a given location when you double-click in the
viewer window.
</para>
<para>
Modified: trunk/vimfiles/ftplugin/latex-suite/compiler.vim
===================================================================
--- trunk/vimfiles/ftplugin/latex-suite/compiler.vim 2008-05-31 17:13:01 UTC (rev 1038)
+++ trunk/vimfiles/ftplugin/latex-suite/compiler.vim 2008-06-07 14:09:51 UTC (rev 1039)
@@ -251,7 +251,8 @@
" that this particular vim and yap are connected.
let execString = 'start '.s:viewer.' "$*.'.s:target.'"'
- elseif has('macunix')
+ elseif (has('macunix') && Tex_GetVarValue('Tex_TreatMacViewerAsUNIX') != 1)
+
if strlen(s:viewer)
let s:viewer = '-a '.s:viewer
endif
@@ -270,24 +271,29 @@
\ (s:viewer == "xdvi" || s:viewer == "xdvik")
let execString = s:viewer.' -editor "gvim --servername '.v:servername.
- \ ' --remote-silent +\%l \%f" $*.dvi &'
+ \ ' --remote-silent +\%l \%f" $*.dvi'
elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 &&
\ s:viewer == "kdvi"
- let execString = 'kdvi --unique $*.dvi &'
+ let execString = 'kdvi --unique $*.dvi'
else
- let execString = s:viewer.' $*.dvi &'
+ let execString = s:viewer.' $*.dvi'
endif
else
- let execString = s:viewer.' $*.'.s:target.' &'
+ let execString = s:viewer.' $*.'.s:target
endif
+
+ if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 )
+ let execString = execString.' &'
+ endif
+
end
let execString = substitute(execString, '\V$*', mainfname, 'g')
@@ -304,7 +310,7 @@
" }}}
" Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{
-" Description: if the DVI viewr is compatible, then take the viewer to that
+" Description: if the DVI viewer is compatible, then take the viewer to that
" position in the dvi file. see docs for Tex_RunLaTeX() to set a
" master file if this is an \input'ed file.
" Tip: With YAP on Windows, it is possible to do forward and inverse searches
@@ -316,53 +322,91 @@
" will work.
function! Tex_ForwardSearchLaTeX()
if &ft != 'tex'
- echo "calling Tex_ViewLaTeX from a non-tex file"
+ echo "calling Tex_ForwardSeachLaTeX from a non-tex file"
return
end
- " only know how to do forward search for yap on windows and xdvik (and
- " some newer versions of xdvi) on unices. Therefore forward searching will
- " automatically open the DVI viewer irrespective of what the user chose as
- " the default view format.
- if Tex_GetVarValue('Tex_ViewRule_dvi') == ''
+ if Tex_GetVarValue('Tex_ViewRule_'.s:target) == ''
return
endif
- let viewer = Tex_GetVarValue('Tex_ViewRule_dvi')
+ let viewer = Tex_GetVarValue('Tex_ViewRule_'.s:target)
let curd = getcwd()
let mainfname = Tex_GetMainFileName(':t')
let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r')
+ let mainfnameFull = Tex_GetMainFileName(':p:r')
" cd to the location of the file to avoid problems with directory name
" containing spaces.
call Tex_CD(Tex_GetMainFileName(':p:h'))
" inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's
" tips on vim.sf.net (vim.sf.net tip #225)
- if has('win32')
+ if (has('win32') && (viewer == "yap" || viewer == "YAP" || viewer == "Yap"))
let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%').' '.mainfnameRoot
+
+ elseif (has('macunix') && (viewer == "Skim" || viewer == "PDFView" || viewer == "TeXniscope"))
+ " We're on a Mac using a traditional Mac viewer
+
+ if viewer == "Skim"
+
+ let execString = 'silent! !/Applications/Skim.app/Contents/SharedSupport/displayline '.
+ \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'
+
+ elseif viewer == "PDFView"
+
+ let execString = 'silent! !/Applications/PDFView.app/Contents/MacOS/gotoline.sh '.
+ \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'
+
+ elseif viewer == "TeXniscope"
+
+ let execString = 'silent! !/Applications/TeXniscope.app/Contents/Resources/forward-search.sh '.
+ \ line('.').' "'.expand("%:p").'" "'.mainfnameFull.'.'.s:target.'"'
+
+ endif
+
else
- if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 &&
- \ exists('v:servername') &&
- \ (viewer == "xdvi" || viewer == "xdvik")
+ " We're either UNIX or Mac and using a UNIX-type viewer
- let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").
- \ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '.
- \ mainfnameRoot.'.dvi &'
+ " Check for the special DVI viewers first
+ if (viewer == "xdvi" || viewer == "xdvik" || viewer == "kdvi" )
- elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && viewer == "kdvi"
+ if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 &&
+ \ exists('v:servername') &&
+ \ (viewer == "xdvi" || viewer == "xdvik")
- let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%").' &'
+ let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").
+ \ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '.
+ \ mainfnameRoot.'.dvi'
+ elseif viewer == "kdvi"
+
+ let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%")
+
+ elseif (viewer == "xdvi" || viewer = "xdvik" )
+
+ let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").' '.mainfnameRoot.'.dvi'
+
+ endif
+
else
+ " We must be using a generic UNIX viewer
+ " syntax is: viewer TARGET_FILE LINE_NUMBER SOURCE_FILE
- let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").' '.mainfnameRoot.'.dvi &'
+ let execString = 'silent! !'.viewer.' "'.mainfnameRoot.'.'.s:target.'" '.line('.').' "'.expand('%').'"'
endif
- end
+ " See if we should add &. On Mac (at least in MacVim), it seems
+ " like this should NOT be added...
+ if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 )
+ let execString = execString.' &'
+ endif
+
+ endif
+
call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp")
execute execString
if !has('gui_running')
Modified: trunk/vimfiles/ftplugin/latex-suite/texrc
===================================================================
--- trunk/vimfiles/ftplugin/latex-suite/texrc 2008-05-31 17:13:01 UTC (rev 1038)
+++ trunk/vimfiles/ftplugin/latex-suite/texrc 2008-06-07 14:09:51 UTC (rev 1039)
@@ -146,6 +146,9 @@
TexLet g:Tex_ViewRule_pdf = ''
" TexLet g:Tex_ViewRule_pdf = 'Acrobat\ Reader\ 5.1'
TexLet g:Tex_ViewRule_dvi = ''
+ " Set this to 1 to disable opening a viewer with 'open -a'
+ " Note: If you do this, you need to specify viewers above
+ " TexLet g:Tex_TreatMacViewerAsUNIX = 1
else
TexLet g:Tex_ViewRule_ps = 'ghostview'
TexLet g:Tex_ViewRule_pdf = 'xpdf'
@@ -155,6 +158,9 @@
" #225)
TexLet g:Tex_UseEditorSettingInDVIViewer = 0
endif
+" For unix systems or macunix systens with enabled Tex_TreatMacViewerAsUNIX:
+" Set this to 1 if you do not want to execute the viewer in the background
+" TexLet g:Tex_ExecuteUNIXViewerInForeground = 1
" Tex_ViewRuleComplete_{format}
"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|