Re: [Vim-latex-cvs] vimfiles/plugin imaps.vim,1.9.2.4,1.9.2.5
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2002-12-19 12:35:26
|
sri...@us... wrote: > Update of /cvsroot/vim-latex/vimfiles/plugin > In directory sc8-pr-cvs1:/tmp/cvs-serv7443 > > Modified Files: > Tag: b-newimaps > imaps.vim > Log Message: > Comments on the last version: > > " Break text up into "initial <+template+> final"; any piece may be empty. > let initial = substitute(text, pattern, '\1', '') > let template = substitute(text, pattern, '\2', '') > let final = substitute(text, pattern, '\3', '') > > This assumes that there is only a single <+template+> in the text. Why do you say that? The cursor should be placed on template; all the place holders in final will be replaced. > Afterwards: > > let final = substitute(final, startpat, escape(phs, '\'), 'g') > let final = substitute(final, endpat, escape(phe, '\'), 'g') > > This will fail when the user uses something like: > > call Imap_PutTextWithMovement('bar?desc?', '?', '?') > with g:Imap_Place..Start = '<+' != g:Imap_Place...End > i.e when phs and phe are the same, but the [bg]:Imap_Place* settings arent. Yes, that should be fixed. I would fix it with let final = substitute(final, '\V'.startpat.'\(\.\{-}\)'.endpat, \ escape(phs, '\') . '\1' . escape(phe, '\'), 'g') I do not like your solution. Part of the reason for these new, optional arguments is that the following should work: :call IMAP("foo", "bar <++> <<cursor>> <++> <<next>>", "", "<<", ">>") I think your method breaks this. > Also, I dont think > > let marker = phs . phs . phe . phe > > is a "rare" enough string. As in the previous example, this could simply be > ????. We do _not_ want to accidentally delete stuff from the user's files. > > let marker = '<!--- @#% Start Here @#% ----!>' > > This sounds safer. Ofcourse, we could always make a search and be sure, but > I am willing to bet that this string will never happen on purpose in some > file. We only have to worry about the marker appearing in the text inserted by IMAP_PutTextWithMovement(). Can you think of an example where my marker is still there after the substitute() commands? > > Changes this time: > > 1. Cleaned up the IMAP_PutTextWithMovement() function. This function now > calls the IMAP_Jumpfunc() function instead of trying to do the same > thing. That sounds like an improvement. > 2. IMAP_Jumpfunc(): After suggestions from LH, implemented the option of > . not deleting empty placeholders. > . going up and down. (<C-J> and <C-K>) > . option of not deleting the placeholder while moving. > > TODO: > . command to insert placeholder at current position > . command to erase all placeholders. > > I am going to follow up this commit with another big one renaming all the > old Tex_IMAP()s to IMAP()s... After that, it is time to merge this branch > into the main trunk and get working on a next release version and also > solving the encoding problem once and for all... You forgot to mention testing. --Benji |