[Vim-latex-cvs] vimfiles/ftplugin/tex texviewer.vim,1.31,1.31.2.1
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-08-28 19:22:22
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex
In directory sc8-pr-cvs1:/tmp/cvs-serv2617
Modified Files:
Tag: filebrowser-branch
texviewer.vim
Log Message:
Modification and refactoring this file to
1. Make it style-wise consistent with the rest of latex-suite
2. make it use filebrowser.vim instead of the standard explorer.vim
Index: texviewer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/texviewer.vim,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -C2 -d -r1.31 -r1.31.2.1
*** texviewer.vim 10 Jul 2003 09:52:10 -0000 1.31
--- texviewer.vim 28 Aug 2003 19:22:14 -0000 1.31.2.1
***************
*** 17,21 ****
" Tex_SetTexViewerMaps: sets maps for this ftplugin {{{
function! Tex_SetTexViewerMaps()
! inoremap <silent> <Plug>Tex_Completion <Esc>:call Tex_completion("default","text")<CR>
if !hasmapto('<Plug>Tex_Completion', 'i')
if has('gui_running')
--- 17,21 ----
" Tex_SetTexViewerMaps: sets maps for this ftplugin {{{
function! Tex_SetTexViewerMaps()
! inoremap <silent> <Plug>Tex_Completion <Esc>:call Tex_Complete("default","text")<CR>
if !hasmapto('<Plug>Tex_Completion', 'i')
if has('gui_running')
***************
*** 30,73 ****
call Tex_SetTexViewerMaps()
" }}}
! command -nargs=1 TLook call <SID>Tex_look(<q-args>)
! command -nargs=1 TLookAll call <SID>Tex_lookall(<q-args>)
! command -nargs=1 TLookBib call <SID>Tex_lookbib(<q-args>)
!
! function! s:Tex_lookall(what)
! call Tex_completion(a:what, "all")
! endfunction
!
! function! s:Tex_lookbib(what)
! call Tex_completion(a:what, "bib")
! endfunction
!
! function! s:Tex_look(what)
! call Tex_completion(a:what, "tex")
! endfunction
!
! if getcwd() != expand("%:p:h")
! let s:search_directory = expand("%:p:h") . '/'
! else
! let s:search_directory = ''
! 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}{'
! let g:Tex_completion_addcontentsline = 'lof}{figure}{,lot}{table}{,toc}{chapter}{,toc}{part}{,'.
! \ 'toc}{section}{,toc}{subsection}{,toc}{paragraph}{,'.
! \ 'toc}{subparagraph}{'
! " }}}
!
! " Tex_completion: main function {{{
" Description:
! "
! function! Tex_completion(what, where)
" Get info about current window and position of cursor in file
let s:winnum = winnr()
let s:pos = line('.').' | normal! '.virtcol('.').'|'
! let s:col = col('.')
if a:where == "text"
--- 30,57 ----
call Tex_SetTexViewerMaps()
" }}}
+ command -nargs=1 TLook call Tex_Complete(<q-args>, 'tex')
+ command -nargs=1 TLookAll call Tex_Complete(<q-args>, 'all')
+ command -nargs=1 TLookBib call Tex_Complete(<q-args>, 'bib')
! " ==============================================================================
! " Main completion function
! " ==============================================================================
! " Tex_Complete: main function {{{
" Description:
! function! Tex_Complete(what, where)
" Get info about current window and position of cursor in file
let s:winnum = winnr()
+
+ " Change to the directory of the file being edited before running all the
+ " :grep commands. We will change back to the original directory after we
+ " finish with the grep.
+ let s:origdir = getcwd()
+ cd %:p:h
+
let s:pos = line('.').' | normal! '.virtcol('.').'|'
!
! unlet! s:type
! unlet! s:typeoption
if a:where == "text"
***************
*** 89,102 ****
let s:typeoption = substitute(s:curline, pattern, '\2', 'e')
call Tex_Debug('s:type = '.s:type.', typeoption = '.s:typeoption, 'view')
- else
- unlet! s:type
- unlet! s:typeoption
endif
if exists("s:type") && s:type =~ 'ref'
! call Tex_Debug("silent! grep! '".Tex_EscapeForGrep('\label{'.s:prefix)."' ".s:search_directory.'*.tex', 'view')
! exec "silent! grep! '".Tex_EscapeForGrep('\label{'.s:prefix)."' ".s:search_directory.'*.tex'
redraw!
! call <SID>Tex_c_window_setup()
elseif exists("s:type") && s:type =~ 'cite'
--- 73,83 ----
let s:typeoption = substitute(s:curline, pattern, '\2', 'e')
call Tex_Debug('s:type = '.s:type.', typeoption = '.s:typeoption, 'view')
endif
if exists("s:type") && s:type =~ 'ref'
! call Tex_Debug("silent! grep! '".Tex_EscapeForGrep('\label{'.s:prefix)."' *.tex", 'view')
! exec "silent! grep! '".Tex_EscapeForGrep('\label{'.s:prefix)."' *.tex"
redraw!
! call <SID>Tex_SetupCWindow()
elseif exists("s:type") && s:type =~ 'cite'
***************
*** 109,118 ****
silent! grep! ____HIGHLY_IMPROBABLE___ %
if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory')
! call <SID>Tex_c_window_setup(s:citeSearchHistory)
else
call Tex_Debug('calling Tex_GrepForBibItems', 'bib')
call Tex_GrepForBibItems(s:prefix)
redraw!
! call <SID>Tex_c_window_setup()
endif
if g:Tex_RememberCiteSearch && &ft == 'qf'
--- 90,99 ----
silent! grep! ____HIGHLY_IMPROBABLE___ %
if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory')
! call <SID>Tex_SetupCWindow(s:citeSearchHistory)
else
call Tex_Debug('calling Tex_GrepForBibItems', 'bib')
call Tex_GrepForBibItems(s:prefix)
redraw!
! call <SID>Tex_SetupCWindow()
endif
if g:Tex_RememberCiteSearch && &ft == 'qf'
***************
*** 124,154 ****
elseif exists("s:type") && (s:type =~ 'includegraphics' || s:type == 'psfig')
! let s:storehidefiles = g:explHideFiles
! let g:explHideFiles = '^\.,\.tex$,\.bib$,\.bbl$,\.zip$,\.gz$'
! exe 'silent! Sexplore '.s:search_directory.g:Tex_ImageDir
! call <SID>Tex_explore_window("includegraphics")
elseif exists("s:type") && s:type == 'bibliography'
! let s:storehidefiles = g:explHideFiles
! let g:explHideFiles = '^\.,\.[^b]..$'
! exe 'silent! Sexplore '.s:search_directory
! call <SID>Tex_explore_window("bibliography")
elseif exists("s:type") && s:type =~ 'include\(only\)\='
! 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('s:type') && 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
--- 105,133 ----
elseif exists("s:type") && (s:type =~ 'includegraphics' || s:type == 'psfig')
! call Tex_SetupFileCompletion(
! \ '',
! \ '^\.\\|\.tex$\\|\.bib$\\|\.bbl$\\|\.zip$\\|\.gz$',
! \ 'noext')
elseif exists("s:type") && s:type == 'bibliography'
! call Tex_SetupFileCompletion(
! \ '\.b..$',
! \ '',
! \ 'noext')
elseif exists("s:type") && s:type =~ 'include\(only\)\='
! call Tex_SetupFileCompletion(
! \ '\.t..$',
! \ '',
! \ 'noext')
elseif exists("s:type") && s:type == 'input'
! call Tex_SetupFileCompletion(
! \ '',
! \ '',
! \ 'ext')
elseif exists('s:type') && exists("g:Tex_completion_".s:type)
! call <SID>Tex_CompleteRefCiteCustom('plugin_'.s:type)
else
***************
*** 164,197 ****
endif
endif
! call Tex_Debug("silent! grep! '\\<".s:word."' ".s:search_directory.'*.tex', 'view')
! exe "silent! grep! '\\<".s:word."' ".s:search_directory.'*.tex'
! call <SID>Tex_c_window_setup()
endif
elseif a:where == 'tex'
" Process :TLook command
! exe "silent! grep! '".a:what."' ".s:search_directory.'*.tex'
! call <SID>Tex_c_window_setup()
elseif a:where == 'bib'
" Process :TLookBib command
! exe "silent! grep! '".a:what."' ".s:search_directory.'*.bib'
! exe "silent! grepadd! '".a:what."' ".s:search_directory.'*.bbl'
! call <SID>Tex_c_window_setup()
elseif a:where == 'all'
" Process :TLookAll command
! exe "silent! grep! '".a:what."' ".s:search_directory.'*'
! call <SID>Tex_c_window_setup()
endif
endfunction " }}}
! " Tex_c_window_setup: set maps and local settings for cwindow {{{
" Description: Set local maps jkJKq<cr> for cwindow. Also size and basic
" settings
"
! function! s:Tex_c_window_setup(...)
! call Tex_Debug('+Tex_c_window_setup', 'view')
cclose
exe 'copen '. g:Tex_ViewerCwindowHeight
--- 143,268 ----
endif
endif
! call Tex_Debug("silent! grep! '\\<".s:word."' *.tex", 'view')
! exe "silent! grep! '\\<".s:word."' *.tex"
+ call <SID>Tex_SetupCWindow()
endif
elseif a:where == 'tex'
" Process :TLook command
! exe "silent! grep! '".a:what."' *.tex"
! call <SID>Tex_SetupCWindow()
elseif a:where == 'bib'
" Process :TLookBib command
! exe "silent! grep! '".a:what."' *.bib"
! exe "silent! grepadd! '".a:what."' *.bbl"
! call <SID>Tex_SetupCWindow()
elseif a:where == 'all'
" Process :TLookAll command
! exe "silent! grep! '".a:what."' *"
! call <SID>Tex_SetupCWindow()
! endif
!
! endfunction " }}}
+ " Tex_CompleteWord: inserts a word at the chosen location {{{
+ " Description:
+ function! <SID>Tex_CompleteWord(completeword)
+ exe s:pos
+
+ " Complete word, check if add closing }
+ exe 'normal! a'.a:completeword."\<Esc>"
+
+ if getline('.')[col('.')-1] !~ '{' && getline('.')[col('.')] !~ '}'
+ exe "normal! a}\<Esc>"
+ endif
+
+ " Return to Insert mode
+ if col('.') == strlen(getline('.'))
+ startinsert!
+ else
+ normal! l
+ startinsert
endif
endfunction " }}}
!
! " ==============================================================================
! " File name completion helper functons
! " ==============================================================================
! " Tex_SetupFileCompletion: {{{
! " Description:
! function! Tex_SetupFileCompletion(accept, reject, ext)
! call FB_SetVar('FB_AllowRegexp', a:accept)
! call FB_SetVar('FB_RejectRegexp', a:reject)
! call FB_SetVar('FB_CallBackFunction', 'Tex_CompleteFileName')
! call FB_SetVar('FB_CallBackFunctionArgs', '"'.a:ext.'"')
!
! call FB_OpenFileBrowser('.')
! endfunction " }}}
! " Tex_CompleteFileName: {{{
! " Description:
! function! Tex_CompleteFileName(filename, ext)
! call Tex_Debug('getting filename = '.a:filename, 'view')
!
! let completeword = Tex_RelPath(a:filename, expand('%:p'))
! if a:ext == 'noext'
! let completeword = fnamemodify(completeword, ':r')
! endif
!
! call Tex_CompleteWord(completeword)
! endfunction " }}}
! " Tex_Common: common part of strings {{{
! function! s:Tex_Common(path1, path2)
! " Assume the caller handles 'ignorecase'
! if a:path1 == a:path2
! return a:path1
! endif
! let n = 0
! while a:path1[n] == a:path2[n]
! let n = n+1
! endwhile
! return strpart(a:path1, 0, n)
! endfunction " }}}
! " Tex_NormalizePath: {{{
! " Description:
! function! Tex_NormalizePath(path)
! let retpath = a:path
! if has("win32") || has("win16") || has("dos32") || has("dos16")
! let retpath = substitute(retpath, '\\', '/', 'ge')
! endif
! if isdirectory(retpath) && retpath !~ '/$'
! let retpath = retpath.'/'
! endif
! return retpath
! endfunction " }}}
! " Tex_RelPath: ultimate file name {{{
! function! Tex_RelPath(explfilename,texfilename)
! let path1 = Tex_NormalizePath(a:explfilename)
! let path2 = Tex_NormalizePath(a:texfilename)
!
! let n = matchend(<SID>Tex_Common(path1, path2), '.*/')
! let path1 = strpart(path1, n)
! let path2 = strpart(path2, n)
! if path2 !~ '/'
! let subrelpath = ''
! else
! let subrelpath = substitute(path2, '[^/]\{-}/', '../', 'ge')
! let subrelpath = substitute(subrelpath, '[^/]*$', '', 'ge')
! endif
! let relpath = subrelpath.path1
! return escape(Tex_NormalizePath(relpath), ' ')
! endfunction " }}}
!
! " ==============================================================================
! " Ref/Cite completion helper functions
! " ==============================================================================
! " Tex_SetupCWindow: set maps and local settings for cwindow {{{
" Description: Set local maps jkJKq<cr> for cwindow. Also size and basic
" settings
"
! function! s:Tex_SetupCWindow(...)
! call Tex_Debug('+Tex_SetupCWindow', 'view')
cclose
exe 'copen '. g:Tex_ViewerCwindowHeight
***************
*** 208,212 ****
let s:scrollOffVal = &scrolloff
! call <SID>UpdateViewerWindow()
" If everything went well, then we should be situated in the quickfix
--- 279,283 ----
let s:scrollOffVal = &scrolloff
! call <SID>Tex_SyncPreviewWindow()
" If everything went well, then we should be situated in the quickfix
***************
*** 218,277 ****
endif
! nnoremap <buffer> <silent> j j:call <SID>UpdateViewerWindow()<CR>
! nnoremap <buffer> <silent> k k:call <SID>UpdateViewerWindow()<CR>
! nnoremap <buffer> <silent> <up> <up>:call <SID>UpdateViewerWindow()<CR>
! nnoremap <buffer> <silent> <down> <down>:call <SID>UpdateViewerWindow()<CR>
" Change behaviour of <cr> only for 'ref' and 'cite' context.
! if exists("s:type") && s:type =~ 'ref'
! exec 'nnoremap <buffer> <silent> <cr> :set scrolloff='.s:scrollOffVal.'<CR>:silent! call <SID>CompleteName("ref")<CR>'
!
! elseif exists("s:type") && s:type =~ 'cite'
! exec 'nnoremap <buffer> <silent> <cr> :set scrolloff='.s:scrollOffVal.'<CR>:silent! call <SID>CompleteName("cite")<CR>'
else
" In other contexts jump to place described in cwindow and close small
" windows
! exec 'nnoremap <buffer> <silent> <cr> :set scrolloff='.s:scrollOffVal.'<CR>:call <SID>GoToLocation()<cr>'
endif
nnoremap <buffer> <silent> J :wincmd j<cr><c-e>:wincmd k<cr>
nnoremap <buffer> <silent> K :wincmd j<cr><c-y>:wincmd k<cr>
! exe 'nnoremap <buffer> <silent> q :set scrolloff='.s:scrollOffVal.'<CR>:call Tex_CloseSmallWindows()<cr>'
endfunction " }}}
! " Tex_CloseSmallWindows: {{{
! " Description:
! "
! function! Tex_CloseSmallWindows()
! exe s:winnum.' wincmd w'
! pclose!
! cclose
! exe s:pos
! endfunction " }}}
! " Tex_explore_window: settings for completion of filenames {{{
! " Description:
"
! function! s:Tex_explore_window(type)
! exe g:Tex_ExplorerHeight.' wincmd _'
! 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
! nnoremap <silent> <buffer> q :wincmd q<cr>
endfunction " }}}
! " UpdateViewerWindow: update error and preview window {{{
" Description: Usually quickfix engine takes care about most of these things
" but we discard it for better control of events.
"
! function! s:UpdateViewerWindow()
! call Tex_Debug('+UpdateViewerWindow', 'view')
let viewfile = matchstr(getline('.'), '^\f*\ze|\d')
--- 289,357 ----
endif
! nnoremap <buffer> <silent> j j:call <SID>Tex_SyncPreviewWindow()<CR>
! nnoremap <buffer> <silent> k k:call <SID>Tex_SyncPreviewWindow()<CR>
! nnoremap <buffer> <silent> <up> <up>:call <SID>Tex_SyncPreviewWindow()<CR>
! nnoremap <buffer> <silent> <down> <down>:call <SID>Tex_SyncPreviewWindow()<CR>
" Change behaviour of <cr> only for 'ref' and 'cite' context.
! if exists("s:type") && s:type =~ 'ref\|cite'
! exec 'nnoremap <buffer> <silent> <cr> '
! \ .':set scrolloff='.s:scrollOffVal.'<CR>'
! \ .':cd '.s:origdir.'<CR>'
! \ .':silent! call <SID>Tex_CompleteRefCiteCustom("'.s:type.'")<CR>'
else
" In other contexts jump to place described in cwindow and close small
" windows
! exec 'nnoremap <buffer> <silent> <cr> '
! \ .':set scrolloff='.s:scrollOffVal.'<CR>'
! \ .':cd '.s:origdir.'<CR>'
! \ .':call <SID>Tex_GoToLocation()<cr>'
endif
+ " Scroll the preview window while in the quickfix window
nnoremap <buffer> <silent> J :wincmd j<cr><c-e>:wincmd k<cr>
nnoremap <buffer> <silent> K :wincmd j<cr><c-y>:wincmd k<cr>
! " Exit the quickfix window without doing anything.
! exe 'nnoremap <buffer> <silent> q '
! \ .':set scrolloff='.s:scrollOffVal.'<CR>'
! \ .':cd '.s:origdir.'<CR>'
! \ .':call Tex_CloseSmallWindows()<CR>'
endfunction " }}}
! " Tex_CompleteRefCiteCustom: complete/insert name for current item {{{
! " Description: handle completion of items depending on current context
"
! function! s:Tex_CompleteRefCiteCustom(type)
! if a:type =~ 'cite'
! if getline('.') =~ '\\bibitem{'
! let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}')
! else
! let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze,')
! endif
! let completeword = strpart(bibkey, strlen(s:prefix))
! elseif a:type =~ 'ref'
! let label = matchstr(getline('.'), '\\label{\zs.\{-}\ze}')
! let completeword = strpart(label, strlen(s:prefix))
! elseif a:type =~ '^plugin_'
! let type = substitute(a:type, '^plugin_', '', '')
! let completeword = <SID>Tex_DoCompletion(type)
!
! endif
+ call Tex_CloseSmallWindows()
+ call Tex_CompleteWord(completeword)
endfunction " }}}
! " Tex_SyncPreviewWindow: synchronize quickfix and preview window {{{
" Description: Usually quickfix engine takes care about most of these things
" but we discard it for better control of events.
"
! function! s:Tex_SyncPreviewWindow()
! call Tex_Debug('+Tex_SyncPreviewWindow', 'view')
let viewfile = matchstr(getline('.'), '^\f*\ze|\d')
***************
*** 311,315 ****
endif
let v:errmsg = ''
! call Tex_Debug('UpdateViewerWindow: got error E32, no matches found, quitting', 'view')
return 0
endif
--- 391,395 ----
endif
let v:errmsg = ''
! call Tex_Debug('Tex_SyncPreviewWindow: got error E32, no matches found, quitting', 'view')
return 0
endif
***************
*** 336,430 ****
endfunction " }}}
! " CompleteName: complete/insert name for current item {{{
! " Description: handle completion of items depending on current context
"
! function! s:CompleteName(type)
!
! if a:type =~ 'cite'
! if getline('.') =~ '\\bibitem{'
! let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}')
! else
! let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze,')
! endif
! let completeword = strpart(bibkey, strlen(s:prefix))
!
! elseif a:type =~ 'ref'
! let label = matchstr(getline('.'), '\\label{\zs.\{-}\ze}')
! 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)
! call EditEntry("", "edit")
! exe 'nnoremap <silent> <buffer> <cr> :silent! call <SID>CompleteName("'.a:type.'")<CR>'
! nnoremap <silent> <buffer> q :wincmd q<cr>
! return
!
! else
! if a:type == 'expl_noext'
! let ifile = substitute(line, '\..\{-}$', '', '')
! else
! let ifile = line
! endif
! 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)
! else
! let completeword = <SID>Tex_RelPath(filename, s:curfile)
! endif
!
! let g:explHideFiles = s:storehidefiles
! endif
!
! elseif a:type =~ '^plugin_'
! let type = substitute(a:type, '^plugin_', '', '')
! let completeword = <SID>Tex_DoCompletion(type)
!
! endif
!
! " Return to proper place in main window, close small windows
! if s:type =~ 'cite\|ref'
! exe s:winnum.' wincmd w'
! pclose!
! cclose
! elseif a:type =~ 'expl_ext\|expl_noext'
! q
! endif
!
exe s:pos
-
-
- " Complete word, check if add closing }
- exe 'normal! a'.completeword."\<Esc>"
-
- if getline('.')[col('.')-1] !~ '{' && getline('.')[col('.')] !~ '}'
- exe "normal! a}\<Esc>"
- endif
-
- " Return to Insert mode
- if col('.') == strlen(getline('.'))
- startinsert!
-
- else
- normal! l
- startinsert
-
- endif
-
endfunction " }}}
! " GoToLocation: Go to chosen location {{{
" Description: Get number of current line and go to this number
"
! function! s:GoToLocation()
!
pclose!
! exe 'cc ' . line('.')
cclose
!
endfunction " }}}
" Bibliography specific functions
" Tex_GrepForBibItems: grep main filename for bib items {{{
" Description:
--- 416,449 ----
endfunction " }}}
! " Tex_CloseSmallWindows: {{{
! " Description:
"
! function! Tex_CloseSmallWindows()
! exe s:winnum.' wincmd w'
! pclose!
! cclose
exe s:pos
endfunction " }}}
!
! " Tex_GoToLocation: Go to chosen location {{{
" Description: Get number of current line and go to this number
"
! function! s:Tex_GoToLocation()
pclose!
! let errmsg = v:errmsg
! let v:errmsg = ''
! exe 'silent! cc ' . line('.')
! " If the current buffer is modified, then split
! if v:errmsg =~ '^E37:'
! split
! exe 'silent! cc ' . line('.')
! endif
cclose
! let v:errmsg = errmsg
endfunction " }}}
+ " ==============================================================================
" Bibliography specific functions
+ " ==============================================================================
" Tex_GrepForBibItems: grep main filename for bib items {{{
" Description:
***************
*** 578,584 ****
endfunction " }}}
! " PromptForCompletion: prompts for a completion {{{
" Description:
! function! s:PromptForCompletion(texcommand,ask)
let common_completion_prompt =
--- 597,613 ----
endfunction " }}}
! " ==============================================================================
! " Custom Completion help functions/settings
! " ==============================================================================
! " Tex_completion_{var}: 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}{'
! let g:Tex_completion_addcontentsline = 'lof}{figure}{,lot}{table}{,toc}{chapter}{,toc}{part}{,'.
! \ 'toc}{section}{,toc}{subsection}{,toc}{paragraph}{,'.
! \ 'toc}{subparagraph}{'
! " }}}
! " Tex_PromptForCompletion: prompts for a completion {{{
" Description:
! function! s:Tex_PromptForCompletion(texcommand,ask)
let common_completion_prompt =
***************
*** 599,603 ****
"
function! s:Tex_DoCompletion(texcommand)
! let completion = <SID>PromptForCompletion(a:texcommand,'Choose a completion to insert: ')
if completion != ''
return completion
--- 628,632 ----
"
function! s:Tex_DoCompletion(texcommand)
! let completion = <SID>Tex_PromptForCompletion(a:texcommand, 'Choose a completion to insert: ')
if completion != ''
return completion
***************
*** 605,644 ****
return ''
endif
- endfunction " }}}
-
- " Tex_Common: common part of strings {{{
- function! s:Tex_Common(path1, path2)
- " Assume the caller handles 'ignorecase'
- if a:path1 == a:path2
- return a:path1
- endif
- let n = 0
- while a:path1[n] == a:path2[n]
- let n = n+1
- endwhile
- return strpart(a:path1, 0, n)
- endfunction " }}}
- " Tex_RelPath: ultimate file name {{{
- function! s:Tex_RelPath(explfilename,texfilename)
- let path1 = a:explfilename
- let path2 = a:texfilename
- if has("win32") || has("win16") || has("dos32") || has("dos16")
- let path1 = substitute(path1, '\\', '/', 'ge')
- let path2 = substitute(path2, '\\', '/', 'ge')
- endif
- let n = matchend(<SID>Tex_Common(path1, path2), '.*/')
- let path1 = strpart(path1, n)
- let path2 = strpart(path2, n)
- if path2 !~ '/'
- let subrelpath = ''
- else
- let subrelpath = substitute(path2, '[^/]\{-}/', '../', 'ge')
- let subrelpath = substitute(subrelpath, '[^/]*$', '', 'ge')
- endif
- let relpath = subrelpath.path1
- if has("win32") || has("win16") || has("dos32") || has("dos16")
- let relpath = substitute(relpath, '/', "\\", 'ge')
- endif
- return relpath
endfunction " }}}
--- 634,637 ----
|