Re: [Vim-latex-devel] new version of imaps.vim
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2002-12-17 03:34:35
|
Srinath Avadhanula wrote: > >>:fun! IMAP(lhs, rhs, ft, ...) >> >>compatible with the original, but allowing optional place-holders? In >>other words, use the calling pattern that you came up with for Tex_IMAPS(). > > Hmm... Its kinda sad to have to abandon the better idea because of some > artificial limitation like this :( Well, the thing above is not so bad I > suppose. For all practical purposes, it will be as extensible as the new > idea... I am also reluctant to abandon the "new" (old new?) method, having gone to the trouble of implementing it, but this seems like the right thing to do. [snip discussion of iconv] > Will this mean an end to our encoding woes at last without having to > change encoding to and fro? That will be good news indeed. As long as our templates do not use non-standard characters, the main problems will go away (unless I am missing something). If the user chooses place holders, or an a:lhs (maybe a:rhs) for IMAP(), that uses non-standard characters, there may still be trouble, and I think we can get around it with iconv(). > So time to come up with a plan again... What are the > IMAP() and IMAP_PutTextWithMovement() functions going to look like? > I guess before implementing the functions themselves, we can design the > prototypes: > > " IMAP: set up a filetype specific mapping. > " Description: > " "maps" the lhs to rhs in files of type 'ft'. If supplied with 2 > " additional arguments, then those are assumed to be the placeholder > " characters in rhs. If unspecified, then the placeholder characters > " are assumed to be '<+' and '+>' These placeholder characters in > " a:rhs are replaced with the users setting of > " [bg]:Imap_PlaceHolderStart and [bg]:Imap_PlaceHolderEnd settings. > " > function! IMAP(lhs, rhs, ft, ...) I think that, if left unspecified, the placeholders go through the same logic as before: [bg]:Imap_PlaceHolderStart and [bg]:Imap_PlaceHolderEnd, then default to '<+' and '+>'. The optional arguments should always be supplied, except in two cases: (1) a:rhs does not contain any place holders (not even for cursor placement) (2) in an ftplugin or similar file, where b:Imap_PlaceHolderStart and b:Imap_PlaceHolderEnd have been defined. > " IMAP_PutTextWithMovement: returns the string with movement appended > " Description: > " If a:str contains "placeholders", then appends movement commands to > " str in a way that the user moves to the first placeholder and enters > " insert or select mode. If supplied with 2 additional arguments, then > " they are assumed to be the placeholder specs. Otherwise, they are > " assumed to be '<+' and '+>'. These placeholder chars are replaced > " with the users settings of [bg]:Imap_PlaceHolderStart and > " [bg]:Imap_PlaceHolderEnd. > function! IMAP_PutTextWithMovement(str, ...) Same comment. > Srinath I may have a little time tomorrow to work on this. (Morning: write solutions to exam. Afternoon: proctor the exam. How do I fit in some vimming? Bring my laptop and use the school's wireless network! ;) Then comes the grading ...) --Benji |