[Vim-latex-cvs] vimfiles/ftplugin/latex-suite envmacros.vim,1.35,1.36
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-09-13 07:06:46
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv25590
Modified Files:
envmacros.vim
Log Message:
New: For the fast command insertion, if the cursor is on a <cword> then use
that to construct a command. Otherwise, as before, prompt for a
command.
New: Utilize a new setting g:Tex_Com_{name} where name is a command name to
enable user customizable command completion.
Index: envmacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** envmacros.vim 12 Sep 2003 10:29:33 -0000 1.35
--- envmacros.vim 13 Sep 2003 07:06:41 -0000 1.36
***************
*** 559,563 ****
" This will effectively over-write the default definition of the
" theorem environment which uses a \label.
! if exists("g:Tex_Env_{'".a:env."'}")
return IMAP_PutTextWithMovement(g:Tex_Env_{a:env})
elseif a:env =~ 'equation*\|eqnarray*\|theorem\|lemma\|equation\|eqnarray\|align\*\|align\>\|multline'
--- 559,565 ----
" This will effectively over-write the default definition of the
" theorem environment which uses a \label.
! if exists("b:Tex_Env_{'".a:env."'}")
! return IMAP_PutTextWithMovement(b:Tex_Env_{a:env})
! elseif exists("g:Tex_Env_{'".a:env."'}")
return IMAP_PutTextWithMovement(g:Tex_Env_{a:env})
elseif a:env =~ 'equation*\|eqnarray*\|theorem\|lemma\|equation\|eqnarray\|align\*\|align\>\|multline'
***************
*** 870,873 ****
--- 872,880 ----
" Implementation of Fast Environment commands for LaTeX commands
" ==============================================================================
+ " Define certain commonly used command definitions {{{
+ "
+ TexLet g:Tex_Com_{'newtheorem'} = '\newtheorem{<+name+>}{<+caption+>}[<+within+>]'
+ TexLet g:Tex_Com_{'frac'} = '\frac{<+n+>}{<+d+>}<++>'
+ " }}}
" PromptForCommand: prompts for a command {{{
" Description:
***************
*** 892,895 ****
--- 899,908 ----
function! Tex_DoCommand(...)
if a:0 < 1
+ if getline('.') != ''
+ let lastword = expand('<cword>')
+ if lastword != ''
+ return substitute(lastword, '.', "\<bs>", 'g').Tex_PutCommand(lastword)
+ endif
+ endif
let com = PromptForCommand('Choose a command to insert: ')
if com != ''
***************
*** 906,912 ****
" Based on input argument, it calls various specialized functions.
function! Tex_PutCommand(com)
-
if exists("s:isvisual") && s:isvisual == "yes"
-
let s:isvisual = 'no'
--- 919,923 ----
***************
*** 918,932 ****
return VEnclose("\\".a:com.'{', '}', "\\".a:com.'{', '}')
endif
-
else
!
! if a:com == '$'
return IMAP_PutTextWithMovement('$<++>$')
else
return IMAP_PutTextWithMovement("\\".a:com.'{<++>}<++>')
endif
-
endif
-
endfunction " }}}
" Mapping the <F7> key to prompt/insert for command {{{
--- 929,943 ----
return VEnclose("\\".a:com.'{', '}', "\\".a:com.'{', '}')
endif
else
! if exists('b:Tex_Com_{"'.a:com.'"}')
! return IMAP_PutTextWithMovement(b:Tex_Com_{a:com})
! elseif exists('g:Tex_Com_{"'.a:com.'"}')
! return IMAP_PutTextWithMovement(g:Tex_Com_{a:com})
! elseif a:com == '$'
return IMAP_PutTextWithMovement('$<++>$')
else
return IMAP_PutTextWithMovement("\\".a:com.'{<++>}<++>')
endif
endif
endfunction " }}}
" Mapping the <F7> key to prompt/insert for command {{{
***************
*** 941,945 ****
let b:DoubleDollars = 0
- " Provide only <plug>s here. main.vim will create the actual maps.
inoremap <silent> <Plug>Tex_FastCommandInsert <C-r>=Tex_FastCommandInsert('no')<cr>
nnoremap <silent> <Plug>Tex_FastCommandInsert i<C-r>=Tex_FastCommandInsert('no')<cr>
--- 952,955 ----
***************
*** 952,956 ****
" Here we are not solving if we are in preamble, behaviour is always the
" same.
- "
function! Tex_FastCommandInsert(isvisual)
--- 962,965 ----
|