[Vim-latex-cvs] vimfiles/ftplugin/latex-suite main.vim,1.64,1.65
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2004-06-09 17:02:23
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32118 Modified Files: main.vim Log Message: Bug: Get an error E117: Unknown function: Tex_GetVarValue Why: We use Tex_GetVarValue before it is defined. Fix: Move the smart key functions below the "helper" functions. The helper functions should always be defined before any other function which might use them. Index: main.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** main.vim 6 Jun 2004 23:21:25 -0000 1.64 --- main.vim 9 Jun 2004 17:02:11 -0000 1.65 *************** *** 170,311 **** " ============================================================================== - " Smart key-mappings - " ============================================================================== - " TexQuotes: inserts `` or '' instead of " {{{ - if g:Tex_SmartKeyQuote - - " TexQuotes: inserts `` or '' instead of " - " Taken from texmacro.vim by Benji Fisher <be...@e-...> - " TODO: Deal with nested quotes. - " The :imap that calls this function should insert a ", move the cursor to - " the left of that character, then call this with <C-R>= . - function! s:TexQuotes() - let l = line(".") - let c = col(".") - let restore_cursor = l . "G" . virtcol(".") . "|" - normal! H - let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - execute restore_cursor - " In math mode, or when preceded by a \, just move the cursor past the - " already-inserted " character. - if synIDattr(synID(l, c, 1), "name") =~ "^texMath" - \ || (c > 1 && getline(l)[c-2] == '\') - return "\<Right>" - endif - " Find the appropriate open-quote and close-quote strings. - if exists("b:Tex_SmartQuoteOpen") - let open = b:Tex_SmartQuoteOpen - elseif exists("g:Tex_SmartQuoteOpen") - let open = g:Tex_SmartQuoteOpen - else - let open = "``" - endif - if exists("b:Tex_SmartQuoteClose") - let close = b:Tex_SmartQuoteClose - elseif exists("g:Tex_SmartQuoteClose") - let close = g:Tex_SmartQuoteClose - else - let close = "''" - endif - let boundary = '\|' - " This code seems to be obsolete, since this script variable is never - " set. The idea is that some languages use ",," as an open- or - " close-quote string, and we want to avoid confusing ordinary "," - " with a quote boundary. - if exists("s:TeX_strictquote") - if( s:TeX_strictquote == "open" || s:TeX_strictquote == "both" ) - let boundary = '\<' . boundary - endif - if( s:TeX_strictquote == "close" || s:TeX_strictquote == "both" ) - let boundary = boundary . '\>' - endif - endif - " Eventually return q; set it to the default value now. - let q = open - while 1 " Look for preceding quote (open or close), ignoring - " math mode and '\"' . - call search(escape(open . boundary . close . '\|^$\|"', "~"), "bw") - if synIDattr(synID(line("."), col("."), 1), "name") !~ "^texMath" - \ && (col(".") == 1 || getline(".")[col(".")-2] != '\') - break - endif - endwhile - " Now, test whether we actually found a _preceding_ quote; if so, is it - " an open quote? - if ( line(".") < l || line(".") == l && col(".") < c ) - if strpart(getline("."), col(".")-1) =~ - \ '\V\^' . escape(open, '\') - if line(".") == l && col(".") + strlen(open) == c - " Insert "<++>''<++>" instead of just "''". - let q = IMAP_PutTextWithMovement("<++>".close."<++>") - else - let q = close - endif - endif - endif - " Return to line l, column c: - execute restore_cursor - " Start with <Del> to remove the " put in by the :imap . - return "\<Del>" . q - endfunction - - endif - " }}} - " SmartBS: smart backspacing {{{ - if g:Tex_SmartKeyBS - - " SmartBS: smart backspacing - " SmartBS lets you treat diacritic characters (those \'{a} thingies) as a - " single character. This is useful for example in the following situation: - " - " \v{s}\v{t}astn\'{y} ('happy' in Slovak language :-) ) - " If you will delete this normally (without using smartBS() function), you - " must press <BS> about 19x. With function smartBS() you must press <BS> only - " 7x. Strings like "\v{s}", "\'{y}" are considered like one character and are - " deleted with one <BS>. - let s:smartBS_pat = Tex_GetVarValue('Tex_SmartBSPattern') - - fun! s:SmartBS_pat() - return s:smartBS_pat - endfun - - " This function comes from Benji Fisher <be...@e-...> - " http://vim.sourceforge.net/scripts/download.php?src_id=409 - " (modified/patched by Lubomir Host 'rajo' <host8 AT keplerDOTfmphDOTuniba.sk>) - function! s:SmartBS(pat) - let init = strpart(getline("."), 0, col(".")-1) - let matchtxt = matchstr(init, a:pat) - if matchtxt != '' - let bstxt = substitute(matchtxt, '.', "\<bs>", 'g') - return bstxt - else - return "\<bs>" - endif - endfun - - endif " }}} - " SmartDots: inserts \cdots instead of ... in math mode otherwise \ldots {{{ - " if amsmath package is detected then just use \dots and let amsmath take care - " of it. - if g:Tex_SmartKeyDot - - function! <SID>SmartDots() - if strpart(getline('.'), col('.')-3, 2) == '..' && - \ g:Tex_package_detected =~ '\<amsmath\>' - return "\<bs>\<bs>\\dots" - elseif synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath' - \&& strpart(getline('.'), col('.')-3, 2) == '..' - return "\<bs>\<bs>\\cdots" - elseif strpart(getline('.'), col('.')-3, 2) == '..' - return "\<bs>\<bs>\\ldots" - else - return '.' - endif - endfunction - - endif - " }}} - - " ============================================================================== " Helper Functions " ============================================================================== --- 170,173 ---- *************** *** 719,722 **** --- 581,722 ---- endfunction " }}} + " ============================================================================== + " Smart key-mappings + " ============================================================================== + " TexQuotes: inserts `` or '' instead of " {{{ + if g:Tex_SmartKeyQuote + + " TexQuotes: inserts `` or '' instead of " + " Taken from texmacro.vim by Benji Fisher <be...@e-...> + " TODO: Deal with nested quotes. + " The :imap that calls this function should insert a ", move the cursor to + " the left of that character, then call this with <C-R>= . + function! s:TexQuotes() + let l = line(".") + let c = col(".") + let restore_cursor = l . "G" . virtcol(".") . "|" + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + " In math mode, or when preceded by a \, just move the cursor past the + " already-inserted " character. + if synIDattr(synID(l, c, 1), "name") =~ "^texMath" + \ || (c > 1 && getline(l)[c-2] == '\') + return "\<Right>" + endif + " Find the appropriate open-quote and close-quote strings. + if exists("b:Tex_SmartQuoteOpen") + let open = b:Tex_SmartQuoteOpen + elseif exists("g:Tex_SmartQuoteOpen") + let open = g:Tex_SmartQuoteOpen + else + let open = "``" + endif + if exists("b:Tex_SmartQuoteClose") + let close = b:Tex_SmartQuoteClose + elseif exists("g:Tex_SmartQuoteClose") + let close = g:Tex_SmartQuoteClose + else + let close = "''" + endif + let boundary = '\|' + " This code seems to be obsolete, since this script variable is never + " set. The idea is that some languages use ",," as an open- or + " close-quote string, and we want to avoid confusing ordinary "," + " with a quote boundary. + if exists("s:TeX_strictquote") + if( s:TeX_strictquote == "open" || s:TeX_strictquote == "both" ) + let boundary = '\<' . boundary + endif + if( s:TeX_strictquote == "close" || s:TeX_strictquote == "both" ) + let boundary = boundary . '\>' + endif + endif + " Eventually return q; set it to the default value now. + let q = open + while 1 " Look for preceding quote (open or close), ignoring + " math mode and '\"' . + call search(escape(open . boundary . close . '\|^$\|"', "~"), "bw") + if synIDattr(synID(line("."), col("."), 1), "name") !~ "^texMath" + \ && (col(".") == 1 || getline(".")[col(".")-2] != '\') + break + endif + endwhile + " Now, test whether we actually found a _preceding_ quote; if so, is it + " an open quote? + if ( line(".") < l || line(".") == l && col(".") < c ) + if strpart(getline("."), col(".")-1) =~ + \ '\V\^' . escape(open, '\') + if line(".") == l && col(".") + strlen(open) == c + " Insert "<++>''<++>" instead of just "''". + let q = IMAP_PutTextWithMovement("<++>".close."<++>") + else + let q = close + endif + endif + endif + " Return to line l, column c: + execute restore_cursor + " Start with <Del> to remove the " put in by the :imap . + return "\<Del>" . q + endfunction + + endif + " }}} + " SmartBS: smart backspacing {{{ + if g:Tex_SmartKeyBS + + " SmartBS: smart backspacing + " SmartBS lets you treat diacritic characters (those \'{a} thingies) as a + " single character. This is useful for example in the following situation: + " + " \v{s}\v{t}astn\'{y} ('happy' in Slovak language :-) ) + " If you will delete this normally (without using smartBS() function), you + " must press <BS> about 19x. With function smartBS() you must press <BS> only + " 7x. Strings like "\v{s}", "\'{y}" are considered like one character and are + " deleted with one <BS>. + let s:smartBS_pat = Tex_GetVarValue('Tex_SmartBSPattern') + + fun! s:SmartBS_pat() + return s:smartBS_pat + endfun + + " This function comes from Benji Fisher <be...@e-...> + " http://vim.sourceforge.net/scripts/download.php?src_id=409 + " (modified/patched by Lubomir Host 'rajo' <host8 AT keplerDOTfmphDOTuniba.sk>) + function! s:SmartBS(pat) + let init = strpart(getline("."), 0, col(".")-1) + let matchtxt = matchstr(init, a:pat) + if matchtxt != '' + let bstxt = substitute(matchtxt, '.', "\<bs>", 'g') + return bstxt + else + return "\<bs>" + endif + endfun + + endif " }}} + " SmartDots: inserts \cdots instead of ... in math mode otherwise \ldots {{{ + " if amsmath package is detected then just use \dots and let amsmath take care + " of it. + if g:Tex_SmartKeyDot + + function! <SID>SmartDots() + if strpart(getline('.'), col('.')-3, 2) == '..' && + \ g:Tex_package_detected =~ '\<amsmath\>' + return "\<bs>\<bs>\\dots" + elseif synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath' + \&& strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\cdots" + elseif strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\ldots" + else + return '.' + endif + endfunction + + endif + " }}} + " source texproject.vim before other files exe 'source '.s:path.'/texproject.vim' *************** *** 948,951 **** exec 'pyfile '.expand('<sfile>:p:h').'/pytools.py' ! " vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap --- 948,951 ---- exec 'pyfile '.expand('<sfile>:p:h').'/pytools.py' ! call Tex_Debug("main.vim: $Revision$", "rev") " vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap |