[Vim-latex-devel] Re: [Vim-latex-cvs] vimfiles/plugin imaps.vim,1.7,1.8
Brought to you by:
srinathava,
tmaas
From: Luc H. <her...@fr...> - 2002-12-09 16:55:20
|
* On Sun, Dec 08, 2002 at 06:54:47PM -0800, Srinath Avadhanula <sr...@fa...> wrote: > Therefore we could conceivably have ftplugin/c.vim containing lines > like: > let b:Imap_PlaceHolderStart = '?' > let b:Imap_PlaceHolderEnd = '?' > call IMAP('for', "for (??; ??; ??) {\n??\n}??", 'c') Indeed, but you loose flexibility in that case. The day the new language C% arise, it would not be able to take advantage of the C mapping for 'for' as it defines a new operator : '??' ;-) > The problem you mention is when some new language has legitimate > characters such as '<+' and Imap_PutTextWithMovement() tries to replace > those with the placeholder characters. That's my point: defining a highly evolutive and language/configuration independent plugin. > That problem can be solved by using a new function > Tex_PutTextWithMovement() instead of Imap_PutTextWithMovement() which > first replaces things like « (or '<+' or '!mark!') with the user's > choice and then calls Imap_PutTextWithMovement(). This makes That's an option. > > It is not really problematic ! I will use '!mark!' for instance > > (instead of '¡mark!' currently used) to express the markers (aka > > placeholders) > > Well, on further thinking, it does make sense to use longer things > like '!mark!' or something similar and then replace with the user's > placeholder choice in `Imap_PutTextWithMovement'()... > But this will mean again that the scripts themselves become really > long and unreadable... Not always. Check again the mappings ']em' and ']ee' I proposed you. The mecanics that permits such writings is very complex [1], but once written, the end-coders that write and maintain TeX (/HTML/...) code-snippets have a very easy job left. However, I must admit that my mappings for C&C++ constructs and common brackets are quite complex. [I think that today I should be able to simplify them as my VimL skills have improved.] > Well, there seems to be fair arguments for and against the using of > things like !mark!. But I would think that a solution where imaps is > completeley independent of the choice of placeholder characters is best. ['!mark!' is not a placeholder -- actually, this is a mapping with my settings ; it is replaced by maparg('!mark!', i')] And I definitively agree, functions like IMAPS() should be independent of any placeholder characters. Somehow, '<+' and '+>' (as well as '«' & '»' today) look like placeholders characters, and more important: they look like things that some languages may use -- like for instance '«' and '»' in LaTeX documents written in French. > And I think each language choosing its own placeholders is most > elegant and robust... 100% agree. [1] but it does not handle insert-mode mappings only ... command-, insert- and normal-mode mappings _and_ menus are handled. So, I think it is a fair price. -- Luc Hermitte |