Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24022
Modified Files:
main.vim outline.py texviewer.vim
Log Message:
New: Instead of using outline.py as an external script, use vim's internal
python interpreter if available. This makes things _much_ faster and
it avoids the little "flash" when an external command is called.
Index: main.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** main.vim 1 Jan 2006 07:53:01 -0000 1.88
--- main.vim 1 Jan 2006 07:54:25 -0000 1.89
***************
*** 638,642 ****
" keep that as a stable point.
function! Tex_Version()
! return "Latex-Suite: version 1.8.02"
endfunction
--- 638,642 ----
" keep that as a stable point.
function! Tex_Version()
! return "Latex-Suite: version 1.8.03"
endfunction
Index: outline.py
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/outline.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** outline.py 28 Dec 2005 01:17:13 -0000 1.1
--- outline.py 1 Jan 2006 07:54:25 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
import os
import sys
+ import stringio
# getFileContents {{{
***************
*** 54,58 ****
outline_nums[cmd] = 0
-
pres_depth = 0
fname = ''
--- 55,58 ----
***************
*** 60,63 ****
--- 60,64 ----
inside_env = 0
prev_env = ''
+ outstr = stringio.StringIO()
for line in contents.splitlines():
***************
*** 94,100 ****
#
# Use the current "section depth" for the leading indentation.
! print '>%s%s\t\t<%s>' % (' '*(2*pres_depth+6),
m.group(1), fname)
! print ':%s%s' % (' '*(2*pres_depth+8), prev_txt)
prev_txt = ''
--- 95,101 ----
#
# Use the current "section depth" for the leading indentation.
! print >>outstr, '>%s%s\t\t<%s>' % (' '*(2*pres_depth+6),
m.group(1), fname)
! print >>outstr, ':%s%s' % (' '*(2*pres_depth+8), prev_txt)
prev_txt = ''
***************
*** 124,128 ****
pres_depth = i
! print '%s%s\t<<<%d' % (' '*2*pres_depth, sec_txt, pres_depth+1)
break
--- 125,129 ----
pres_depth = i
! print >>outstr, '%s%s\t<<<%d' % (' '*2*pres_depth, sec_txt, pres_depth+1)
break
***************
*** 153,166 ****
prev_txt = line
- # }}}
-
- if __name__ == "__main__":
- fname = sys.argv[1]
- if len(sys.argv) > 2:
- prefix = sys.argv[2]
- else:
- prefix = ''
[head, tail] = os.path.split(fname)
if head:
--- 154,163 ----
prev_txt = line
+ return outstr.getvalue()
+ # }}}
+ # main(fname) {{{
+ def main(fname, prefix):
[head, tail] = os.path.split(fname)
if head:
***************
*** 169,174 ****
[root, ext] = os.path.splitext(tail)
contents = getFileContents(root, ext)
! createOutline(contents, prefix)
# vim: fdm=marker
--- 166,182 ----
[root, ext] = os.path.splitext(tail)
contents = getFileContents(root, ext)
+ outline = createOutline(contents, prefix)
! return outline
!
! # }}}
!
! if __name__ == "__main__":
! if len(sys.argv) > 2:
! prefix = sys.argv[2]
! else:
! prefix = ''
!
! print main(sys.argv[1], prefix)
# vim: fdm=marker
Index: texviewer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/texviewer.vim,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** texviewer.vim 28 Dec 2005 01:17:13 -0000 1.12
--- texviewer.vim 1 Jan 2006 07:54:25 -0000 1.13
***************
*** 712,715 ****
--- 712,720 ----
" these lines need to be outside the function.
let s:path = expand('<sfile>:p:h')
+ if has('python') && Tex_GetVarValue('Tex_UsePython')
+ python import sys, re
+ exec "python sys.path += [r'". s:path . "']"
+ python import outline
+ endif
function! Tex_StartOutlineCompletion()
***************
*** 725,728 ****
--- 730,734 ----
bot split __OUTLINE__
+ exec Tex_GetVarValue('Tex_OutlineWindowHeight', 15).' wincmd _'
setlocal modifiable
***************
*** 736,741 ****
" delete everything in it to the blackhole
% d _
! " read in the output of the outline command
! exec '0r!'.s:path.'/outline.py '.mainfname.' '.s:prefix
0
--- 742,759 ----
" delete everything in it to the blackhole
% d _
!
! if has('python') && Tex_GetVarValue('Tex_UsePython')
! exec 'python retval = outline.main('
! \. 'r"' . fnamemodify(mainfname, ':p') . '", '
! \. 'r"' . s:prefix . '")'
!
! " transfer variable from python to a local variable.
! python vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', retval))
!
! 0put!=retval
! else
! exec '0r!'.s:path.'/outline.py '.mainfname.' '.s:prefix
! endif
!
0
***************
*** 755,758 ****
--- 773,777 ----
let &cmdheight = _cmdheight
let &lazyredraw = _lazyredraw
+
endfunction " }}}
" Tex_SetupOutlineSyntax: sets up the syntax items for the outline {{{
|