[Vim-latex-devel] [devel] Re: multibyte in patterns & jumping to placeholders
Brought to you by:
srinathava,
tmaas
From: Luc H. <her...@fr...> - 2002-12-14 01:55:55
|
Benji, I answer your point about encoding on the vim-latex ML. * On Fri, Dec 13, 2002 at 06:21:15PM -0500, Benji Fisher <be...@me...> wrote: > More multi-byte woes. If 'encoding' is set to utf-8, then a MB > character does not match itself! > > :let foo = "\xab" > :set enc? > encoding=latin1 > :echo foo =~ foo > 1 > :set enc=utf8 > :set enc? > encoding=utf-8 > :echo foo =~ foo > 0 The same workaround than the one I used, seems to work. The important thing is that I require the encoding to be set before every else. It is a very reallistic requirement. The encoding is supposed to be set either by the system (red hat if I understood it well, $LANG, locale() & co) or by .vimrc. Therefore, 'encoding' is set before any other plugin is run. Then, we can notice that: :set enc=utf8 :let foo = "\xab" :echo foo =~ foo 0 does not work as it should, but: :set enc=utf8 :let foo = nr2char(char2nr("\xab")) :echo foo =~ foo 1 does ! Don't ask me why, but it does. Earlier this week I ask on the vim ML if somebody could test my latest version of my variation on Stephen Riehm's bracketing system, but I get no response. :-(( So I don't know if it correctly works with encodings other than latin1,2,15 or utf-8 set from .vimrc. > Is this expected, or is it a bug? Is there a work-around? Am I > supposed to do this? > :echo iconv(foo, 'latin1', &enc) =~ foo > 1 Hum, this is another quite odd workaround. Otherwise, looks like a bug to me. Or may be it concerns 'termencoding'. I don't know. ____________________ Regarding the other e-mail you sent on the vim-latex-devel ML. > " File: imaps.vim > [...] > " IMAP_Jumpfunc: takes user to next ?place-holder? {{{ > " Author: Gergely Kontra > " taken from mu-template.vim by him This idea is originally > " from Stephen Riehm's bracketing system. > " modified by SA to use optional place holder characters. > function! IMAP_Jumpfunc() That is not completly true. The version Gergely rewrote was a simplifed version over the function I originally wrote. I know he didn't wanted of the complexity of my function. So he get rid of the possibility of having different strings to express the markers (aka placeholders). [However, selecting the marker instead of echoing its value is Gergely idea] Then Srinath unaware of my function, I guess, reintroduced this functionnality. But several things are still missing. Here is a little list of other things taken into account in my function: - the 'wrapscan' option is used -- 'W' is not an acceptable option to 'search()', 'wrapscan' is meant to settle this issue. - It can jump forward or backward -- thanks to Robert Kelly IV (aka feral). - I leave the possibility to select _or_ erase the marker (/placeholder) we jump to -- select-mode is not always very handy. BTW, we can select empty markers instead of deleting them. - It can be configured thanks to options and '<Plug>xxxx' mappings. - It jumps to the next/prev marker even if the cursor is in the middle of a marker -- thanks to Robert again. - It is compatible with the two strings you use to define your placeholders -- I guessed you will not revert back to my original variation on Stephen's bracketing system. - It correclty works even when the marker (we jump to) is within a closed folder. - There is a documentation up to date. - It is compatible with the next version of mu-template I plan to release soon -- actually the version 0.29 of mu-template is compatible with my variation and with imaps.vim. But as the jumping function becomes quite complex, my version of bracketing.base.vim will be part of mu-template 0.30 and more. - The screen never flashes -- there exist other variations that make the screen flash. - It has been patched regarding the encoding issue -- but more tests should be done. I guess I will upload my last version on SF during by the end of this week-end. - It is maintained and will be maintained by myself: no need to reinvent the wheel or having 10 person fixing the same bug or adding the same feature at monthes (or years) of interval. So, if you agree with me to not waste energy, you can consider making http://hermitte.free.fr/vim/ressources/plugin/bracketing.base.vim part of vim-latex ; after all Srinath already put me in the credits for my variation on Stephen's bracketing system. ;-) In order to have the documentation and the mapping that inserts a marker around a visually-selected text (or the current word) and the documentation, two other files are required. Check the tarball archive: http://hermitte.free.fr/vim/ressources/ lh-map-tools.vim Have a nice week-end ! -- Luc Hermitte http://hermitte.free.fr/vim/ |