Re: detecting first and last line of the current paragraph

2011-07-24 Thread Jose Caballero
On Jul 23, 2011, at 18:00, Tim Chase v...@tim.thechases.com wrote: On 07/23/2011 12:59 PM, Jose Caballero wrote: 2011/7/23 Ben Schmidtmail_ben_schm...@yahoo.com.au You don't need to apologies for bothering us. If we didn't enjoy helping people with Vim, we wouldn't be on this mailing

Re: detecting first and last line of the current paragraph

2011-07-24 Thread Jose Caballero
1.- to protect it from crashing when I use vim 6.x I guess there has to be something similar to the python sys.version or sys.version_info variables. :help v:version I already found v:version on the web. I am embedding the whole function into a if v:version 700 endif

Re: detecting first and last line of the current paragraph

2011-07-23 Thread ZyX
Reply to message «Re: detecting first and last line of the current paragraph», sent 02:59:48 23 July 2011, Saturday by Jose Caballero: let firstline = search('^\s*$', 'bnW') + 1 let lastline = search('^\s*$\|\%$', 'nW', line('$')) if lastline != line

Re: detecting first and last line of the current paragraph

2011-07-23 Thread Andy Wokula
Am 23.07.2011 04:29, schrieb Tim Chase: On 07/22/2011 05:59 PM, Jose Caballero wrote: So far, that is the best solution I have. It is quite ugly, but seems to work... function Comment() let firstline = search('^\s*$', 'bnW') + 1 let lastline = search('^\s*$\|\%$', 'nW', line('$')) if lastline

Re: detecting first and last line of the current paragraph

2011-07-23 Thread Andy Wokula
Am 23.07.2011 00:59, schrieb Jose Caballero: Hi, I wanted to thank you guys for the patience, and for all the tips. I am quite new with Vimscript, so everything is hard to me. But that is the reason I keep trying, to learn and to educate myself. Sorry for bothering you guys. As I said, trying

Re: detecting first and last line of the current paragraph

2011-07-23 Thread Ben Schmidt
I wanted to thank you guys for the patience, and for all the tips. I am quite new with Vimscript, so everything is hard to me. But that is the reason I keep trying, to learn and to educate myself. Sorry for bothering you guys. As I said, trying to educate myself with Vimscript, You don't need

Re: detecting first and last line of the current paragraph

2011-07-23 Thread Jose Caballero
2011/7/23 Ben Schmidt mail_ben_schm...@yahoo.com.au I wanted to thank you guys for the patience, and for all the tips. I am quite new with Vimscript, so everything is hard to me. But that is the reason I keep trying, to learn and to educate myself. Sorry for bothering you guys. As I said,

Re: detecting first and last line of the current paragraph

2011-07-23 Thread Tim Chase
On 07/23/2011 12:59 PM, Jose Caballero wrote: 2011/7/23 Ben Schmidtmail_ben_schm...@yahoo.com.au You don't need to apologies for bothering us. If we didn't enjoy helping people with Vim, we wouldn't be on this mailing list. It's also clear that you've put in some effort yourself into solving

Re: detecting first and last line of the current paragraph

2011-07-22 Thread Ben Schmidt
Thanks a lot for all your comments! For this particular purpose, the visual way is perfect. However, I am still interested in the regex way, because that will allow me to do other things with the paragraph and not only adding a char at the beginning. Note that you can do a lot with the visual

Re: detecting first and last line of the current paragraph

2011-07-22 Thread Jose Caballero
2011/7/22 Ben Schmidt mail_ben_schm...@yahoo.com.au Thanks a lot for all your comments! For this particular purpose, the visual way is perfect. However, I am still interested in the regex way, because that will allow me to do other things with the paragraph and not only adding a char at the

Re: detecting first and last line of the current paragraph

2011-07-22 Thread Jose Caballero
Hi, I wanted to thank you guys for the patience, and for all the tips. I am quite new with Vimscript, so everything is hard to me. But that is the reason I keep trying, to learn and to educate myself. Sorry for bothering you guys. As I said, trying to educate myself with Vimscript, I am still

Re: detecting first and last line of the current paragraph

2011-07-22 Thread Tim Chase
On 07/22/2011 05:59 PM, Jose Caballero wrote: So far, that is the best solution I have. It is quite ugly, but seems to work... function Comment() let firstline = search('^\s*$', 'bnW') + 1 let lastline = search('^\s*$\|\%$', 'nW', line('$')) if lastline != line('$')

detecting first and last line of the current paragraph

2011-07-21 Thread Jose Caballero
Hi, I am trying to write a function to comment all lines of code in a block. Note the main purpose for this is to educate myself on vim scripting, given I am quite new with it. I am sure there are many other solutions to do it, and much better, but I want to do it in this way to learn. I have

Re: detecting first and last line of the current paragraph

2011-07-21 Thread Ben Schmidt
On 22/07/11 9:56 AM, Jose Caballero wrote: Hi, I am trying to write a function to comment all lines of code in a block. Note the main purpose for this is to educate myself on vim scripting, given I am quite new with it. I am sure there are many other solutions to do it, and much better, but I

Re: detecting first and last line of the current paragraph

2011-07-21 Thread ZyX
Reply to message «Re: detecting first and last line of the current paragraph», sent 05:43:54 22 July 2011, Friday by Ben Schmidt: Or you could just check whether the search fails or not: let lastline = search('^\s*$', 'nW') let lastline = lastline == -1 ? line('$') : lastline - 1 Failed