folding question
Hi, I'm trying to make a fold region that looks for the following - when a line contains the word foo that's the start of the fold - when one or more lines later the word end is found that should close the line - or when the words end with one or more space char foo is found that should close the line So the following should work: foo end must be come +--- x lines: foo Secondly: foo end foo must become +--- y lines: foo Last: some text(not the word end) foo some other text endfoo must become +--- z lines: foo What happens is that my function folds everything. What is wrong with my function? I assume it trips over the end and foo. How to make the combination end and foo exclusive as ending-fold? nmap silent F4 :call OutlineToggle()CR function! OutlineToggle() if (! exists (b:outline_mode)) let b:outline_mode = 0 endif if (b:outline_mode == 0) syn region myFold2 start=foo end=end foo; transparent fold keepend extend syn sync fromstart set foldmethod=syntax let b:outline_mode = 1 else let b:outline_mode = 0 endif endfunction Rgds, Jeri -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Dynamically load a file to a plugin
hy everyone! Im trying to dynamically load some variables from a external file to a plugin... but readfile() returns a list and this is not working. My file has 2 multidimensions lists and im using \ to split that array into several lines... today im trying to do something like this: fun! ReadFile(file) Decho the variables if !filereadable(a:file) | return | endif let text = join(readfile(a:file),\n) call eval(text) Decho g:variable[0] to test if the array was readed endf there are something like a import or a include statement, or something like that? thankyou all in advance best regards Tcha-Tcho -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
RE: Dynamically load a file to a plugin
tcha-tcho wrote: Im trying to dynamically load some variables from a external file to a plugin... but readfile() returns a list and this is not working. My file has 2 multidimensions lists and im using \ to split that array into several lines... You have to do the work yourself. Two examples are in: http://vim.wikia.com/wiki/Highlight_multiple_words http://vim.wikia.com/wiki/Restore_screen_size_and_position John -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: folding question
Hi Jeri! On Mo, 09 Aug 2010, Jeri Raye wrote: Hi, I'm trying to make a fold region that looks for the following - when a line contains the word foo that's the start of the fold - when one or more lines later the word end is found that should close the line - or when the words end with one or more space char foo is found that should close the line So the following should work: foo end must be come +--- x lines: foo Secondly: foo end foo must become +--- y lines: foo Last: some text(not the word end) foo some other text endfoo must become +--- z lines: foo What happens is that my function folds everything. What is wrong with my function? I assume it trips over the end and foo. How to make the combination end and foo exclusive as ending-fold? How aboutusing fold-expression? Something like this: fu! MyFL1(lnum) if getline(a:lnum) =~ 'foo' return 'a1' elseif getline(a:lnum) =~ 'end' return 's1' else return '=' endif endfu set fde=MyFL1(v:lnum) regards, Christian -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: If I always use mouse under GTK to browse text file in gvim, sometimes gvim stops working.
On 08/08/10 18:38, H Xu wrote: Hello everybody, If I always use mouse under GTK to browse text file in gvim, sometimes gvim stops working: It will not respond any key strokes or mouse actions inside the vim box, what I can do is to click the close button. Anyone has any idea? Thank you. Regards, Hong Xu 08/09/2010 hm, all I can say is that it shouldn't happen. What gvim version? (7.2.446? 7.3e? Normal? Big? Huge? Recent 7.3 changesets have no GTK1 support, but if 7.2 or earlier: GTK1 or GTK2?) Do you know the GTK version? What is 'mouse' set to? (:verbose set mouse? ) Any special kind of mouse? Anything particular you did, that makes it happen more often? When it happens, is gvim using high or low CPU% time? (You can ascertain this using some program like [command-line] top, [KDE] ksysguard, [Gnome] gnome-system-monitor etc.) With a bug report, it is always better to provide too much information than too little. Best regards, Tony. -- Support your local Search and Rescue unit -- get lost. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
fold c++ style comment
Hi there, I have a c++ source file, in which there are paragraphs of comments before each function to describe it. I'm used to syntax foldmethod, which can fold the comment of style /*...*/. But it can't fold the comment like, //... //... //... I don't want to use plugin if any. Could I write something into the script file( vim_rc ) to fold these comment? Any suggestions are appreciated. BR Wayne -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Can I rely on purging locks by deepcopy function?
Ответ на сообщение «Re: Can I rely on purging locks by deepcopy function?», присланное в 05:16:45 09 августа 2010, Понедельник, отправитель winterTTr: We have different point of views: I consider lock being an attribute of an object (no matter how it is actually implemented), thus, in my mind, deepcopy purges it and so new object is no longer equal to old. Текст сообщения: On Mon, Aug 9, 2010 at 12:37 AM, ZyX zyx@gmail.com wrote: Consider the following code: let l=[[[]]] lockvar! l call add(l[0][0], l) Results in E741: Value is locked let l2=deepcopy(l) call add(l2[0][0], l) Succeeds Here you can see that deepcopy has purged all locks, but I do not see this behavior documented in :h deepcopy(), though it is somewhat mentioned in :h :lockvar: You may want to make a copy of a list to avoid this. See |deepcopy()|. Before i check the specific problem pointed by link below, as regards to your question about the deepcopy, i don't think there is any problem, it just do the right thing. Maybe the document about deepcopy does not mention about the effect to lockvar, but the result stands to reason. You can refer to the document about deepcopy. === When an item is a |List|, a copy for it is made, *recursively*. Thus changing an item in the copy does not change the contents of the *original *|List| === Yes, instead of purging all the locks, actually, the deepcopy function make a new instance of the object pointed by l. And now, l2 and l is pointing to the *different *object that has the *same value*. You lock the object pointed by l, but not the object pointed by l2. So, you can modify l2 without any locks warning, but if you want to modify l, the warning will come out again. Can I rely on this behavior? I want to implement something like an AlreadyChecked function from the first (and the only) answer to this question: http://stackoverflow.com/questions/3071476/checking-whether-some-object-h as- been-already-testedhttp://stackoverflow.com/questions/3071476/checking- whether-some-object-has-%0Abeen-already-tested signature.asc Description: This is a digitally signed message part.
Re: Can I rely on purging locks by deepcopy function?
On Mon, Aug 9, 2010 at 7:01 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение Re: Can I rely on purging locks by deepcopy function?, присланное в 05:16:45 09 августа 2010, Понедельник, отправитель winterTTr: We have different point of views: I consider lock being an attribute of an object (no matter how it is actually implemented), thus, in my mind, deepcopy purges it and so new object is no longer equal to old. OK, from the another point of view: we can say that the deepcopy purges the lock property and create a unlock new object. I also agree with this point of view :-) So you can enjoy this feature of deepcopy without any problem. Текст сообщения: On Mon, Aug 9, 2010 at 12:37 AM, ZyX zyx@gmail.com wrote: Consider the following code: let l=[[[]]] lockvar! l call add(l[0][0], l) Results in E741: Value is locked let l2=deepcopy(l) call add(l2[0][0], l) Succeeds Here you can see that deepcopy has purged all locks, but I do not see this behavior documented in :h deepcopy(), though it is somewhat mentioned in :h :lockvar: You may want to make a copy of a list to avoid this. See |deepcopy()|. Before i check the specific problem pointed by link below, as regards to your question about the deepcopy, i don't think there is any problem, it just do the right thing. Maybe the document about deepcopy does not mention about the effect to lockvar, but the result stands to reason. You can refer to the document about deepcopy. === When an item is a |List|, a copy for it is made, *recursively*. Thus changing an item in the copy does not change the contents of the *original *|List| === Yes, instead of purging all the locks, actually, the deepcopy function make a new instance of the object pointed by l. And now, l2 and l is pointing to the *different *object that has the *same value*. You lock the object pointed by l, but not the object pointed by l2. So, you can modify l2 without any locks warning, but if you want to modify l, the warning will come out again. Can I rely on this behavior? I want to implement something like an AlreadyChecked function from the first (and the only) answer to this question: http://stackoverflow.com/questions/3071476/checking-whether-some-object-h as- been-already-tested http://stackoverflow.com/questions/3071476/checking- whether-some-object-has-%0Abeen-already-tested -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: fold c++ style comment
Hi Wayne Can you do something with a fold expression? Assuming that a fold expression works as an extra mode when syntax foldmethod is on. Or something like done in http://vim.wikia.com/wiki/Syntax-based_folding I'm a complete newbie wrt to folding in vim, I'm just experimenting with it. HTH Rgds, Jeri Wayne wrote on 9-8-2010 11:35: Hi there, I have a c++ source file, in which there are paragraphs of comments before each function to describe it. I'm used to syntax foldmethod, which can fold the comment of style /*...*/. But it can't fold the comment like, //... //... //... I don't want to use plugin if any. Could I write something into the script file( vim_rc ) to fold these comment? Any suggestions are appreciated. BR Wayne -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
What is the preferred Portuguese spell file?
Hi, Vim uses OpenOffice spell files to build its own spell file, but the Portuguese spell files downloaded by runtime/spell/pt/main.aap are outdated. I'm making a patch to update the files to be downloaded and I know that currently the best BR version can be found at http://www.broffice.org/verortografico . Could people from Portugal or other Portuguese speaking countries, please, tell me what Portuguese spell file should be downloaded? I've found three options, the current one and other two: http://natura.di.uminho.pt/download/sources/Dictionaries/myspell/myspell.pt-latest.zip http://openoffice.caixamagica.pt/stable/3.0.1/extensions/Dictionary_pt/oo3x-pt-PT.oxt http://www.broffice.org/files/Vero_pt_PT_V207AOC.oxt For the last two there is information at: http://pt.openoffice.org/download/dics.htm http://www.broffice.org/verortografico Thanks, -- Jakson Aquino Brazil -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: how to display registers 0-9?- concise way enhanced #,*
On Thu, Aug 5, 2010 at 8:44 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение how to display registers 0-9?- concise way enhanced #,*, присланное в 16:54:56 05 августа 2010, Четверг, отправитель Yosi Izaq: execute 'registers '.join(range(0, 9)) ? ``execute'' may be truncated to ``exe'', ``registers'' to ``reg',' other part cannot by truncated, but ``jtab'' gives ``join('' and ``rtab'' gives ``range(''. Текст сообщения: Hi, Hi ZyX, Your answer to first part if helpful, though I didn't understand what's probably Russian. Thanks! Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? Thanks, Yosi -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Subsitute question
Is there a single command to change following patterns at once? %s/AAA/ZZZ/g %s/aaa/zzz/g Burak -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Subsitute question
Ответ на сообщение «Subsitute question», присланное в 16:52:43 09 августа 2010, Понедельник, отправитель Bu Rak: %s/aaa/\=((tolower(submatch(0))==submatch(0))?('zzz'):('ZZZ'))/ig Текст сообщения: Is there a single command to change following patterns at once? %s/AAA/ZZZ/g %s/aaa/zzz/g Burak signature.asc Description: This is a digitally signed message part.
Re: Visual bell in VIM
2010/8/4 Ricky J. Wu richi...@live.com: In my system, I add these two lines into vimrc: set noerrorbells novisualbell autocmd VimEnter * set vb t_vb= This does the trick for me also! Thanks Jeri -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.3e ready for beta testing
On 8 August 2010 23:01, Bram Moolenaar b...@moolenaar.net wrote: ... We are getting close to the 7.3 release! If nothing goes wrong I will release 7.3 in less than a week. Last chance to report problems! ... Bram, Great thanks to you for doing all this huge work on keeping Vim the best text editor. This work of yours helps so many people in the world, and in so many ways, to do their own work. The upcoming 7.3 release will no doubt improve on our experience with Vim, as all previous have done. However, I am concerned that the problems with Vim language's basic input and output about which I wrote several times, are, it seems, going to remain in 7.3 – and that means for at least another couple of years or more. Please reconsider this! One way to use Vimscript is to write and execute simple REPLs in the editor. A number of useful utilities, as well as educational programs can be written this way. Simple and reliable I/O primitives are essential to this, but, alas, Vim's :echo and input() have serious bugs each, and are even more problematic when used together. Said problems can be circumvented, I guess, but at the expense of ugliness and inconvenience reproduced in every single script. This would continually repel especially potential new users of Vim. I am once again describing the bugs and incosistencies I know of, in the hope that this would help to change your mind w.r.t. them. I am mostly repeating my previous posts but exposing the issues a bit more systematically. Thank you for your attention, best regards, Boyko ~ ==1== The documentation says that echo “… starts on a new line” but this is broken in at least several cases: (a) empty strings, e.g. for s in ['abc', '', 'def'] | echo s | endfor prints abc def rather than abc def (b) this doesn't look like empty strings but still: echo abc\n | echo def is supposed to output abc def but instead prints abc def (c) after a call of input(), e.g. in let x = input('') | echo 'ABC' the ABC string goes to the same line as the input; similarly, let x = input('') | echo \nABC prints ABC on the line immediately following the input(), while it should really leave an empty line between that of input() and that with the ABC. ==2== The documentation says nothing about whether input() always starts on a new line or not. Simple tests such as e.g. echo | let x = input('') lead one to concluding that it does. However, then, while 1 | let x = input('A') | echo R\n | endw should be expected to print empty lines between each R\n and the subsequent input('A') but it does not – that contradicts the assumption that input() always moves to a new line at start. (Besides, the echo is again erroneous as described in (c) above.) ==3== Reducing the R\n in the above example to just R: while 1 | let s = input('A') | echo 'R' | endw exhibits an even stranger behaviour. For a start, just enter several empty lines to each input() before breaking the loop: not only is the 'R' printed on the same line as 'A' (which it shouldn't) but each new 'R' is displaced more and more to the right. ==4== Once input() finishes, both the prompt and the entered string are being removed from display. Apart from this being, I believe, a wrong behaviour in itself, it, again, is not consistently manifested. This is easily seen by trying the last example above, this time entering non-empty lines. One can see that the implicitly echoed input is fully or partially (depending on its length) retained – which is probably a particular manifestation of some of the other bugs I mentioned (or perhaps a remnant of a correct behaviour). Also, the input()'s display, both the prompt and the entered text, is not removed if a single command such as :let x = input('PROMPT: ') is executed. I believe that input() should *never* remove the entered text, as well as the prompt, if any. Provided that it ends without moving to a new line, it shoild still be possible, if that is wanted, to erase the said text by ‘echon’-ing \r or \b. If removal is the default and one wants to keep the input, one would have to re-echo what he just typed in, which I think is much less natural. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: how to display registers 0-9?- concise way enhanced #,*
Ответ на сообщение «Re: how to display registers 0-9?- concise way enhanced #,*», присланное в 16:50:14 09 августа 2010, Понедельник, отправитель yosi izaq: Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? There are two ways: 1. Somewhat destructive, but the most simple: yank the word and search for it: noremap special \* yiW/C-r=escape(@, '^$*~[]\')CR 2. Custom function, like I use in my transliteration plugin to transliterate current word: let s:tWregs=[['\(\S*\)', '\(\S\+\|\%$\)'], \['\(\s*\)', '\(\s*\)' ],] function s:LRmatch(patlist) let line=getline('.') let column=col('.') let match=[] let i=0 let lpatlist=len(a:patlist) while ilpatlist (match==[] || match[0]=='') let pattern=a:patlist[i][0].'\%'.column.'c'.a:patlist[i][1] let match=matchlist(line, pattern) let i+=1 endwhile let lmatch=match[1] let rmatch=match[2] return escape(lmatch.rmatch, '^$*~[]\').\n endfunction You cannot use script global variables in mappings, but you can define a wrapper function function s:Eval(str) return eval(a:str) endfunction noremap expr \* /.SIDLRmatch(SIDEval('s:tWregs')) noremap expr \# ?.SIDLRmatch(SIDEval('s:tWregs')) This is a bit complicated, but it does not do anything with registers content (except current search register @/, of course) Your answer to first part if helpful, though I didn't understand what's probably Russian. Yes, it is russian: Ответ на сообщение «...» - reply to the message «TOPIC» присланное в ... - sent on DATE отправитель ... - sender NAME Текст сообщения: - Message text: Текст сообщения: On Thu, Aug 5, 2010 at 8:44 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение how to display registers 0-9?- concise way enhanced #,*, присланное в 16:54:56 05 августа 2010, Четверг, отправитель Yosi Izaq: execute 'registers '.join(range(0, 9)) ? ``execute'' may be truncated to ``exe'', ``registers'' to ``reg',' other part cannot by truncated, but ``jtab'' gives ``join('' and ``rtab'' gives ``range(''. Текст сообщения: Hi, Hi ZyX, Your answer to first part if helpful, though I didn't understand what's probably Russian. Thanks! Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? Thanks, Yosi signature.asc Description: This is a digitally signed message part.
Re: how to display registers 0-9?- concise way enhanced #,*
On Mon, Aug 9, 2010 at 6:07 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение Re: how to display registers 0-9?- concise way enhanced #,*, присланное в 16:50:14 09 августа 2010, Понедельник, отправитель yosi izaq: Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? There are two ways: 1. Somewhat destructive, but the most simple: yank the word and search for it: noremap special \* yiW/C-r=escape(@, '^$*~[]\')CR 2. Custom function, like I use in my transliteration plugin to transliterate current word: let s:tWregs=[['\(\S*\)', '\(\S\+\|\%$\)'], \['\(\s*\)', '\(\s*\)' ],] function s:LRmatch(patlist) let line=getline('.') let column=col('.') let match=[] let i=0 let lpatlist=len(a:patlist) while ilpatlist (match==[] || match[0]=='') let pattern=a:patlist[i][0].'\%'.column.'c'.a:patlist[i][1] let match=matchlist(line, pattern) let i+=1 endwhile let lmatch=match[1] let rmatch=match[2] return escape(lmatch.rmatch, '^$*~[]\').\n endfunction You cannot use script global variables in mappings, but you can define a wrapper function function s:Eval(str) return eval(a:str) endfunction noremap expr \* /.SIDLRmatch(SIDEval('s:tWregs')) noremap expr \# ?.SIDLRmatch(SIDEval('s:tWregs')) This is a bit complicated, but it does not do anything with registers content (except current search register @/, of course) Your answer to first part if helpful, though I didn't understand what's probably Russian. Yes, it is russian: Ответ на сообщение ... - reply to the message TOPIC присланное в ... - sent on DATE отправитель ... - sender NAME Текст сообщения: - Message text: Thanks for the answers. I chose the first option and tweaked it a bit to work with more spec. chars and add \# (duh), ending up with: noremap special \* yiW/C-r=escape(@, '^$*~[]\/')CR noremap special \# yiW?C-r=escape(@, '^$*~[]\/')CR I think it's useful enough to perhaps post as a tip. Thanks again, Yosi -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: how to display registers 0-9?- concise way enhanced #,*
\On Aug 9, 9:09 am, yosi izaq izaq...@gmail.com wrote: On Mon, Aug 9, 2010 at 6:07 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение Re: how to display registers 0-9?- concise way enhanced #,*, присланное в 16:50:14 09 августа 2010, Понедельник, отправитель yosi izaq: Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? There are two ways: 1. Somewhat destructive, but the most simple: yank the word and search for it: noremap special \* yiW/C-r=escape(@, '^$*~[]\')CR 2. Custom function, like I use in my transliteration plugin to transliterate current word: let s:tWregs=[['\(\S*\)', '\(\S\+\|\%$\)'], \['\(\s*\)', '\(\s*\)' ],] function s:LRmatch(patlist) let line=getline('.') let column=col('.') let match=[] let i=0 let lpatlist=len(a:patlist) while ilpatlist (match==[] || match[0]=='') let pattern=a:patlist[i][0].'\%'.column.'c'.a:patlist[i][1] let match=matchlist(line, pattern) let i+=1 endwhile let lmatch=match[1] let rmatch=match[2] return escape(lmatch.rmatch, '^$*~[]\').\n endfunction You cannot use script global variables in mappings, but you can define a wrapper function function s:Eval(str) return eval(a:str) endfunction noremap expr \* /.SIDLRmatch(SIDEval('s:tWregs')) noremap expr \# ?.SIDLRmatch(SIDEval('s:tWregs')) This is a bit complicated, but it does not do anything with registers content (except current search register @/, of course) Your answer to first part if helpful, though I didn't understand what's probably Russian. Yes, it is russian: Ответ на сообщение ... - reply to the message TOPIC присланное в ... - sent on DATE отправитель ... - sender NAME Текст сообщения: - Message text: Thanks for the answers. I chose the first option and tweaked it a bit to work with more spec. chars and add \# (duh), ending up with: noremap special \* yiW/C-r=escape(@, '^$*~[]\/')CR noremap special \# yiW?C-r=escape(@, '^$*~[]\/')CR I think it's useful enough to perhaps post as a tip. I like selecting the text to search. The following will search multi-line. It replaces the vim * search. Best viewed with mono-spaced font. multi line search -- selection literal (vi6.2 ok) :help c_C-R vnoremap * y/\VC-RC-R=substitute(escape(@,'/'),'\n','\ \n','g')crcr ||| ||| ||||+flag g=all ||| ||| |||+regex=cr ||| ||| ||+escape \ ||| ||| |+cr ||| ||| +contents of register ||| ||+expression register ||| |+contents of register LITERALLY ||| +contents of register ||+Very nomagic, only \ is magic |+search +yank selected into register -Bill -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.3e ready for beta testing
Boyko Bantchev wrote: On 8 August 2010 23:01, Bram Moolenaar b...@moolenaar.net wrote: ... We are getting close to the 7.3 release! If nothing goes wrong I will release 7.3 in less than a week. Last chance to report problems! ... Bram, Great thanks to you for doing all this huge work on keeping Vim the best text editor. This work of yours helps so many people in the world, and in so many ways, to do their own work. The upcoming 7.3 release will no doubt improve on our experience with Vim, as all previous have done. However, I am concerned that the problems with Vim language's basic input and output about which I wrote several times, are, it seems, going to remain in 7.3 – and that means for at least another couple of years or more. Please reconsider this! One way to use Vimscript is to write and execute simple REPLs in the editor. A number of useful utilities, as well as educational programs can be written this way. Simple and reliable I/O primitives are essential to this, but, alas, Vim's :echo and input() have serious bugs each, and are even more problematic when used together. Said problems can be circumvented, I guess, but at the expense of ugliness and inconvenience reproduced in every single script. This would continually repel especially potential new users of Vim. I am once again describing the bugs and incosistencies I know of, in the hope that this would help to change your mind w.r.t. them. I am mostly repeating my previous posts but exposing the issues a bit more systematically. I am not going to change this now, because: - it's not a new problem in 7.3 - it is going to be incompatible with previous versions, some scripts may need to be adjusted - knowing how Vim does this it's possible to make it work Thank you for your attention, best regards, Boyko ~ ==1== The documentation says that echo “… starts on a new line” but this is broken in at least several cases: (a) empty strings, e.g. for s in ['abc', '', 'def'] | echo s | endfor prints abc def rather than abc def It only starts a new line if you have output something. Change the empty string to ' ' and it works. (b) this doesn't look like empty strings but still: echo abc\n | echo def is supposed to output abc def but instead prints abc def This works: echo abc\n | echo def abc def (c) after a call of input(), e.g. in let x = input('') | echo 'ABC' the ABC string goes to the same line as the input; similarly, let x = input('') | echo \nABC prints ABC on the line immediately following the input(), while it should really leave an empty line between that of input() and that with the ABC. This is intentional, it avoids having to press Enter at the more-prompt. You can echo the result of input() if you want to see it. ==2== The documentation says nothing about whether input() always starts on a new line or not. Simple tests such as e.g. echo | let x = input('') lead one to concluding that it does. However, then, while 1 | let x = input('A') | echo R\n | endw should be expected to print empty lines between each R\n and the subsequent input('A') but it does not – that contradicts the assumption that input() always moves to a new line at start. It's difficult to explain how this works and probably also depends on options settings, such as 'shortmess'. You can see what happens. (Besides, the echo is again erroneous as described in (c) above.) Please don't call things an error when it might actually be intended behavior. ==3== Reducing the R\n in the above example to just R: while 1 | let s = input('A') | echo 'R' | endw exhibits an even stranger behaviour. For a start, just enter several empty lines to each input() before breaking the loop: not only is the 'R' printed on the same line as 'A' (which it shouldn't) but each new 'R' is displaced more and more to the right. That looks like a bug. ==4== Once input() finishes, both the prompt and the entered string are being removed from display. Apart from this being, I believe, a wrong behaviour in itself, it, again, is not consistently manifested. This is easily seen by trying the last example above, this time entering non-empty lines. One can see that the implicitly echoed input is fully or partially (depending on its length) retained – which is probably a particular manifestation of some of the other bugs I mentioned (or perhaps a remnant of a correct behaviour). Also, the input()'s display, both the prompt and the entered text, is not removed if a single command such as :let x = input('PROMPT: ') is executed. I believe that input() should *never* remove the entered text, as well as the prompt, if any. Provided that it ends without
Re: how to display registers 0-9?- concise way enhanced #,*
Ответ на сообщение «Re: how to display registers 0-9?- concise way enhanced #,*», присланное в 20:09:40 09 августа 2010, Понедельник, отправитель yosi izaq: I chose the first option and tweaked it a bit to work with more spec. chars and add \# (duh), ending up with: noremap special \* yiW/C-r=escape(@, '^$*~[]\/')CR noremap special \# yiW?C-r=escape(@, '^$*~[]\/')CR I think, you should remove ``'' from escape arguments: not escaping something like ``html'' will cause searching for ``html'' because 1) there is no special sequence ``html'' (this is actual only if someone want to use my function) and 2) there are no special ... sequence in patterns. But escaping ``'' in ``html'' will cause searching for word ``html'', not for a tag, see ``:h /\''. So, ``/'' is the only character I forgot (that is because I just copied escaping function I wrote for matchstr and substitute, they does not treat ``/'' specially). Текст сообщения: On Mon, Aug 9, 2010 at 6:07 PM, ZyX zyx@gmail.com wrote: Ответ на сообщение Re: how to display registers 0-9?- concise way enhanced #,*, присланное в 16:50:14 09 августа 2010, Понедельник, отправитель yosi izaq: Any idea re. how to search for WORD with */# shortcuts?- Can I make a map like \* \# for that?- Or is there already a common mapping that does the same? There are two ways: 1. Somewhat destructive, but the most simple: yank the word and search for it: noremap special \* yiW/C-r=escape(@, '^$*~[]\')CR 2. Custom function, like I use in my transliteration plugin to transliterate current word: let s:tWregs=[['\(\S*\)', '\(\S\+\|\%$\)'], \['\(\s*\)', '\(\s*\)' ],] function s:LRmatch(patlist) let line=getline('.') let column=col('.') let match=[] let i=0 let lpatlist=len(a:patlist) while ilpatlist (match==[] || match[0]=='') let pattern=a:patlist[i][0].'\%'.column.'c'.a:patlist[i][ 1] let match=matchlist(line, pattern) let i+=1 endwhile let lmatch=match[1] let rmatch=match[2] return escape(lmatch.rmatch, '^$*~[]\').\n endfunction You cannot use script global variables in mappings, but you can define a wrapper function function s:Eval(str) return eval(a:str) endfunction noremap expr \* /.SIDLRmatch(SIDEval('s:tWregs')) noremap expr \# ?.SIDLRmatch(SIDEval('s:tWregs')) This is a bit complicated, but it does not do anything with registers content (except current search register @/, of course) Your answer to first part if helpful, though I didn't understand what's probably Russian. Yes, it is russian: Ответ на сообщение ... - reply to the message TOPIC присланное в ... - sent on DATE отправитель ... - sender NAME Текст сообщения: - Message text: Thanks for the answers. I chose the first option and tweaked it a bit to work with more spec. chars and add \# (duh), ending up with: noremap special \* yiW/C-r=escape(@, '^$*~[]\/')CR noremap special \# yiW?C-r=escape(@, '^$*~[]\/')CR I think it's useful enough to perhaps post as a tip. Thanks again, Yosi signature.asc Description: This is a digitally signed message part.
Re: What is the preferred Portuguese spell file?
Jakson A. Aquino wrote: Vim uses OpenOffice spell files to build its own spell file, but the Portuguese spell files downloaded by runtime/spell/pt/main.aap are outdated. I'm making a patch to update the files to be downloaded and I know that currently the best BR version can be found at http://www.broffice.org/verortografico . Could people from Portugal or other Portuguese speaking countries, please, tell me what Portuguese spell file should be downloaded? I've found three options, the current one and other two: http://natura.di.uminho.pt/download/sources/Dictionaries/myspell/myspell.pt-latest.zip http://openoffice.caixamagica.pt/stable/3.0.1/extensions/Dictionary_pt/oo3x-pt-PT.oxt http://www.broffice.org/files/Vero_pt_PT_V207AOC.oxt For the last two there is information at: http://pt.openoffice.org/download/dics.htm http://www.broffice.org/verortografico Why not use the one from the official openoffice.org extensions site? http://extensions.services.openoffice.org/e-files/1196/5/oo3x-pt-PT.oxt I believe this is the one automatically installed for OpenOffice.org. The .oxt file is in zip format. A similar file is used for Dutch (NL) and Swedish (SV). -- hundred-and-one symptoms of being an internet addict: 30. Even though you died last week, you've managed to retain OPS on your favorite IRC channel. /// Bram Moolenaar -- b...@moolenaar.net -- 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/// -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: What is the preferred Portuguese spell file?
On Mon, Aug 9, 2010 at 5:55 PM, Bram Moolenaar b...@moolenaar.net wrote: Jakson A. Aquino wrote: Vim uses OpenOffice spell files to build its own spell file, but the Portuguese spell files downloaded by runtime/spell/pt/main.aap are outdated. I'm making a patch to update the files to be downloaded and I know that currently the best BR version can be found at http://www.broffice.org/verortografico . Could people from Portugal or other Portuguese speaking countries, please, tell me what Portuguese spell file should be downloaded? I've found three options, the current one and other two: http://natura.di.uminho.pt/download/sources/Dictionaries/myspell/myspell.pt-latest.zip http://openoffice.caixamagica.pt/stable/3.0.1/extensions/Dictionary_pt/oo3x-pt-PT.oxt http://www.broffice.org/files/Vero_pt_PT_V207AOC.oxt For the last two there is information at: http://pt.openoffice.org/download/dics.htm http://www.broffice.org/verortografico Why not use the one from the official openoffice.org extensions site? http://extensions.services.openoffice.org/e-files/1196/5/oo3x-pt-PT.oxt Yes, I'll use it. The broffice version of the European Portuguese list is bigger and already includes the changes of the recent orthographic agreement. However, people from Europe may prefer the official OpenOffice version. Best regards, Jakson Aquino -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
How to modify make.vim to capture 'undefine' a new keyword in GNU Make?
Hi, GNU Make recently added a new keyword 'undefine'. I'm not familiar with vim enough to modify the following make.vim files. Could anybody let me where I can added 'undefine' in these files? /usr/share/vim/vim72/ftplugin/make.vim /usr/share/vim/vim72/indent/make.vim /usr/share/vim/vim72/syntax/make.vim Regards, Peng -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Is there a way to have mouse control in a Quit Edit mode Windows console?
On 05/08/10 15:57, Jean Johner wrote: Hello, Vim works nicely in a Windows XP cmd console. set mouse=a is activated by default so that mouse control works. However, if the Quit Edit mode is selected for the console, mouse control is lost (clicking somewhere does not move the Vim cursor) despite the fact that set mouse=a is set. Is there a way to have mouse control in a Quick Edit mode console? Best regards, Jean Johner What is Quick Edit Mode? To see the possible settings of the 'mouse' option, see :help 'mouse' The 'mousemodel' option (q.v.) might be relevant too. If the console snatches the mouse click before it reaches Vim, there's no way Vim can act on a mouse click that it doesn't get. Best regards, Tony. -- Arithmetic is being able to count up to twenty without taking off your shoes. -- Mickey Mouse -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Tips for remembering command's of scripts
On 06/08/10 15:29, Jeri Raye wrote: Hi, Maybe a stupid question but do you have any tips on rembering all the command's provided by plugin scripts? How to do that? Do you write them on a paper besides your PC? Or on another way. There are a lot of scripts with fantastic functionality. But me personaly find it hard to remember all the command's provided. To give an example, one of the scripts I just discoverd is the c.vim script. It has a nice GUI with the command's also mentioned in the GUI. So as a newbie of the script it's easy to use trough the GUI, and to learn the short command's later on. Rgds, Jeri If the plugin is written in the grand Vim tradition (not all 3rd-party scripts are though) it should have a helpfile that comes with it, describing all the commands it provides. See for examples of such help: :help pi_vimball.txt :help pi_netrw.txt and in particular :help netrw-ex Best regards, Tony. -- All Finagle Laws may be bypassed by learning the simple art of doing without thinking. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: fold c++ style comment
Hi Jeri, Sorry, I'm not familiar with fold expression. I checked the url you provided, but nothing useful found related to folding c++ style comment. Thanks anyway. Wayne On Mon, Aug 9, 2010 at 7:12 PM, Jeri Raye jeri.r...@gmail.com wrote: Hi Wayne Can you do something with a fold expression? Assuming that a fold expression works as an extra mode when syntax foldmethod is on. Or something like done in http://vim.wikia.com/wiki/Syntax-based_folding I'm a complete newbie wrt to folding in vim, I'm just experimenting with it. HTH Rgds, Jeri Wayne wrote on 9-8-2010 11:35: Hi there, I have a c++ source file, in which there are paragraphs of comments before each function to describe it. I'm used to syntax foldmethod, which can fold the comment of style /*...*/. But it can't fold the comment like, //... //... //... I don't want to use plugin if any. Could I write something into the script file( vim_rc ) to fold these comment? Any suggestions are appreciated. BR Wayne -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: If I always use mouse under GTK to browse text file in gvim, sometimes gvim stops working.
On 2010/8/9 16:10, Tony Mechelynck wrote: On 08/08/10 18:38, H Xu wrote: Hello everybody, If I always use mouse under GTK to browse text file in gvim, sometimes gvim stops working: It will not respond any key strokes or mouse actions inside the vim box, what I can do is to click the close button. Anyone has any idea? Thank you. Regards, Hong Xu 08/09/2010 hm, all I can say is that it shouldn't happen. What gvim version? (7.2.446? 7.3e? Normal? Big? Huge? Recent 7.3 changesets have no GTK1 support, but if 7.2 or earlier: GTK1 or GTK2?) Do you know the GTK version? What is 'mouse' set to? (:verbose set mouse? ) Any special kind of mouse? Anything particular you did, that makes it happen more often? When it happens, is gvim using high or low CPU% time? (You can ascertain this using some program like [command-line] top, [KDE] ksysguard, [Gnome] gnome-system-monitor etc.) With a bug report, it is always better to provide too much information than too little. Best regards, Tony. Hello, OK, Here is my test environment: OS: Linux (Fedora 13) Desktop: GNOME and KDE gvim: both 7.2.446 and 7.3e GTK: vim 7.2: version 1 and 2vim7.3: version 2, Huge version, with python enabled mouse is set to a To reproduce it, don't use keyboard. For example, browse the help files. use mouse to click on the links and use the mouse wheel to scroll. And sometimes select some text by mouse. Keep doing this. A few minutes later, or maybe less than one minute, it's not sure, it happens( sometimes it doesn't happen then you have to restart gvim to reproduce it). However, I test it under gvim 7.3f today, and it seems that it doesn't happen now(at least until now I haven't seen it). I don't know the reason, but if it works well then it's ok. If I see it again, I will report it here. Thanks. Regards, Hong Xu 2010/8/9 -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Tips for remembering command's of scripts
AK: If I get you right, you've basically implemented a docstring parser for VimL... do I read you? Is this code published somewhere? It sounds sweet. I'm a big fan of using `:help blah^D` to get a list of commands/ functions/other help topics that contain blah. I'm approaching the point of reorganizing a bunch of my custom commands into some sort of structured ensemble, and I'm considering building a hierarchical completion system working. So eg :Module ^D Command1 Command2 Command3 ... :Module Command1 ^D Option1 Option2 Option3 ... Has anyone had success with something like this? Is there perhaps a framework available in some module that I could hook into? On a (semi-) related note, is there a parser available somewhere that can arrange for quoted text containing spaces, or text delimited by backslash-escaped spaces, to be considered a single argument? It would be easy enough to use Python's, but that would hurt portability. Cheers -Ted On Aug 9, 11:03 pm, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 06/08/10 15:29, Jeri Raye wrote: Hi, Maybe a stupid question but do you have any tips on rembering all the command's provided by plugin scripts? How to do that? Do you write them on a paper besides your PC? Or on another way. There are a lot of scripts with fantastic functionality. But me personaly find it hard to remember all the command's provided. To give an example, one of the scripts I just discoverd is the c.vim script. It has a nice GUI with the command's also mentioned in the GUI. So as a newbie of the script it's easy to use trough the GUI, and to learn the short command's later on. Rgds, Jeri If the plugin is written in the grand Vim tradition (not all 3rd-party scripts are though) it should have a helpfile that comes with it, describing all the commands it provides. See for examples of such help: :help pi_vimball.txt :help pi_netrw.txt and in particular :help netrw-ex Best regards, Tony. -- All Finagle Laws may be bypassed by learning the simple art of doing without thinking. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.3e ready for beta testing
Although I'm not certain that I understand the full set of use cases that would benefit from a resolution of these inconsistencies, it seems plausible to me that most or all of the use cases could be implemented in a buffer with some insightful mappings (of, for example, `i_^M`) and/or autocommands. There are at least a couple of full-blown shells that run in a buffer this way: [vimshell] and [conque]. Maybe their techniques could be useful to you. As a tentative suggestion for resolving the inconsistencies with `:echo`: perhaps there could be an option which would enable full echoing, including empty lines, set by default to the current behaviour? Cheers -Ted [conque]: http://www.vim.org/scripts/script.php?script_id=2771 [vimshell]: http://github.com/Shougo/vimshell On Aug 9, 5:02 pm, Bram Moolenaar b...@moolenaar.net wrote: Boyko Bantchev wrote: On 8 August 2010 23:01, Bram Moolenaar b...@moolenaar.net wrote: ... We are getting close to the 7.3 release! If nothing goes wrong I will release 7.3 in less than a week. Last chance to report problems! ... Bram, Great thanks to you for doing all this huge work on keeping Vim the best text editor. This work of yours helps so many people in the world, and in so many ways, to do their own work. The upcoming 7.3 release will no doubt improve on our experience with Vim, as all previous have done. However, I am concerned that the problems with Vim language's basic input and output about which I wrote several times, are, it seems, going to remain in 7.3 – and that means for at least another couple of years or more. Please reconsider this! One way to use Vimscript is to write and execute simple REPLs in the editor. A number of useful utilities, as well as educational programs can be written this way. Simple and reliable I/O primitives are essential to this, but, alas, Vim's :echo and input() have serious bugs each, and are even more problematic when used together. Said problems can be circumvented, I guess, but at the expense of ugliness and inconvenience reproduced in every single script. This would continually repel especially potential new users of Vim. I am once again describing the bugs and incosistencies I know of, in the hope that this would help to change your mind w.r.t. them. I am mostly repeating my previous posts but exposing the issues a bit more systematically. I am not going to change this now, because: - it's not a new problem in 7.3 - it is going to be incompatible with previous versions, some scripts may need to be adjusted - knowing how Vim does this it's possible to make it work Thank you for your attention, best regards, Boyko ~ ==1== The documentation says that echo “… starts on a new line” but this is broken in at least several cases: (a) empty strings, e.g. for s in ['abc', '', 'def'] | echo s | endfor prints abc def rather than abc def It only starts a new line if you have output something. Change the empty string to ' ' and it works. (b) this doesn't look like empty strings but still: echo abc\n | echo def is supposed to output abc def but instead prints abc def This works: echo abc\n | echo def abc def (c) after a call of input(), e.g. in let x = input('') | echo 'ABC' the ABC string goes to the same line as the input; similarly, let x = input('') | echo \nABC prints ABC on the line immediately following the input(), while it should really leave an empty line between that of input() and that with the ABC. This is intentional, it avoids having to press Enter at the more-prompt. You can echo the result of input() if you want to see it. ==2== The documentation says nothing about whether input() always starts on a new line or not. Simple tests such as e.g. echo | let x = input('') lead one to concluding that it does. However, then, while 1 | let x = input('A') | echo R\n | endw should be expected to print empty lines between each R\n and the subsequent input('A') but it does not – that contradicts the assumption that input() always moves to a new line at start. It's difficult to explain how this works and probably also depends on options settings, such as 'shortmess'. You can see what happens. (Besides, the echo is again erroneous as described in (c) above.) Please don't call things an error when it might actually be intended behavior. ==3== Reducing the R\n in the above example to just R: while 1 | let s = input('A') | echo 'R' | endw exhibits an even stranger behaviour. For a start, just enter several empty lines to each input() before breaking the loop: not only is the 'R' printed on the same line as 'A' (which it
Re: how to deal with a space in a directory path in vim
It might be more straightforward to set the setting using let, eg :let path = 'C:\my\ projects/...' I tried a simpler such path containing a space under linux and `:find` was able to find a file there. Cheers -Ted On Aug 9, 11:26 pm, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 07/08/10 07:31, just wrote: 2010/8/7 Jeri Raye jeri.r...@gmail.com mailto:jeri.r...@gmail.com Hi, I would like add a path in a setting for example: set tags=c:\my projects\test\tags (notice the space char between my and projects) You can use the two methods to setting 1set tags=c:\my projects\test\tags 2set tags=c:\my~1\test\tags Hm, #1 won't work, because spaces and double-quotes (also backslashes and vertical bars) must be backslash-escaped in an option value, see :help option-backslash). Try either set tags=C:/my\ projects/test/tags or set tags=C:/my\\ projects/test/tags or set tags=\C:/my\ projects/test/tags\ (I'm not sure which will work) and #2 won't work either, because it is not the correct 8.3 name. It should be something like set tags=C:/MYPROJ~1/test/tags (Vim for Windows will usually accept either / or \ as path separators.) Best regards, Tony. -- Those who make peaceful revolution impossible will make violent revolution inevitable. -- John F. Kennedy -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php