Thread: Re: [Vim-latex-cvs] Re: [Vim-latex-devel] Latest Version (30 Dec 2002)
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2003-01-05 13:02:17
|
Srinath: I will do something with this. According to the docs, iconv() should work between latin1 and utf-8 even when compiled with -iconv. If that is true, then Bartek must have some other encoding; did he ever tell you which one? I'll wrap the call to iconv() in a function, and put the comments there. Srinath Avadhanula wrote: > Hey Benji, > > We have a little issue here... Bartek couldn't use the macros because > his vim didn't come with +iconv. Since latex-suite itself doesn't use > any funky characters in the macros, could we have a way of making it > work OOTB with the default placeholders (which are also unfunky) without > needing +iconv? > > Maybe surround the iconv() functions in > > if !has('iconv') && !(&enc == 'utf-8' || &enc == 'latin1') > let textEnc = iconv(text, 'latin1', &enc) > else > let textEnc = text > endif > > and such... Maybe even have a custom s:Iconv() function which makes this > check so the change looks better. > > Again, since I haven't been upto speed on this encoding stuff, I do not > want to make changes myself. I dont even really know why our function > fails when it doesn't have iconv(). > > Also, can I ask why the following piece of code uses phs and phe and not > phsEnc and pheEnc? I asked this once before, so sorry for the repeat... > Could you put a short comment there? As of now, that piece of code is > kinda opaque to me.. > > " If there are no place holders, just return the text. > if textEnc !~ '\V'.phs.'\.\{-}'.phe > call IMAP_Debug('Not getting '.phs.' and '.phe.' in '.textEnc, 'imap') > return text > endif > > Thanks! > > Srinath > > ---------- Forwarded message ---------- > Date: Fri, 3 Jan 2003 12:43:11 +0100 > From: "[ISO-8859-2] Bart?omiej Siudeja" <si...@wp...> > To: Srinath Avadhanula <sr...@fa...> > Subject: Odp: Re: [Vim-latex-devel] Latest Version (30 Dec 2002) > > Hello Srinath, > > You can kill me. I don't included iconv option in my linux vim > compilation (this option is not default). Thus iconv() doesn't > work. Everything is now ok under linux with or without changes > in imaps.vim. > > Thanks and sorry > > Bartek |
From: Srinath A. <sr...@fa...> - 2003-01-05 20:05:30
|
Hey Benji, Thanks for the fix. On Sun, 5 Jan 2003, Benji Fisher wrote: > Srinath: > > I will do something with this. According to the docs, iconv() > should work between latin1 and utf-8 even when compiled with -iconv. If > that is true, then Bartek must have some other encoding; did he ever > tell you which one? > > I'll wrap the call to iconv() in a function, and put the comments > there. > I should have forwarded Bartek's emails to you as well... Anyway, this is the email in which he wrote about which encodings he uses and some other information... > Hello, > > I checked my encodings. > > Under Windows: > encoding=CP1250, fileencoding=? (empty string) > I have Windows XP Professional with polish language encoding. > > Under Linux I get ``option not supported'', but I know that I > have ISO-8859-2 (polish encoding) in my console. > > I didn't wrote this earlier, but IMAP_Jumpfunc() might be good > (in Linux), because Ctrl-J works good, only just after inserting > an environment cursor is wrongly placed. If you press Ctrl-J > cursor goes to the first placeholder. > > Earlier version (14 december 2002) of Latex-Suite works good on > my brother's Windows machine (he havn't got Linux), which is > quite similar to mine, including system and encoding, and the > same vim instalation. But this earlier version don't work on my > machine. > > Bartek Afterwards, he said that his linux machine didn't have +iconv, which made imaps not work properly. He compiled his vim with iconv support and imaps seemed to start working. So I asked him if he needed iconv only for latex-suite or whether he needed it otherwise also. He wrote: > Under Windows +iconv is enabled in binaries from www.vim.org. > So, iconv works good, but still placeholders are not completely > erased. > > Under Linux I am using ISO-8859-2 encoding in my system, and > without iconv I can use my language specific letters. So, iconv > is needed only for latex-suite. I still do not understand why the placeholders should not be "completeley erased"... Srinath |
From: Benji F. <be...@me...> - 2003-01-06 18:19:30
|
Srinath Avadhanula wrote: > Hey Benji, > > I should have forwarded Bartek's emails to you as well... Anyway, this > is the email in which he wrote about which encodings he uses and some > other information... > >>Hello, >> >>I checked my encodings. >> >>Under Windows: >>encoding=CP1250, fileencoding=? (empty string) >>I have Windows XP Professional with polish language encoding. I have not booted into W95 lately. Can someone else test this? >>Under Linux I get ``option not supported'', but I know that I >>have ISO-8859-2 (polish encoding) in my console. I tested with this encoding. Is it possible to use anything other than latin1 when compiled with -multi_byte? I cannot seem to compile with +multi_byte and -iconv ... Anyway, with my usual binary of vim (+multi_byte, +iconv, +++...) and ISO-8859-2 I do see weird results with the previous version of imaps.vim and it works with the latest version (1.21). This latest version only calls iconv() when there is a problem. (Usually, when the place holders are set to some funky characters and these characters do not match themselves in a pattern). It may not solve such problems, but it should not create any. >>I didn't wrote this earlier, but IMAP_Jumpfunc() might be good >>(in Linux), because Ctrl-J works good, only just after inserting >>an environment cursor is wrongly placed. If you press Ctrl-J >>cursor goes to the first placeholder. Yes, that is what I saw when I inserted a figure environment with EFI. >>Earlier version (14 december 2002) of Latex-Suite works good on >>my brother's Windows machine (he havn't got Linux), which is >>quite similar to mine, including system and encoding, and the >>same vim instalation. But this earlier version don't work on my >>machine. >> >>Bartek I hope the problem is solved. If not, please tell me how to compile a version of vim where the problem still pops up. If there are still problems on Windows, I am willing to reboot ... --Benji |
From: Mikolaj M. <mi...@wp...> - 2003-01-05 21:45:35
|
On Sun, Jan 05, 2003 at 08:10:20AM -0500, Benji Fisher wrote: > Srinath: > I will do something with this. According to the docs, iconv() > should work between latin1 and utf-8 even when compiled with -iconv. If > that is true, then Bartek must have some other encoding; did he ever > tell you which one? I suppose iso-8859-2 or cp1250 :) Mikolaj |
From: Luc H. <her...@fr...> - 2003-01-07 18:30:27
|
Hello, I have looked at imaps.vim, the version shipped with the archive made on the 3rd January. To be more precise, I've focused on the jumping function. So, I have several questions and remarks: - we don't have to test 'wrapscan', |search()| does it implicitly for us - The jumpBack does not work correclty. Try for instance: :vmap <C-k> <Plug>IMAP_JumpBack i<+foo+> <+bar+> <+three+> <esc>gg ^J^J^K - the mappings are not silent. - why do you need a specific jump function to use with IMAP() ? I haven't looked in the mecanics, but I find this odd ; I didn't need such a thing with µTemplate. Otherwise, I've integrated in bracketing.base.vim some of the things you use [thanks!]: - the 'nomagic' stuff ; BTW, the psh and phe strings need to have their '\' escaped -- I haven't checked if it is needed for other characters. - I don't mess with @" anymore - less screen flashes (s/<esc><c-l>/<c-\><c-n>) And: - I've managed the visual selection in another way that does not mess with the search-history at all-- way that expext the marker/placeholder to hold on a single line. There is also a new command: :SetMarker {open} {close} that sets the two strings used to define the marker -- no need to know the name of the two options. I've also tried to automatically manage the value of the 'encoding'. But I'm not sure it is really useful. So, I still have: - to tune/change some little things regarding iconv -- but so far it works fine on my win32 version of Vim. I can insert (<M-Insert> [1]) and jump to markers in latin1 and utf-8, the markers beeing defined with: :SetMarker « » or :SetMarker \foo \bar or :SetMarker <+ +> or :SetMarker «+ +» - and to test the echoing approach (as opposed to the marker-selection). [1] I must confess: I use some meta-mappings in insert mode. -- Luc Hermitte The latest version of the file should be available at: http://hermitte.free.fr/vim/ressources/vimfiles/plugin/bracketing.base.vim |
From: Srinath A. <sr...@fa...> - 2003-01-07 20:03:05
|
Hello, On Tue, 7 Jan 2003, Luc Hermitte wrote: > Hello, > > - we don't have to test 'wrapscan', |search()| does it implicitly for us Thanks for the tip. I removed the extra code. > - The jumpBack does not work correclty. Try for instance: > :vmap <C-k> <Plug>IMAP_JumpBack > i<+foo+> <+bar+> <+three+> > <esc>gg > ^J^J^K This was a bug. I have fixed it. Actually, fixing this bug made me realize that I was making some other stuff needlessly complex. Things are nice and simple after this bug fix. Thanks! See the latest version in the cvs tree... > - the mappings are not silent. Oh? I have done something like: imap <silent> <Plug>IMAP_JumpForward <c-r>=3DIMAP_Jumpfunc('', 0)<CR> if !hasmapto('<Plug>IMAP_JumpForward', 'i') imap <C-J> <Plug>IMAP_JumpForward endif Doesn't this make the maps silent? Do I need imap <silent> <C-J> <Plug>IMAP_JumpForward also? > - why do you need a specific jump function to use with IMAP() ? I > haven't looked in the mecanics, but I find this odd ; I didn't need > such a thing with =B5Template. Well, I am kind of unsure what you mean by this question... But this was done mostly on purpose, since we did not want to duplicate code in IMAP() and IMAP_Jumpfunc(). If you are asking about why IMAP_Jumpfunc() now takes 2 arguments, well, ... I didn't give it much thought. I guess the arguments could be optional and default to ('', 0)... Again, I dont see any advantages/disadvantages either way. > Otherwise, I've integrated in bracketing.base.vim some of the things you > use [thanks!]: > - the 'nomagic' stuff ; BTW, the psh and phe strings need to have their > '\' escaped -- I haven't checked if it is needed for other characters. Forgot to do this in the latest commit. Will fix this next time. > - I don't mess with @" anymore So you use @_ like in IMAP_Jumpfunc()? > - I've managed the visual selection in another way that does not mess > with the search-history at all-- way that expext the > marker/placeholder to hold on a single line. Well, the latest imaps.vim is able to handle <+placeholders withlinebreaks+> (or without linebreaks) without messing up @/. This is simply done by appending ':call histdel("/", -1)|let @/=3Dhistget("/", -1)' to normal commands. Works quite well so far... > There is also a new command: > :SetMarker {open} {close} > that sets the two strings used to define the marker -- no need to know > the name of the two options. Interesting, but I dont think end users will use this. Also, variables are nicer because nothing needs to be source'd apriori, so they can be set in .vimrc (the most natural place). > - and to test the echoing approach (as opposed to the marker-selection). I tried the echoing approach, but it didn't work, because the command line is taken up with -- INSERT --, overwriting whatever is echoed. Have you found a way around it? Per Benji's request, I've also commented IMAP_Jumpfunc() and taken care of <+placeholders withlinebreaks+> Thanks, Srinath |
From: Luc H. <her...@fr...> - 2003-01-08 01:21:46
|
* On Tue, Jan 07, 2003 at 12:02:57PM -0800, Srinath Avadhanula <sr...@fa...> wrote: > > - The jumpBack does not work correclty. Try for instance: > > :vmap <C-k> <Plug>IMAP_JumpBack > > i<+foo+> <+bar+> <+three+> > > <esc>gg > > ^J^J^K > > This was a bug. I have fixed it. Actually, fixing this bug made me > realize that I was making some other stuff needlessly complex. Things > are nice and simple after this bug fix. Thanks! See the latest version > in the cvs tree... I will check it. Does it works even when the cursor is within a placeholder boundaries ? [my last conclusions was that I need to call searchpair twice] > > - the mappings are not silent. > Oh? I have done something like: > > imap <silent> <Plug>IMAP_JumpForward <c-r>=IMAP_Jumpfunc('', 0)<CR> > if !hasmapto('<Plug>IMAP_JumpForward', 'i') > imap <C-J> <Plug>IMAP_JumpForward > endif > > Doesn't this make the maps silent? Do I need The guilty code is: ':call histdel("/", -1)|let @/=histget("/", -1)' I think it is due to the fact it is returned as a string passed to '<c-r>='. Set 'cmdheight' to 2 or more to see the echoing. At first I defined an intermediary (and silent) mapping. My last version does not use v/phe/e anymore. But: " cursor is at the beginning of a marker. let select = 'v'.virtcol('.').'|o' call search('\V'.escape(phe,'\')) return select. gv_or_c Unfortunatelly, unless I mess vim-marks, I can't go to another line (than the current one) while in visual mode. > > - why do you need a specific jump function to use with IMAP() ? I > > haven't looked in the mecanics, but I find this odd ; I didn't > > need such a thing with µTemplate. > > Well, I am kind of unsure what you mean by this question... But this > was done mostly on purpose, since we did not want to duplicate code in > IMAP() and IMAP_Jumpfunc(). If you are asking about why > IMAP_Jumpfunc() now takes 2 arguments, well, ... I didn't give it much > thought. In fact, I was wondering why a :normal <Plug>IMAP_JumpForward wasn't enough ? Or may be directly a: :call IMAP_JumpFunc(0) What makes the inclusive search so different and required ? > > - I don't mess with @" anymore > So you use @_ like in IMAP_Jumpfunc()? '"_c' actually. So yes. > > There is also a new command: > > :SetMarker {open} {close} > > that sets the two strings used to define the marker -- no need to > > know the name of the two options. > > Interesting, but I dont think end users will use this. Also, variables > are nicer because nothing needs to be source'd apriori, so they can be > set in .vimrc (the most natural place). I wasn't thinking to end-user but to ftplugins writers. I will eventually have to make many experiments in order to be able to: - let ftplugins change the values of opening and closing string - let ftplugins encoded in latin1, utf-8, etc - be compatible with any encoding of fileencoding for the current buffer/file. The important advantage: it wraps the call to iconv(). Neither the end-user nor the .texrc writter have to worry about calling iconv() for funky strings. > > - and to test the echoing approach (as opposed to the > > marker-selection). > > I tried the echoing approach, but it didn't work, because the command > line is taken up with -- INSERT --, overwriting whatever is echoed. > Have you found a way around it? :set cmdheight=2 It is unusable otherwise. I have to comment/document this. > Per Benji's request, I've also commented IMAP_Jumpfunc() and taken > care of <+placeholders > withlinebreaks+> I'm skeptical about their usefulness (English ?). When we need long tags/comments, I'd rather use a templates plugin like the one written by Robert "Feral" Kelly. -- Luc Hermitte http://hermitte.free.fr/vim/ |
From: Srinath A. <sr...@fa...> - 2003-01-08 02:42:45
|
On Wed, 8 Jan 2003, Luc Hermitte wrote: > > This was a bug. I have fixed it. Actually, fixing this bug made me > > realize that I was making some other stuff needlessly complex. Things > > are nice and simple after this bug fix. Thanks! See the latest version > > in the cvs tree... > > I will check it. Does it works even when the cursor is within a > placeholder boundaries ? [my last conclusions was that I need to call > searchpair twice] It does work... If you are in the middle of a placeholder and press <C-j> it will goto the next placeholder. <C-K> selects the placeholder you are current in... > The guilty code is: > ':call histdel("/", -1)|let @/=histget("/", -1)' > I think it is due to the fact it is returned as a string passed to > '<c-r>='. Set 'cmdheight' to 2 or more to see the echoing. Hmm... I dont see anything on the commandline even with cmdheight = 2. Dunno... Maybe I'll randomly add a <silent> next time... > In fact, I was wondering why a > :normal <Plug>IMAP_JumpForward > wasn't enough ? Or may be directly a: > :call IMAP_JumpFunc(0) > > What makes the inclusive search so different and required ? > Well, here's the comment in the latest imaps.vim " IMAP_Jumpfunc: takes user to next <+place-holder+> {{{ " Author: Luc Hermitte " Arguments: " direction: flag for the search() function. If set to '', search forwards, " if 'b', then search backwards. See the {flags} argument of the " |search()| function for valid values. " inclusive: In vim, the search() function is 'exclusive', i.e we always goto " next cursor match even if there is a match starting from the " current cursor position. Setting this argument to 1 makes " IMAP_Jumpfunc() also respect a match at the current cursor " position. 'inclusive'ness is necessary for IMAP() because a " placeholder string can occur at the very beginning of a map which " we want to select. " We use a non-zero value only in special conditions. Most mappings " should use a zero value. In short, if we didn't take care of inclusion, then if we did call IMAP('foo', '<+one+> <+two+>', '') then on pressing foo we would be taken to <+two+>. This was something from a while ago... I'll have to check whether we still need this because it looks like /something/e has the effect of including a match at the current position. > I will eventually have to make many experiments in order to be able to: > - let ftplugins change the values of opening and closing string > - let ftplugins encoded in latin1, utf-8, etc > - be compatible with any encoding of fileencoding for the current > buffer/file. > Benji has spent time on this and I think we have a working system right now to do all of this. We have even thought of things like "what if the placeholder setting was done in a file with 'fenc' different from the tex file which the user is editing?" So if you want, you might want to see whats done here. > The important advantage: it wraps the call to iconv(). Neither the > end-user nor the .texrc writter have to worry about calling iconv() for > funky strings. > Yes. Benji wrote s:Iconv(), a wrapper for iconv() which does these things > I'm skeptical about their usefulness (English ?). When we need long > tags/comments, I'd rather use a templates plugin like the one written by > Robert "Feral" Kelly. Well, even if we have some other ways of generating templates, I would be very reluctant to have another function do the actual jumping between placeholders. Code duplication! Besides, multi line placeholders were a snap to support. Does this templates plugin offer something different? Also, latex-suite does support templates in custommacros.vim Srinath |
From: Luc H. <her...@fr...> - 2003-01-08 13:03:54
|
* On Tue, Jan 07, 2003 at 06:42:42PM -0800, Srinath Avadhanula <sr...@fa...> wrote: > > I will check it. Does it works even when the cursor is within a > > placeholder boundaries ? [my last conclusions was that I need to > > call searchpair twice] > It does work... If you are in the middle of a placeholder and press > <C-j> it will goto the next placeholder. <C-K> selects the placeholder > you are current in... I like your idea of using "'<" with visual mappings. And regarding the fact the backward-search jumps to the current PH instead of the previous one is not completly illogical. I will eventually simplify my code to adopt your way. > > [not silent mapping] > > Set 'cmdheight' to 2 or more to see the echoing. > Hmm... I dont see anything on the commandline even with cmdheight = 2. > Dunno... Maybe I'll randomly add a <silent> next time... That's odd. Things have changed since the 3rd january version and the 1.24. Now, it is all right. > > What makes the inclusive search so different and required ? > Well, here's the comment in the latest imaps.vim > [...] I see. Thanks. > > I will eventually have to make many experiments in order to be able to: > > - let ftplugins change the values of opening and closing string > > - let ftplugins encoded in latin1, utf-8, etc > > - be compatible with any encoding of fileencoding for the current > > buffer/file. > Benji has spent time on this and I think we have a working system right > now to do all of this. We have even thought of things like "what if the > placeholder setting was done in a file with 'fenc' different from the > tex file which the user is editing?" So if you want, you might want to > see whats done here. I've seen his function just after I've written an equivalent one. Now, I'd curious to have some input from people using encodings other that latin1 or utf-8. > [multi-line PH] > > I'm skeptical about their usefulness (English ?). When we need long > > tags/comments, I'd rather use a templates plugin like the one > > written by Robert "Feral" Kelly. > Well, even if we have some other ways of generating templates, I would > be very reluctant to have another function do the actual jumping between > placeholders. Code duplication! > > Does this templates plugin offer something different? FTE (the plugin) serves a different purpose ; it has nothing to do with jumping. I see multi-line PH as an helper to the end-user who has just inserted a template (from a file or from IMAP(), or ...). If the text is really long and explain many things, I'm not sure PHs are the best things to use. I see them more as markers where we will jump to and we will eventually replace by some other text. FTE permit to insert lines like (don't remember the exact format): FTE: -------------------- begin ------------------- FTE: some introduction to the template that has been inserted FTE: this comment may be very, very long. FTE: FTE: Next: the name of the environment FTE:a: %%%(environment name ; this is a PH) FTE:b[ ]: Do you wish to center it ? FTE: \begin{@a} FTE: IF(@b, \begin{center}) <+insert your code here+> FTE: IF(@b, \end{center}) \end{@a} <++> FTE: some last comments FTE: -------------------- end ------------------- Then, we can assign some value to @a and @b (by replacing the %%%() placeholders), interpret the corresponding code (with <F6> for instance). The result displayed could be: \begin{itemize} .... cursor here .... \end{itemize} <++> I see his plugin as a multipasses templates plugin. One interresting use is to insert the signature of some functions and an excerpt of their man. A solution made of PHs only would have contain a several lines-long PH introducing the template. IMHO, this is a mis-use of PHs. > Also, latex-suite does support templates in custommacros.vim ... and in templates.vim But so far, I'm not sure it is as evolved as FTE or my unofficial version of µTemplate. -- Luc Hermitte http://hermitte.free.fr/vim/ |