[Vim-latex-cvs] vimfiles/ftplugin/latex-suite main.vim,1.40,1.41
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-07-10 09:52:14
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv16421/latex-suite Modified Files: main.vim Log Message: Trying to robustify the grep commands which are used to search for \labels etc using a new function Tex_EscapeForGrep. Use this henceforth whenever we :grep for something from within vim. Index: main.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** main.vim 17 Jun 2003 02:12:29 -0000 1.40 --- main.vim 10 Jul 2003 09:52:11 -0000 1.41 *************** *** 470,473 **** --- 470,493 ---- let s:incnum = a:val endfunction " }}} + " Tex_EscapeForGrep: escapes \ and " the correct number of times {{{ + " Description: This command escapes the backslash and double quotes in a + " search pattern the correct number of times so it can be used in the :grep + " command. This command is meant to be used as: + " exec "silent! grep '".Tex_EscapeForGrep(pattern)."' file" + " NOTE: The pattern in the grep command should _always_ be enclosed in + " single quotes (not double quotes) for robust performance. + function! Tex_EscapeForGrep(string) + " This first escaping is so that grep gets a string like '\\bibitem' when + " we want to search for a string like '\bibitem'. + let retVal = escape(a:string, "\\") + " The next escape is because when the shellxquote is ", then the grep + " commad is usually called as bash -c "grep pattern filename" which means + " that we need to escape backslashes (because they get halved) and also + " double quotes. + if &shellxquote == '"' + let retVal = escape(retVal, "\"\\") + endif + return retVal + endfunction " }}} " Functions for debugging {{{ " Tex_Debug: appends the argument into s:debugString {{{ |