[Vim-latex-cvs] SF.net SVN: vim-latex: [1006] trunk/vimfiles/plugin
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2006-03-28 19:15:33
|
Revision: 1006 Author: srinathava Date: 2006-03-28 11:15:18 -0800 (Tue, 28 Mar 2006) ViewCVS: http://svn.sourceforge.net/vim-latex/?rev=1006&view=rev Log Message: ----------- New: Significant speedup for the FB_DisplayFiles() function. Instead of using FB_Strntok() to get the i^th line of glob('*'), iterate using stridx(). This makes the time required by FB_OpenFileBrowser() to list the files in C:/WINDOWS/system32 reduce from 104 seconds to 1 second. If v:version >= 700, then we can directly use Vim's inbuilt list and split() functions. This makes the time go to 0.6 seconds. Modified Paths: -------------- trunk/vimfiles/ftplugin/latex-suite/version.vim trunk/vimfiles/plugin/filebrowser.vim Modified: trunk/vimfiles/ftplugin/latex-suite/version.vim =================================================================== --- trunk/vimfiles/ftplugin/latex-suite/version.vim 2006-03-28 04:32:11 UTC (rev 1005) +++ trunk/vimfiles/ftplugin/latex-suite/version.vim 2006-03-28 19:15:18 UTC (rev 1006) @@ -24,7 +24,7 @@ " "stabilize" that version by releasing a few pre-releases and then " keep that as a stable point. function! Tex_Version() - return "Latex-Suite: version 1.8.14" + return "Latex-Suite: version 1.8.15" endfunction com! -nargs=0 TVersion echo Tex_Version() Modified: trunk/vimfiles/plugin/filebrowser.vim =================================================================== --- trunk/vimfiles/plugin/filebrowser.vim 2006-03-28 04:32:11 UTC (rev 1005) +++ trunk/vimfiles/plugin/filebrowser.vim 2006-03-28 19:15:18 UTC (rev 1006) @@ -62,23 +62,43 @@ let dispFiles = "" let subDirs = "../\n" - let i = 1 - while 1 - let filename = s:FB_Strntok(allFilenames, "\n", i) - if filename == '' - break - endif - if isdirectory(filename) - let subDirs = subDirs.filename."/\n" - else - if allowRegexp != '' && filename !~ allowRegexp - elseif rejectRegexp != '' && filename =~ rejectRegexp + if v:version >= 700 + let flist = split(allFilenames, "\n") + for filename in flist + if isdirectory(filename) + let subDirs = subDirs.filename."/\n" else - let dispFiles = dispFiles.filename."\n" + if allowRegexp != '' && filename !~ allowRegexp + elseif rejectRegexp != '' && filename =~ rejectRegexp + else + let dispFiles = dispFiles.filename."\n" + endif endif - endif - let i = i + 1 - endwhile + endfor + else + let allFilenames = allFilenames."\n" + let start = 0 + while 1 + let next = stridx(allFilenames, "\n", start) + let filename = strpart(allFilenames, start, next-start) + if filename == "" + break + endif + + if isdirectory(filename) + let subDirs = subDirs.filename."/\n" + else + if allowRegexp != '' && filename !~ allowRegexp + elseif rejectRegexp != '' && filename =~ rejectRegexp + else + let dispFiles = dispFiles.filename."\n" + endif + endif + + let start = next + 1 + endwhile + endif + 0put!=dispFiles 0put!=subDirs " delte the last empty line resulting from the put @@ -103,6 +123,9 @@ let s:{a:varname} = a:value endfunction " }}} +" ============================================================================== +" Script local functions below this +" ============================================================================== " FB_SetHighlighting: sets syntax highlighting for the buffer {{{ " Description: " Origin: from explorer.vim in vim @@ -195,8 +218,6 @@ endif 0put!=txt endfunction " }}} - -" Handles various actions in the file-browser " FB_EditEntry: handles the user pressing <enter> on a line {{{ " Description: function! <SID>FB_EditEntry() @@ -222,13 +243,6 @@ exec "call ".cbf."('".fname."'".arguments.')' endif endfunction " }}} - -" FB_Strntok (string, tok, n) {{{ -" extract the n^th token from s seperated by tok. -" example: FB_Strntok('1,23,3', ',', 2) = 23 -fun! <SID>FB_Strntok(s, tok, n) - return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') -endfun " }}} " FB_GetVar: gets the most local value of a variable {{{ function! <SID>FB_GetVar(name, default) if exists('s:'.a:name) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |