Re: [Vim-latex-devel] German quotation marks and `
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2003-01-16 17:35:21
|
Srinath Avadhanula wrote: > On Tue, 14 Jan 2003, Benji Fisher wrote: > > >> Change the defaults. Almost all Insert-mode mappings should be >>off by default. >> > > > That was not what I was looking for. I would still like German writers > to use `g for \gamma. Changing defaults only means that either we hide > the problems by default, or just ignore german users... I dont think > either is a solution. What I was looking for was ways to "solve" the > problem of things like `g getting expanded in unexpected places... OK, how about this: Introduce a new function in imaps.vim so that we can :call IMAP_Protect('\`') to protect an escaped single-open-quote. This new function will save the string '\`' in a script variable. Then, when IMAP_LookupCharacter() is deciding whether there is anything to be expanded, it will do something like " maybe off by one: :let line = strpart(getline("."), col(".")).a:char :let line = substitute(line, '\V\.\*\('.s:ProtectStrings.'\)', '', '') (I am not sure whether a:char should be appended before or after the substitute() line.) The script variable can have the form s:ProtectStrings = '\\`' . '\|' . '"`' (note that IMAP_Protect() applies escape(..., '\') before adding something to the script variable). Then, if the line up to the cursor contains either of the strings '\`' or '"`', everything up to and including the last occurrence will be removed by the substitute(). --Benji |