Revision: 1100
http://vim-latex.svn.sourceforge.net/vim-latex/?rev=1100&view=rev
Author: tmaas
Date: 2010-01-28 15:25:31 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
switch to insert mode if <F9>completion failed
- Switch back to insert mode when completion failed for \cite, because no
bibtex info was found, or when completion was aborted with "q"
Modified Paths:
--------------
trunk/vimfiles/ftplugin/latex-suite/texviewer.vim
Modified: trunk/vimfiles/ftplugin/latex-suite/texviewer.vim
===================================================================
--- trunk/vimfiles/ftplugin/latex-suite/texviewer.vim 2010-01-28 14:54:59 UTC (rev 1099)
+++ trunk/vimfiles/ftplugin/latex-suite/texviewer.vim 2010-01-28 15:25:31 UTC (rev 1100)
@@ -180,14 +180,8 @@
else
let s:word = expand('<cword>')
if s:word == ''
- if col('.') == strlen(getline('.'))
- startinsert!
- return
- else
- normal! l
- startinsert
- return
- endif
+ call Tex_SwitchToInsertMode()
+ return
endif
call Tex_Debug("silent! grep! ".Tex_EscapeForGrep('\<'.s:word.'\>')." *.tex", 'view')
call Tex_Grep('\<'.s:word.'\>', '*.tex')
@@ -237,12 +231,7 @@
endif
" Return to Insert mode
- if col('.') == strlen(getline('.'))
- startinsert!
- else
- normal! l
- startinsert
- endif
+ call Tex_SwitchToInsertMode()
endfunction " }}}
" ==============================================================================
@@ -449,12 +438,7 @@
if exists("s:prefix")
echomsg 'No bibkey, label or word beginning with "'.s:prefix.'"'
endif
- if col('.') == strlen(getline('.'))
- startinsert!
- else
- normal! l
- startinsert
- endif
+ call Tex_SwitchToInsertMode()
let v:errmsg = ''
call Tex_Debug('Tex_SyncPreviewWindow: got error E32, no matches found, quitting', 'view')
return 0
@@ -791,6 +775,7 @@
exec 'nnoremap <buffer> q '
\ .':cd '.s:origdir.'<CR>'
\ .':close<CR>'
+ \ .':call Tex_SwitchToInsertMode()<CR>'
" once the buffer is initialized, go back to the original settings.
setlocal nomodifiable
@@ -896,6 +881,7 @@
function! Tex_StartCiteCompletion()
let bibfiles = Tex_FindBibFiles()
if bibfiles !~ '\S'
+ call Tex_SwitchToInsertMode()
echohl WarningMsg
echomsg 'No bibfiles found! Sorry'
echohl None
@@ -921,7 +907,7 @@
nmap <buffer> <silent> f <Plug>Tex_FilterBibEntries
nmap <buffer> <silent> s <Plug>Tex_SortBibEntries
nmap <buffer> <silent> a <Plug>Tex_RemoveBibFilters
- nmap <buffer> <silent> q :close<CR>
+ nmap <buffer> <silent> q :close<CR>:call Tex_SwitchToInsertMode()<CR>
nmap <buffer> <silent> <CR> <Plug>Tex_CompleteCiteEntry
endfunction " }}}
@@ -1069,6 +1055,18 @@
call Tex_CompleteWord(ref, strlen(s:prefix))
endfunction " }}}
+" Tex_SwitchToInsertMode: Switch to insert mode {{{
+" Description: This is usually called when completion is finished
+function! Tex_SwitchToInsertMode()
+ call Tex_Debug(":Tex_SwitchToInsertMode: ", "view")
+ if col('.') == strlen(getline('.'))
+ startinsert!
+ else
+ normal! l
+ startinsert
+ endif
+endfunction " }}}
+
com! -nargs=0 TClearCiteHist unlet! s:citeSearchHistory
" vim:fdm=marker:nowrap:noet:ff=unix:ts=4:sw=4
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|