[Vim-latex-cvs] vimfiles/ftplugin/tex texviewer.vim,1.9,1.10
Brought to you by:
srinathava,
tmaas
|
From: <mi...@us...> - 2003-04-11 21:22:02
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex
In directory sc8-pr-cvs1:/tmp/cvs-serv2443
Modified Files:
texviewer.vim
Log Message:
make explorer completion pluginable; small cleaning of the code
Index: texviewer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/texviewer.vim,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** texviewer.vim 11 Apr 2003 16:41:50 -0000 1.9
--- texviewer.vim 11 Apr 2003 21:21:58 -0000 1.10
***************
*** 40,44 ****
endif
! " CompletionVars: similar variables can be set in package files
let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt'
let g:Tex_completion_addtocontents = 'lof}{,lot}{,toc}{'
--- 40,44 ----
endif
! " CompletionVars: similar variables can be set in package files {{{
let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt'
let g:Tex_completion_addtocontents = 'lof}{,lot}{,toc}{'
***************
*** 46,49 ****
--- 46,50 ----
\ 'toc}{section}{,toc}{subsection}{,toc}{paragraph}{,'.
\ 'toc}{subparagraph}{'
+ " }}}
" Tex_viewer: main function {{{
***************
*** 59,66 ****
if a:where == "text"
" What to do after <F9> depending on context
let s:curline = strpart(getline('.'), col('.') - 40, 40)
let s:prefix = matchstr(s:curline, '{\zs.\{-}$')
let s:type = matchstr(s:curline, '\\\zs.\{-}\ze{.\{-}$')
! let g:type1 = s:type
if exists("s:type") && s:type =~ 'ref'
--- 60,69 ----
if a:where == "text"
" What to do after <F9> depending on context
+ let s:curfile = expand("%:p")
let s:curline = strpart(getline('.'), col('.') - 40, 40)
let s:prefix = matchstr(s:curline, '{\zs.\{-}$')
let s:type = matchstr(s:curline, '\\\zs.\{-}\ze{.\{-}$')
! let s:typeoption = matchstr(s:type, '\zs[.*]\ze')
! let s:type = matchstr(s:type, '.\{-}\ze')
if exists("s:type") && s:type =~ 'ref'
***************
*** 72,77 ****
let bibfiles = <SID>Tex_FindBibFiles()
let bblfiles = <SID>Tex_FindBblFiles()
- let g:bib = bibfiles
- let g:bbl = bblfiles
if bibfiles != ''
exe 'silent! grepadd! "@.*{'.s:prefix.'" '.bibfiles
--- 75,78 ----
***************
*** 85,89 ****
let s:storehidefiles = g:explHideFiles
let g:explHideFiles = '^\.,\.tex$,\.bib$,\.bbl$,\.zip$,\.gz$'
- let s:curfile = expand("%:p")
exe 'silent! Sexplore '.s:search_directory.g:Tex_ImageDir
call <SID>Tex_explore_window("includegraphics")
--- 86,89 ----
***************
*** 92,96 ****
let s:storehidefiles = g:explHideFiles
let g:explHideFiles = '^\.,\.[^b]..$'
- let s:curfile = expand("%:p")
exe 'silent! Sexplore '.s:search_directory
call <SID>Tex_explore_window("bibliography")
--- 92,95 ----
***************
*** 99,115 ****
let s:storehidefiles = g:explHideFiles
let g:explHideFiles = '^\.,\.[^t]..$'
- let s:curfile = expand("%:p")
exe 'silent! Sexplore '.s:search_directory
call <SID>Tex_explore_window("includefile")
elseif exists("s:type") && s:type == 'input'
- let s:curfile = expand("%:p")
exe 'silent! Sexplore '.s:search_directory
call <SID>Tex_explore_window("input")
elseif exists("g:Tex_completion_{s:type}")
- let g:type = s:type
call <SID>CompleteName('plugin_'.s:type)
else
let s:word = matchstr(s:curline, '\zs\k\{-}$')
--- 98,115 ----
let s:storehidefiles = g:explHideFiles
let g:explHideFiles = '^\.,\.[^t]..$'
exe 'silent! Sexplore '.s:search_directory
call <SID>Tex_explore_window("includefile")
elseif exists("s:type") && s:type == 'input'
exe 'silent! Sexplore '.s:search_directory
call <SID>Tex_explore_window("input")
elseif exists("g:Tex_completion_{s:type}")
call <SID>CompleteName('plugin_'.s:type)
+ elseif exists("s:type") && g:Tex_completion_explorer =~ ','.s:type
+ exe 'silent! Sexplore '.s:search_directory
+ call <SID>Tex_explore_window("plugintype")
+
else
let s:word = matchstr(s:curline, '\zs\k\{-}$')
***************
*** 140,144 ****
call <SID>Tex_c_window_setup()
! elseif a:where == "all"
" Process :TLookAll command
exe 'silent! grep! "'.a:what.'" '.s:search_directory.'*'
--- 140,144 ----
call <SID>Tex_c_window_setup()
! elseif a:where == 'all'
" Process :TLookAll command
exe 'silent! grep! "'.a:what.'" '.s:search_directory.'*'
***************
*** 191,202 ****
exe g:Tex_ExplorerHeight.' wincmd _'
! if a:type == 'includegraphics'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("includegraphics")<CR>
! elseif a:type == 'bibliography'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("bibliography")<CR>
! elseif a:type == 'includefile'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("includefile")<CR>
! elseif a:type == 'input'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("input")<CR>
endif
--- 191,200 ----
exe g:Tex_ExplorerHeight.' wincmd _'
! let g:type = a:type
!
! if a:type =~ 'includegraphics\|bibliography\|includefile'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("expl_noext")<CR>
! elseif a:type =~ 'input\|plugintype'
! nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("expl_ext")<CR>
endif
***************
*** 287,291 ****
let completeword = strpart(label, strlen(s:prefix))
! elseif a:type =~ 'includegraphics\|\<bibliography\>\|includefile\|\<input\>'
let line = substitute(strpart(getline('.'),0,b:maxFileLen),'\s\+$','','')
if isdirectory(b:completePath.line)
--- 285,289 ----
let completeword = strpart(label, strlen(s:prefix))
! elseif a:type =~ 'expl_ext\|expl_noext'
let line = substitute(strpart(getline('.'),0,b:maxFileLen),'\s\+$','','')
if isdirectory(b:completePath.line)
***************
*** 296,300 ****
else
! if a:type != 'input'
let ifile = substitute(line, '\..\{-}$', '', '')
else
--- 294,298 ----
else
! if a:type == 'expl_noext'
let ifile = substitute(line, '\..\{-}$', '', '')
else
***************
*** 303,307 ****
let filename = b:completePath.ifile
! if g:Tex_ImageDir != '' && a:type =~ 'includegraphics'
let imagedir = s:curfile . g:Tex_ImageDir
let completeword = <SID>Tex_RelPath(filename, imagedir)
--- 301,305 ----
let filename = b:completePath.ifile
! if g:Tex_ImageDir != '' && s:type =~ 'includegraphics'
let imagedir = s:curfile . g:Tex_ImageDir
let completeword = <SID>Tex_RelPath(filename, imagedir)
***************
*** 315,320 ****
elseif a:type =~ '^plugin_'
let type = substitute(a:type, '^plugin_', '', '')
! let completeword = Tex_DoCompletion(type)
! let g:comp = completeword
endif
--- 313,317 ----
elseif a:type =~ '^plugin_'
let type = substitute(a:type, '^plugin_', '', '')
! let completeword = <SID>Tex_DoCompletion(type)
endif
***************
*** 325,329 ****
pclose!
cclose
! elseif s:type =~ '\<bibliography\>\|include\|input'
wincmd q
endif
--- 322,326 ----
pclose!
cclose
! elseif a:type =~ 'expl_ext\|expl_noext'
wincmd q
endif
***************
*** 333,338 ****
" Complete word, check if add closing }
exe 'normal! a'.completeword."\<Esc>"
- let g:cword = completeword
- let g:cwlast = getline('.')[col('.')-1]
if getline('.')[col('.')-1] !~ '{' && getline('.')[col('.')] !~ '}'
--- 330,333 ----
***************
*** 369,372 ****
--- 364,368 ----
let bibfiles2 = ''
let curdir = expand("%:p:h")
+ let curdir = substitute(curdir, ' ', "\\", 'ge')
if search('\\bibliography{', 'w')
***************
*** 426,430 ****
" PromptForCompletion: prompts for a completion {{{
" Description:
! function! PromptForCompletion(texcommand,ask)
let common_completion_prompt =
--- 422,426 ----
" PromptForCompletion: prompts for a completion {{{
" Description:
! function! s:PromptForCompletion(texcommand,ask)
let common_completion_prompt =
***************
*** 444,448 ****
" Description:
"
! function! Tex_DoCompletion(texcommand)
let completion = PromptForCompletion(a:texcommand,'Choose a completion to insert: ')
if completion != ''
--- 440,444 ----
" Description:
"
! function! s:Tex_DoCompletion(texcommand)
let completion = PromptForCompletion(a:texcommand,'Choose a completion to insert: ')
if completion != ''
|