Re: BUG: tr() returns additional junk character
Ingo Karkat wrote: I found a bug in VIM 7.0's new tr() function. If the {src} string contains exactly 80 characters, an additional junk character is appended to the tr() result; this happens regardless of whether a character translation has occurred or not. How to reproduce: vim -u NONE :echo tr('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'x', 'y') Note: If {src} contains more or less than 80 characters, the bug does not occur. If it occurs, it usually prints something like: 12345678901234567890123456789012345678901234567890123456789012345678901234567890^E though the last junk character (^E) may differ. Affected platforms: I could reproduce this in console vim and gvim, on MS Windows XP SP2 and HP-UX 11.0 PA-RISC systems with the official, unpatched version 7.0, e.g.: VIM - Vi IMproved 7.0 (2006 May 7, compiled May 7 2006 16:18:30) MS-Windows 32 bit console version I hope this helps. Keep up the good work, I use VIM daily and couldn't live without it! That's a bug. There is no terminating NUL. I'll make a patch. -- ARTHUR:I command you as King of the Britons to stand aside! BLACK KNIGHT: I move for no man. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: about patch 7.0.175
Hmm, the subject should have been patch 7.0.175. Remove the about! Hopefully no scripts got confused by this. -- BLACK KNIGHT: Come on you pansy! [hah] [parry thrust] [ARTHUR chops the BLACK KNIGHT's right arm off] ARTHUR:Victory is mine! [kneeling] We thank thee Lord, that in thy merc- [Black Knight kicks Arthur in the head while he is praying] The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
patch 7.0.177
Patch 7.0.177 Problem:When the press-enter prompt gets a character from a non-remappable mapping, it's put back in the typeahead buffer as remappable, which may cause an endless loop. Solution: Restore the non-remappable flag and the silent flag when putting a char back in the typeahead buffer. Files: src/getchar.c, src/message.c, src/normal.c *** ../vim-7.0.176/src/getchar.cTue Oct 3 15:36:09 2006 --- src/getchar.c Tue Dec 5 21:17:42 2006 *** *** 76,82 */ static mapblock_T *first_abbr = NULL; /* first entry in abbrlist */ ! static intKeyNoremap = FALSE; /* remapping disabled */ /* * variables used by vgetorpeek() and flush_buffers() --- 76,82 */ static mapblock_T *first_abbr = NULL; /* first entry in abbrlist */ ! static intKeyNoremap = 0; /* remapping flags */ /* * variables used by vgetorpeek() and flush_buffers() *** *** 1035,1040 --- 1037,1044 /* * Put character c back into the typeahead buffer. * Can be used for a character obtained by vgetc() that needs to be put back. + * Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to + * the char. */ void ins_char_typebuf(c) *** *** 1061,1067 buf[1] = NUL; #endif } ! (void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE); } /* --- 1065,1071 buf[1] = NUL; #endif } ! (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent); } /* *** *** 2270,2278 gotchars(typebuf.tb_buf + typebuf.tb_off, 1); } ! KeyNoremap = (typebuf.tb_noremap[ ! typebuf.tb_off] ! (RM_NONE|RM_SCRIPT)); del_typebuf(1, 0); } break; /* got character, break for loop */ --- 2276,2283 gotchars(typebuf.tb_buf + typebuf.tb_off, 1); } ! KeyNoremap = typebuf.tb_noremap[ ! typebuf.tb_off]; del_typebuf(1, 0); } break; /* got character, break for loop */ *** *** 4196,4202 if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */ return FALSE; ! if (KeyNoremap) /* no remapping implies no abbreviation */ return FALSE; /* --- 4201,4208 if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */ return FALSE; ! if ((KeyNoremap (RM_NONE|RM_SCRIPT)) != 0) ! /* no remapping implies no abbreviation */ return FALSE; /* *** ../vim-7.0.176/src/normal.c Tue Nov 7 18:43:10 2006 --- src/normal.cTue Dec 5 21:16:07 2006 *** *** 651,659 /* Fake a change command. When restart_edit is set (e.g., because * 'insertmode' is set) fake a delete command, Insert mode will * restart automatically. !* Insert the typed character in the typeahead buffer, so that it will !* be mapped in Insert mode. Required for :lmap to work. May cause !* mapping a character from :vnoremap... */ ins_char_typebuf(c); if (restart_edit != 0) c = 'd'; --- 651,658 /* Fake a change command. When restart_edit is set (e.g., because * 'insertmode' is set) fake a delete command, Insert mode will * restart automatically. !* Insert the typed character in the typeahead buffer, so that it can !* be mapped in Insert mode. Required for :lmap to work. */ ins_char_typebuf(c); if (restart_edit != 0) c = 'd'; *** ../vim-7.0.176/src/version.cTue Dec 5 21:32:00 2006 --- src/version.c Tue Dec 5 21:36:07 2006 *** *** 668,669 --- 668,671 { /* Add new patch number below this line */ + /**/ + 177, /**/ -- 5 out of 4 people have trouble with fractions. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
patch 7.0.178
Patch 7.0.178 Problem:When 'enc' is utf-8 and 'ignorecase' is set the result of :echo (\xe4 == \xe4) varies. Solution: In mb_strnicmp() avoid looking past NUL bytes. Files: src/mbyte.c *** ../vim-7.0.177/src/mbyte.c Wed Nov 1 18:10:36 2006 --- src/mbyte.c Tue Dec 5 22:04:34 2006 *** *** 2294,2301 --- 2294,2307 } /* Check directly first, it's faster. */ for (j = 0; j l; ++j) + { if (s1[i + j] != s2[i + j]) break; + if (s1[i + j] == 0) + /* Both stings have the same bytes but are incomplete or +* have illegal bytes, accept them as equal. */ + l = j; + } if (j l) { /* If one of the two characters is incomplete return -1. */ *** ../vim-7.0.177/src/version.cTue Dec 5 21:45:20 2006 --- src/version.c Tue Dec 5 22:08:08 2006 *** *** 668,669 --- 668,671 { /* Add new patch number below this line */ + /**/ + 178, /**/ -- Trees moving back and forth is what makes the wind blow. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Possible bug in vb.vim or html.vim
I have run across a rather strange error in the syntax highlighting for either vb.vim or html.vim. I'm unsure which is causing the problem. Here are the circumstances under which this error occurs: I am developing an HTA program. An HTA program (for those who do not use Windows) is an HTML executable program. I'm using vbscript inside of the HTML via the script tag to write a small program. What happens is that if multiple lines of comments in a vbscript are placed together with several single character comments sparced between the longer comments, then for some reason all of the code is marked as Normal in the syntax coloring. Once this happens, various things such as the in IF statements turn red (I haven't figured out which syntax coloration this is) and other statements turn green (again, I am still tracking down which of the syntax commands this represents in my color scheme). I was wondering if anyone else has run across this problem? Here is (off the top of my head) an example of what seems to cause this problem: Example: html head titleTest Program/title script language=vbscript dim i dim a ' 'BEGIN DOC ' '-Calling Sequence: ' ' myFunc() ' '-Description: ' ' This function does nothing. ' '-Inputs: ' ' None. ' '-Outputs: ' ' None. ' 'END DOC ' set objFSO = CreateObject( whatever.FileSystem.Object ) set objFile = CreateTextFile( myfile.dat ) set anotherObj = About this time the lines should turn all one color. objFSO.stdout.Write I know this isn't good vbscript - it's just for show /script /head body Test program /body /html Usually, as the above line says, all of the lines turn one color. If this doesn't do it for you, then I'll see about sending some code from work that this happens on. But it will look a lot like the above. :-)
Re: separator in user-defined command name
* On Mon, Dec 04, 2006 at 12:09:34PM -0800, Gary Johnson [EMAIL PROTECTED] wrote: On 2006-12-04, [EMAIL PROTECTED] wrote: I tried '-' and '_' in user-defined command name, both are not accepted (like X_Y, X-Y). Is there maybe some [other] separator that is allowed in user-defined command name ? I'm afraid only uppercase letters can be used Actually, uppercase letters, lowercase letters and digits can be used, but the name must start with an uppercase letter. Of course. I meant can be used as word separator - :MyCommand and not :MYCOMMAND -- Luc Hermitte http://hermitte.free.fr/vim/
:Nread errors
I am having some trouble with Netrw in Vim 7. I had been using it to ftp to a web server and update files. I recently began receiving the following error(s) when running :Nread ftp://[EMAIL PROTECTED]/public_html/ ftp://[EMAIL PROTECTED]/public_html/ [not edited] --no lines in buffer-- If I try to edit the a file directly rather than attempting to navigate a directory, I get the following errors: ***netrw*** ?Invalid command. ***netrw*** file /tmp/v325706/11.html not readable I have Netrw v98 and have tried upgrading my version. I downloaded netrw.vba.gz script version 104, and after removing all instances of 'anything' netrw*, I sourced the vimball. Unfortunately after installation I still show v98 and am still unable to :Nread ftp://... Any suggestions on what to check or how to proceed would be greatly appreciated as I love this tool and really miss the convenience Netrw provides. Thanks, Kevin
Thanks for Colo(u)red Syntax!
Hi Just wanted to thank those involved in colouring syntax. I've just had a case where I foolishly ignored the fact that colouring was indicating an error! . I often have Javascript, html, mixed up with Php or Coldfusion and yet the colouring works. And to think when I moved from Vi to VIM I thought that colour was for namby-pambies!! -- http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
Re: I can't make gvim the default application for .txt files in WinXP
[ post reordered to conform with mailing list no-top-posting conventions ] Jeffrey Robertson wrote: -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 4:07 PM To: Robertson, Jeffrey (CAR:QW32) Cc: Sean Plank; vim@vim.org Subject: Re: I can't make gvim the default application for .txt files in WinXP Jeffrey Robertson wrote: No. That's my problem. How does gvim tell Windows to make itself an option in this list? [...] I'm not sure; I think it's something in the registry. Maybe the install program should do it. Have you installed Vim from Steve Hall's self-installer https://sourceforge.net/project/showfiles.php?group_id=43866package_id=39721 ? If you haven't, try doing it. P.S. Please use bottom-posting or inter-posting in the Vim mailing lists. Best regards, Tony. Hi: I can't remember where I downloaded from, but it wasn't this page. But I did use a proper installer. I don't want Cream, just plain vim/gvim. Which link on this page should I choose, or do I need another page? Thanks, --+--+-- --- Jeffrey Robertson | [EMAIL PROTECTED] | NORTEL Software Engineer +--+ 'I speak for myself, not Nortel' - Me Optical Networks 'Verbing weirds language'- CalvinOttawa, Canada The link above, which should be all on one line, sends to a page _hosted_ by the Cream project, but the installers listed on that page are for plain (g)vim without Cream. Download the most recent version, at the top of the list. Best regards, Tony. P.S. Unless you stray off-topic, please use Reply to list (if your mailer offers that option) or Reply to all but not Reply to sender. That way, other people will see your query even if I'm not at home.
Re: Problem with VCSCommand
On 11/30/06, Joakim Olsson [EMAIL PROTECTED] wrote: I solved the problem by setting shell to cmd.exe in my .vimrc. The problem stems from the fact that I set the SHELL environment variable to /usr/bin/bash to make rxvt work for Cygwin. Vim sees that and set shell to the same value of course. Is this something that should generally be set for VIM under cygwin, or something that only really impacts vcscommand under cygwin? I know some folks have had issues with cygwin before, and I'd like to prevent that if possible. Thank you, bob
Re: :Nread errors
My OS is Mac OS X 10.4.8, so yes, it is Unix/Linux based. After I sent my original e-mail, I did think to check where $VIMRUNTIME was located. I removed all instances of anything vim* related. I then attempted the :Nread command and got what I expected... E492: Not an editor command: Nread... I then :so % the vimball and checked the runtime location for any netrw files. None were there. Is there a way to make direct the installation where to install? Is there a way to see where the source is installing? or a manual installation? Thanks again, Kevin On Dec 5, 2006, at 10:09 AM, Charles E Campbell Jr wrote: striker wrote: I am having some trouble with Netrw in Vim 7. I had been using it to ftp to a web server and update files. I recently began receiving the following error(s) when running :Nread ftp://[EMAIL PROTECTED]/public_html/ ftp://[EMAIL PROTECTED]/public_html/ [not edited] --no lines in buffer-- If I try to edit the a file directly rather than attempting to navigate a directory, I get the following errors: ***netrw*** ?Invalid command. ***netrw*** file /tmp/v325706/11.html not readable I have Netrw v98 and have tried upgrading my version. I downloaded netrw.vba.gz script version 104, and after removing all instances of 'anything' netrw*, I sourced the vimball. Unfortunately after installation I still show v98 and am still unable to :Nread ftp://... Any suggestions on what to check or how to proceed would be greatly appreciated as I love this tool and really miss the convenience Netrw provides. Well, netrw v98 has to be coming from somewhere! Are you using Windows, Linux, or what? The /tmp/... file looks like a linux location, so I'll use that guess. Try cd /usr/local/share/vim/vim70 ls */netrw* and see if any files show up. If your vim 7.0 installation isn't there... vim :echo $VIMRUNTIME should show where its hiding (this should work under Windows, too). Please remove any and all netrw files from that location. Regards, Chip Campbell
Re: :Nread errors
striker wrote: My OS is Mac OS X 10.4.8, so yes, it is Unix/Linux based. After I sent my original e-mail, I did think to check where $VIMRUNTIME was located. I removed all instances of anything vim* related. I then attempted the :Nread command and got what I expected... E492: Not an editor command: Nread... I then :so % the vimball and checked the runtime location for any netrw files. None were there. Is there a way to make direct the installation where to install? Is there a way to see where the source is installing? or a manual installation? Do you have an up-to-date vimball? There's the same sort of issue with vimball as netrw; you'll need to remove all vestiges of the vim 7.0 vimball before installing the new one. However, vimball comes as a gzipped tarball so as to avoid requiring vimball to install vimball. You can get the latest version from my website (http://mysite.verizon.net/astronaut/index.html#VimBall). You may install vimball in your distribution directories or in your $HOME/.vim/ directories. Then vim netrw.vba.gz :so % :q should install netrw in your $HOME/.vim/ directories. After performing the steps above, you can cd $HOME/.vim ls */netrw*.* and you should see a number of netrw plugin components. vim . should open netrw and show v107l (if you've gotten the latest netrw from my website). Regards, Chip Campbell
Can I open data.fs file in R/W with ZODB in two programs (two process, no thread) at the same time ?
Hi, Can I open data.fs file in R/W with ZODB in two programs (two process, no thread) at the same time ? If not, is there storage system to do that ? Thanks for your help, Stephane
Re: Can I open data.fs file in R/W with ZODB in two programs (two process, no thread) at the same time ?
2006/12/5, KLEIN Stéphane [EMAIL PROTECTED]: Hi, Can I open data.fs file in R/W with ZODB in two programs (two process, no thread) at the same time ? If not, is there storage system to do that ? I'm mistaken of mailing list, sorry for the disturbance. Stephane
aligning text to a certain column
how can I align text under and after the cursor position to a specific column number? and probably just as important, how can I find out which column number a cursor is at ;)? thanks! -lev
Re[2]: sourcing
On Mon, 4 Dec 2006, Bill McCarthy apparently wrote: Instead of using an autocmd, you could place those maps in a file called tex.vim in your local ftplugin directory. Place this single line in such a file: map buffer c-a :echo 'It worked!'CR OK, I did this. But there is still a problem. Suppose I have defined:: imap buffer unique ;fn %cr\footnote{%cr}cr%esc-i in my tex_ai.vim file in my local ftplugin directory. I create the buffer ``:e c:\temp.tex`` then I leave the buffer by deleting it ``:bd`` and then later I decide to reopen it ``:e c:\temp.tex``. Now I get a bunch of E227 errors, saying the mapping already exists. This must mean that there Vim tries to redefine the mapping. BUT I had tried to rule this out: at the top of my plugin I have:: if exists(b:loaded_tex_ai) finish endif let b:loaded_tex_ai=1 But of course ``b:loaded_tex_ai`` is gone once I use ``:bd``. But the mappings are apparently still around! I do not really understand the variable convetions. Should I have created ``s:loaded_tex_ai`` instead? Might that work? The problem does not arise if I use ``:bw`` instead of ``:bd``. But then I lose other information too. What is the right way to manage this? Hints or suggestions? Thank you, Alan Isaac
Re: aligning text to a certain column
* Lev Lvovsky [2006.12.05 13:53]: how can I align text under and after the cursor position to a specific column number? :.,$s/^\s*/ /g will align the first non-blank on the fourth column, from the cursor's line to the end of the file. and probably just as important, how can I find out which column number a cursor is at ;)? In normal mode: :h g_Ctrl-G In scripts: :h getpos() or add %c to your status line to have it all the time. :h statuslineCR7} -- JR
Re: aligning text to a certain column
On 2006-12-05, Lev Lvovsky [EMAIL PROTECTED] wrote: how can I align text under and after the cursor position to a specific column number? and probably just as important, how can I find out which column number a cursor is at ;)? :set ruler will show you the cursor's line and column numbers on the status line. Then the easiest was to align the text under and after the cursor to a specific column number is to hit 'i' and hold the space bar or backspace key as appropriate until the 'ruler' shows the desired column number. There are more elegant solutions, but they depend on the specifics of what you're trying to do. HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re[2]: sourcing
On Tue, 5 Dec 2006, Alan G Isaac wrote: On Mon, 4 Dec 2006, Bill McCarthy apparently wrote: Instead of using an autocmd, you could place those maps in a file called tex.vim in your local ftplugin directory. Place this single line in such a file: map buffer c-a :echo 'It worked!'CR I did this. It worked. I didn't have a problem. Suppose I have defined:: imap buffer unique ;fn %cr\footnote{%cr}cr%esc-i However my maps were map! buffer in my tex_ai.vim file in my local ftplugin directory. I create the buffer ``:e c:\temp.tex`` then I leave the buffer by deleting it ``:bd`` and then later I decide to reopen it ``:e c:\temp.tex``. I tried this out, I didn't reproduce your errors. BUT I had tried to rule this out: at the top of my plugin I have:: if exists(b:loaded_tex_ai) finish endif let b:loaded_tex_ai=1 I didn't do this however. Also, I use slackware. So, is there any OS dependent settings in vim that could be causing this problem for you? I know I'm not helping you. But just wanted to share my results. Thanks, Senthil.
Re: aligning text to a certain column
Jean-Rene David wrote: * Lev Lvovsky [2006.12.05 13:53]: how can I align text under and after the cursor position to a specific column number? :.,$s/^\s*/ /g will align the first non-blank on the fourth column, from the cursor's line to the end of the file. and probably just as important, how can I find out which column number a cursor is at ;)? In normal mode: :h g_Ctrl-G In scripts: :h getpos() or add %c to your status line to have it all the time. :h statuslineCR7} The default status line (when 'statusline' is set to the empty string) has it. To enable status line display even if only one window is open, use :set laststatus=2 For instance, after doing :help 'laststatus' (with the single quotes but without the double quotes), I see 4193,6-41 near the bottom right of the screen. This means: - cursor is on 4193rd line in the file; - cursor is on 6th byte in the line (counting each hard tab as one byte, and each multibyte character -if any- as however many bytes it takes up in memory); - cursor is on 41st column of the screen. When both horizontal position numbers are equal, their value appears only once. When there is no data in the file, 0,0-1 is displayed. Best regards, Tony.
Re: Do a grep -r without match .svn directory ?
I tested it with '*svn*' and on cygwin grep which is: grep (GNU grep) 2.5.1 and it worked. Strangely enough if I put '*.svn*' it didn't work. bob Gary Johnson wrote: Hi Bob, That doesn't seem to work either. I executed the following: cd ~/.vim grep -Rli --exclude=\*syntax\* maintainer . and the results included files such as ./syntax/Decho.vim I also tried variations including --exclude=syntax --exclude=*syntax* --exclude='*syntax*' '--exclude=*syntax*' all with the same results. Regards, Gary -- Bob Davis | Senior Advisory Software Developer - Applications [EMAIL PROTECTED] Work: 603-926-9696 x3456 Direct#: 603-929-8956 Home: 603-778-0781 Cell#: 603-793-6403 Aim: dad1732 Yim: rsdavis9
Re: Problem with VCSCommand
Good question. I only had problems with vcscommand at the time at least. /Joakim On tis, 2006-12-05 at 10:08 -0600, Bob Hiestand wrote: On 11/30/06, Joakim Olsson [EMAIL PROTECTED] wrote: I solved the problem by setting shell to cmd.exe in my .vimrc. The problem stems from the fact that I set the SHELL environment variable to /usr/bin/bash to make rxvt work for Cygwin. Vim sees that and set shell to the same value of course. Is this something that should generally be set for VIM under cygwin, or something that only really impacts vcscommand under cygwin? I know some folks have had issues with cygwin before, and I'd like to prevent that if possible. Thank you, bob
Formatting text in reply e-mails
Hi I know vim understands character sequences that delimit comments in various programming languages and gqap formats them appropriately. However, while typing a reply to an e-mail, the gqap command doesn't seem to identify the end of a paragraph in the original message because empty lines are also preceded by a or some such string. As a result, gqap formats the rest of the original message and kicks me all the way to the end of the file. Whereas I'd like to just format the current paragraph, a paragraph in its normal sense, and be placed at the end of it. In essence, I want to tell vim that sequences at the beginning of a line is just a leader not a part of the line. How do I do this? Thanks in advance. Senthil. -- Today's fortune: From 0 to what seems to be the problem officer in 8.3 seconds. -- Ad for the new VW Corrado
Re: Formatting text in reply e-mails
Vim may very well be able to do that with built-in commands. I use the external paragraph reformatter 'par-1.52' for this: http://www.nicemice.net/par/ For example, to format and justify this reply in vim, I used: :','!par 66j A patch for 'par' also exists to make it work with Unicode UTF-8. Cheers /Dominique Hi I know vim understands character sequences that delimit comments in various programming languages and gqap formats them appropriately. However, while typing a reply to an e-mail, the gqap command doesn't seem to identify the end of a paragraph in the original message because empty lines are also preceded by a or some such string. As a result, gqap formats the rest of the original message and kicks me all the way to the end of the file. Whereas I'd like to just format the current paragraph, a paragraph in its normal sense, and be placed at the end of it. In essence, I want to tell vim thatsequences at the beginning of a line is just a leader not a part of the line. How do I do this? Thanks in advance. Senthil.
Re: Formatting text in reply e-mails
On Wed, 6 Dec 2006, [EMAIL PROTECTED] wrote: Vim may very well be able to do that with built-in commands. I use the external paragraph reformatter 'par-1.52' for this: For example, to format and justify this reply in vim, I used: :','!par 66j No, this doesn't answer my question. My question is not about the formatting ability of vim. Rather, it is about precisely stating the end of a paragraph in a quoted message that has leading s. In the example below, the first paragraph ends with the word appropriately. If I type gqap, vim will format the line beginning with the word However too. I don't want that to happen. I know vim understands character sequences that delimit comments in various programming languages and gqap formats them appropriately. However, while typing a reply to an e-mail, the gqap command Thanks, Senthil.
Re: your best vim scripting tip
Towards the bottom of Luc Hermitte message, the following was said: substitute(), match*(), exists(), ... But also :exe, :normal!, I-CTRL_R, :s, ... which are not functions indeed. What does the I-CTRL_R command do? TIA Michael --- Luc Hermitte [EMAIL PROTECTED] wrote: Hello, * On Sat, Dec 02, 2006 at 07:05:40PM +0100, Kim Schulz [EMAIL PROTECTED] wrote: It you should give one (or more) tips to a person who was going to start creating scripts for vim, then what would it be? Tough question. ideas could be: Do's and dont's * Do know the various kinds of scripts (plugins, ftplugins, compiler plugins, indent plugins, ...). In particular |ftplugins| can be seen as buffer-wise plugins dedicated to specific type of files. :h map-local :h b:var :h :setlocal BTW, b:did_ftplugin is not to be used by us, mere mortals. This anti-reinclusion guard must be reserved to standard ftplugins. For instance, they can't be of any help in my C++ ftplugins suite as it is made of several distinct C++ ftplugin scripts (and many other plugins, auto-plugins (VimL functions dedicated to C++ analysis (scopes, signatures, ...) , ...) * Don't assume anything about the configuration of the users of your scripts. This means that vim versions can vary, and even the way vim is compiled can make some differences as it has already been said in this thread. Moreover, sometimes people override standard keys sequences to do, well, quite odd things that have nothing to do with the standard and default behavior we can expect. This means we, plugins writers, must always prefer the nore version of :*map, :*abbr, and :normal! over :normal. Unless it can't be done otherwise. In the same kind of idea, our users may not like the default keybindings we propose for our mappings. Instead of having them patch by hand our scripts (that they may have to upgrade for a newer version someday), we have to consider using |plug|, |Leader|, and other global options (|g:var|), all three to be set from within the .vimrc. best util script I use a lot the scripts I'm maintaining (searchInRuntime, BuildToolsWrappers, my fork of mu-template, my bracketing suite). But also a few other scripts like a.vim, enhancedCommentify, CVS-menu, Matchit, swap-words, ... Lately, I've started moving a few functions to autoload plugins, which are perfect to implement VimL library plugins. often used functions substitute(), match*(), exists(), ... But also :exe, :normal!, I-CTRL_R, :s, ... which are not functions indeed. ways of optimization etc. etc.. A couple of years ago, I gave a presentation of vim configuration. The slides are available on my web site [1], they are in French and pre-date the release of vim7 which changed a few things in the way I develop my plugins. The few examples, and references to vim help topics should be understandable. SVN is my precious friend, even if I haven't moved all my scripts into subversion repositories. Having a documentation that also stats the purpose of your scripts is plus. HTH, [1] http://hermitte.free.fr/vim/ressources/vim-config.pdf -- Luc Hermitte http://hermitte.free.fr/vim/ Michael D. Phillips - A computer science enthusiast I do not hate Windows, I just like the alternatives better. Linux is my primary choice. Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com
RE: your best vim scripting tip
Hi, While we are at the subject of tips for budding Vim scripters - I had created this mapping -- nmap com ^:if search('\/\*.*\*\/','c',line(.))!=0CR :.s/\/\*\(.*\)\*\//\1/gCR :elseCR :.s/\(\s*\)\(.*\)\(\s*\)/\1\/\*\2\*\/\3/gCR :endifCR :nohCR this command basically toggles C-style commenting on a line i.e. if the line wasn't commented it comments out the entire line and vice-versa. I spent an intense hour of exploring the help pages and plenty of effort in trial and error before I could reach the 'Eureka' moment. What I wanted to know is could the same functionality have been achieved by a better sequence of commands? Can an experienced 'vimmer' do better? Regards, Sibin -Original Message- From: Mikolaj Machowski [mailto:[EMAIL PROTECTED] Sent: Sunday, December 03, 2006 7:18 PM To: vim@vim.org Subject: Re: your best vim scripting tip On nie gru 3 2006, vim@vim.org wrote: Hi, It you should give one (or more) tips to a person who was going to start creating scripts for vim, then what would it be? (besides know your :help :-) ) ideas could be: Do's and dont's Keep ff=unix . In other case your scripts won't be working under non windows systems. Always supply modeline to make sure basic editing things will be working for others. When changing options use setlocal not set - be polite to user environment. Try to cut on g:variables (see above). Try to maintain documentation, not only for use of script but also for messing with it. best util script Each script covers only part of Vim functionality. It is hard to say which one is best for learning. often used functions It depends on what are you want to achieve. ways of optimization Avoid \| in complex regexps, often two, separate substite() are faster than one substite() with \|. Avoid * whenever possible, try to use \+ if appropriate. \x class is faster than [collection] When doing complex substitutions it is often faster to check if some part of pattern already exists and only if this is true execute substitution. m. -- I am social scientist - I don't know the difference between good and bad, only the difference between difference. DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.