Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread Bram Moolenaar

Alexey Froloff wrote:

 * Alexey I. Froloff raorn@ [061021 17:53]:
  Vim should _support_ Meta-Sends-Escape mode which is A Must Have
  for non-ascii 8-bit locales
 Patch attached.
 
 New option - 'eightbitmeta' ('em'), default on.  If unset, two
 things happen:
 
 1. M-x is stored internaly as Escx sequence (was (x |
 0x80)).
 
 2. Alt+key puts Esckey to input buffer (GUI only).

How do you distinguish between someone typing Esc key and Esc key
generated by Alt+key?

-- 
From know your smileys:
 :~)A man with a tape recorder up his nose

 /// 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: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread Alexey I. Froloff
* Bram Moolenaar Bram@ [061022 14:27]:
 How do you distinguish between someone typing Esc key and
 Esc key generated by Alt+key?
I don't.  No program can do that, as Tony mentioned earlier.
bash (readline) for example:

M-b - backward-word

Alt+b and Escb works both the same, if Alt+Key sends EscKey
sequence.  Consider this as a feature.

With 'em' unset Vim behaves like every console application.

-- 
Regards,
Sir Raorn.


signature.asc
Description: Digital signature


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread Alexey I. Froloff
* Bram Moolenaar Bram@ [061022 17:41]:
 I don't want to support that, because it causes mistakes.  Consider
 being in Insert mode and typing Esc o to open a new line or Esc
 n to find the next match.  A timeout won't help, the two keys can be
 typed within ten msec.
So, all plugins that imap something to Alt+Key a screwed up in
all non-ascii 8-bit locales.  Moreover, such maps breaks normal
text entering.

There is something outside your latin-1 world.  Take a look
around, you, 7-bit racists.

-- 
Regards,
Sir Raorn.


signature.asc
Description: Digital signature


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread A.J.Mechelynck

Alexey I. Froloff wrote:

* Bram Moolenaar Bram@ [061022 14:27]:

How do you distinguish between someone typing Esc key and
Esc key generated by Alt+key?

I don't.  No program can do that, as Tony mentioned earlier.
bash (readline) for example:

M-b - backward-word

Alt+b and Escb works both the same, if Alt+Key sends EscKey
sequence.  Consider this as a feature.

With 'em' unset Vim behaves like every console application.



I should qualify what I said before: if you have 'ttimeout' (or 'timeout') on, 
and 'ttimeoutlen' set to a well-chosen positive value (longer than the delay 
between successive bytes added by the keyboard interface for a single 
keypress, but shorter than your usual typing speed), Vim will be able to 
determine that Esc key was typed-in rather than M-key, by means of the 
timeout: let's say you have :set ttimeout ttimeoutlen=100 then if the delay 
between the Esc byte and the next one is  0.1s Vim will see it as Escape + 
something, not Meta-something. (By default, 'ttimeoutlen' is negative, meaning 
that the same, relatively long timeout applies for both special keys and 
mappings.)


What I said before still applies in the case of key combinations which send a 
single byte (e.g. Meta-is-high-bit), because in that case there is no timeout.



Best regards,
Tony.


Vim charity: Drought continues

2006-10-22 Thread Bram Moolenaar

Greetings, Vim users.

If you don't care about helping needy children in Uganda, which is Vim's
charity, then skip this message.


As mentioned before, the area of Kibaale has been suffering from a
drought for several months now.  Here is an update from Jackie Ammeter
that I received today:

The famine and drought continue to worsen. Yes, we have been getting a
bit of rain, but a shower once a week is far from adequate. We should be
getting 2 or 3 hours of rain every other day for two months straight in
order to bring everything back to life. People are actually beginning to
die of hunger.

Everyday we are having hungry and needy people coming for help. I can't
really describe the difficulty of the situation. On Monday, about 20
people came to the community development office pleading for help.
Justine came and told me about the most heart-wrenching case of the day:
a 10 year old girl came asking for food for herself and for her siblings
aged 8, 6, and 4 whom she was looking after. Their parents had died and
they were living with a grandmother who was currently in the hospital.
They hadn't eaten in 3 or 4 days. Justine said the girl was just
shaking.

We also had a grandfather who was caring for a baby grandchild. He had
no milk to give the baby. We gave him 6,000 (about $4) to buy milk for
one month. The needs are endless and people are now saying the crisis
far surpasses that of 1992.


For more background information read about the famine relief program:

http://iccf-holland.org/famine2006.html


-- 
From know your smileys:
 :-)-O  Smiling doctor with stethoscope

 /// 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///


Undo/modified bug

2006-10-22 Thread Christian J. Robinson

Sometimes when I make a modification, write the file, then make a
couple more modifications, write the file again, and finally
repeatedly undo back to the state the file was in at the first
write--without writing again--vim will report the file as not
modified.

I've tried very hard to find a way to consistently reproduce this bug,
but I can't.

- Christian

-- 
  Microsoft is to software what McDonalds is to gourmet cooking.
Christian J. Robinson [EMAIL PROTECTED] http://infynity.spodzone.com/
   PGP keys: 0x893B0EAF / 0xFB698360   http://infynity.spodzone.com/pgp


Re: Undo/modified bug

2006-10-22 Thread Bram Moolenaar

Christian J. Robinson wrote:

 Sometimes when I make a modification, write the file, then make a
 couple more modifications, write the file again, and finally
 repeatedly undo back to the state the file was in at the first
 write--without writing again--vim will report the file as not
 modified.

It shouldn't happen.

 I've tried very hard to find a way to consistently reproduce this bug,
 but I can't.

I'm afraid I can't guess what causes this, thus there is nothing I can
do.

-- 
From know your smileys:
 :-{}   Too much lipstick

 /// 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: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread A.J.Mechelynck

Ilya Sher wrote:

A.J.Mechelynck wrote:

Alexey I. Froloff wrote:

* Bram Moolenaar Bram@ [061022 17:41]:

I don't want to support that, because it causes mistakes.  Consider
being in Insert mode and typing Esc o to open a new line or Esc
n to find the next match.  A timeout won't help, the two keys can be
typed within ten msec.

So, all plugins that imap something to Alt+Key a screwed up in
all non-ascii 8-bit locales.  Moreover, such maps breaks normal
text entering.

There is something outside your latin-1 world.  Take a look
around, you, 7-bit racists.


- Maybe Bram Moolenaar can type at 100 keystrokes / second, I can't.
Especially if one of the keys is Esc, which is far away from almost
everything else.

Assuming one-handed typing, (especially for Esco and Escn)
which is almost always not true for vim users.

Assumption that people use keyboard mappings
where Esc is far away is true most of the time
but not always. (Common exception is caps lock
generating Esc).


[snip]



When I say I can't, I'm talking about me on my keyboard, where the Esc key 
is at top left, and the nearest keys are (²³¬) (1|) (é2@) and F1 (Between 
round brackets: unshifted, with Shift, and with AltGr, in that order, for a 
single key).


I'm not assuming that _you_ cannot type 100 keystrokes per second, though I 
would bet that the Vimmers who can are a minority at best. ;-)



Best regards,
Tony.


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread A.J.Mechelynck

Alexey I. Froloff wrote:
[...]

P.S. Please, don't tell me that I should not use M-x in
insert-mode mappings, tell this to script maintainers.
latexSuite for example.



If you have a problem with the Latex-Suite, then IMHO you should mention that, 
and it would do no harm to add the Latex-Suite maintainer in the CC: line. 
Similarly for any other package that gives you problems. If you identify the 
problematic mappings in the package, you may even propose a different mapping. 
If some package mapping interferes with some non-7-bit-ASCII letter (be it 
your cyrillic И or my French é) I don't think the maintainer will refuse to 
change the mapping, or make it configurable.



Best regards,
Tony.


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-22 Thread Alexey I. Froloff
* A.J.Mechelynck antoine.mechelynck@ [061022 22:41]:
 - Maybe Bram Moolenaar can type at 100 keystrokes / second, I can't. 
[..skip..]
http://marc.theaimsgroup.com/?l=vim-devm=116133874121615w=2

Please, read this.  Twice.  I can't enter CYRILLIC CAPITAL I if I
have imap on M-i.

 - There is indeed something beyond 7-bit ASCII, but that is no
I'm describing you my problem for three days.  You don't even
want to listen.  You prefer to tell me stories about dozens and
lids...

 - What about the part you snipped (about CSI rather than ESC)?
If you look closely, you mention that two places were changed.
First - GUI input processing, second - special key parser, that
used in map command - both GUI and console.

Can I use CSI in console?  How will I know, if someone typed Esc
i or pressed Alt+I?  Why gvim sets eight bit instead of using
CSI?

By the way, default behavior is not changed, and 'to' and
'ttimeout' still works.

P.S. Please, don't tell me that I should not use M-x in
insert-mode mappings, tell this to script maintainers.
latexSuite for example.

-- 
Regards,
Sir Raorn.


signature.asc
Description: Digital signature


Re: Terminating search in function

2006-10-22 Thread A.J.Mechelynck

Meino Christian Cramer wrote:

Hi,

 I wrote this snippet:


fun! Ffunchdr()
let date = strftime( %F )

put='/*-*/'
put='/**'
put=' * desc'
put=' *'
put=' *'
put=' *'
put=' * Created: ' . date . '
put=' *'
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' *'
put=' * result 0 - Success, -1 - Failure'
put=' *'
put=' */'
?desc
endfun
command! Funchdr :call Ffunchdr()



This should give nme the header comment for function definitions in C.
My problem seems to be the ?desc command at the end.
It /should/ move the cursor onto the desc keyword right in the
beginning of the comment block.

But it move the cursor to here:

  * desc 
  ^

  |
  cursor position

My analysis (a too big word...) of the problem is: ? is still
waiting for input. I tried


?descCR

instead, but now ? tries to find descCR literally and did not
find it.

There seem to be an exception of the type the commands as you would
do normally-rule here...but what is the rule to recognize that the
current situation is an exception and what is the solution?

Thank you very much in advance for any help ! :)

Have a nice weekend!
mcc




What you're using is a searching range (as in :?desc from the keyboard). 
It positions the cursor on the first nonblank in the matched line.


To use a search command (as in ?desc from the keyboard) in an Ex-command 
line, use :normal:


normal ?desc

see
:help :range
:help :normal


Best regards,
Tony.


Re: Terminating search in function

2006-10-22 Thread Meino Christian Cramer
From: A.J.Mechelynck [EMAIL PROTECTED]
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 09:33:01 +0200

 Meino Christian Cramer wrote:
  Hi,
  
   I wrote this snippet:
  
  
  fun! Ffunchdr()
  let date = strftime( %F )
  
  put='/*-*/'
  put='/**'
  put=' * desc'
  put=' *'
  put=' *'
  put=' *'
  put=' * Created: ' . date . '
  put=' *'
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' *'
  put=' * result 0 - Success, -1 - Failure'
  put=' *'
  put=' */'
  ?desc
  endfun
  command! Funchdr :call Ffunchdr()
  
  
  
  This should give nme the header comment for function definitions in C.
  My problem seems to be the ?desc command at the end.
  It /should/ move the cursor onto the desc keyword right in the
  beginning of the comment block.
  
  But it move the cursor to here:
  
* desc 
^
|
cursor position
  
  My analysis (a too big word...) of the problem is: ? is still
  waiting for input. I tried
  
  
  ?descCR
  
  instead, but now ? tries to find descCR literally and did not
  find it.
  
  There seem to be an exception of the type the commands as you would
  do normally-rule here...but what is the rule to recognize that the
  current situation is an exception and what is the solution?
  
  Thank you very much in advance for any help ! :)
  
  Have a nice weekend!
  mcc
  
  
 
 What you're using is a searching range (as in :?desc from the keyboard). 
 It positions the cursor on the first nonblank in the matched line.
 
 To use a search command (as in ?desc from the keyboard) in an Ex-command 
 line, use :normal:
 
   normal ?desc
 
 see
   :help :range
   :help :normal
 
 
 Best regards,
 Tony.
 

Hi Tony,

 :O) thank you,Tony !:O)

  
 execute normal ?desc\CR
 
 will do the job and it seems, that a final

 execute normal cw on the found desc cannot be done correctly,
 since the command is not finished (which it should eb according to
 the :help normal text).

 Have a nice weekend!
 mcc
  


 


cnoremap + getcmdtype()

2006-10-22 Thread Yakov Lerner

cnoremap exprenter (getcmdtype()=='/' ? \n:redraw : \n)

I am intercepring the enter in the /pattern search.

When search is found, it works. E.g., type /.enter, and you see :redraw
as a sign that mapping worked.

But when search was not found, this mapping does not work.
Why ? Type /xyzxyzenter, and :redraw does not appear. Why ?

Yakov


Re: Terminating search in function

2006-10-22 Thread A.J.Mechelynck

Meino Christian Cramer wrote:

From: A.J.Mechelynck [EMAIL PROTECTED]
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 09:33:01 +0200


Meino Christian Cramer wrote:

Hi,

 I wrote this snippet:


fun! Ffunchdr()
let date = strftime( %F )

put='/*-*/'
put='/**'
put=' * desc'
put=' *'
put=' *'
put=' *'
put=' * Created: ' . date . '
put=' *'
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' *'
put=' * result 0 - Success, -1 - Failure'
put=' *'
put=' */'
?desc
endfun
command! Funchdr :call Ffunchdr()



This should give nme the header comment for function definitions in C.
My problem seems to be the ?desc command at the end.
It /should/ move the cursor onto the desc keyword right in the
beginning of the comment block.

But it move the cursor to here:

  * desc 
  ^

  |
  cursor position

My analysis (a too big word...) of the problem is: ? is still
waiting for input. I tried


?descCR

instead, but now ? tries to find descCR literally and did not
find it.

There seem to be an exception of the type the commands as you would
do normally-rule here...but what is the rule to recognize that the
current situation is an exception and what is the solution?

Thank you very much in advance for any help ! :)

Have a nice weekend!
mcc


What you're using is a searching range (as in :?desc from the keyboard). 
It positions the cursor on the first nonblank in the matched line.


To use a search command (as in ?desc from the keyboard) in an Ex-command 
line, use :normal:


normal ?desc

see
:help :range
:help :normal


Best regards,
Tony.



Hi Tony,

 :O) thank you,Tony !:O)

  
 execute normal ?desc\CR
 
 will do the job and it seems, that a final


 execute normal cw on the found desc cannot be done correctly,
 since the command is not finished (which it should eb according to
 the :help normal text).

 Have a nice weekend!
 mcc
  



 



normal cw is not finished since the c (change) commands needs to be told 
_to_ what you want to change the replaced word. What you can do instead (IIUC) 
is normal diw (delete inner word) followed by startinsert!. Note that 
startinsert[!] only makes sense as the last statement of the script (because 
insert-mode will be delayed until then).


Have a nice weekend too.


Best regards,
Tony.


Tutorial Part 2

2006-10-22 Thread Java Bob
I learnt most of what I know about gVim from the tutorial.  I know it's a
lot to ask for but a Tutorial Part 2 would be excellent.  It could
introduce concept and applications of:-
  Regular Expressions,
  Options,
autocmd,
  text formatting,
  scripting,
  compiling,
  map/noremap

I admit that all the information is in the manuals but I learnt so much, so
fast, with the tutorial that it is only natural to want more.  And there are
some people on this list who are already writing books in small email steps
anyway.

However if you say go away, you lazy person you'd be well within your
rights!  :-)




Re: Tutorial Part 2

2006-10-22 Thread Yakov Lerner

On 10/22/06, Java Bob [EMAIL PROTECTED] wrote:

I learnt most of what I know about gVim from the tutorial.  I know it's a
lot to ask for but a Tutorial Part 2 would be excellent.  It could
introduce concept and applications of:-
  Regular Expressions,
  Options,
autocmd,
  text formatting,
  scripting,
  compiling,
  map/noremap


Did you read usr_27 .. usr_45 ? I think most of the concepts
that you mention are taught there:
   :help usr_27
   :help usr_28
   ...
   :help usr_45

Also :help usr_toc

Yakov


Re: cnoremap + getcmdtype()

2006-10-22 Thread Bram Moolenaar

Yakov Lerner wrote:

 cnoremap exprenter (getcmdtype()=='/' ? \n:redraw : \n)
 
 I am intercepring the enter in the /pattern search.
 
 When search is found, it works. E.g., type /.enter, and you see :redraw
 as a sign that mapping worked.
 
 But when search was not found, this mapping does not work.
 Why ? Type /xyzxyzenter, and :redraw does not appear. Why ?

The \n that executes the search will result in an error.  This error
will clear the typeahead, thus :redraw is gone.

-- 
From know your smileys:
 :-HIs missing teeth

 /// 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: Terminating search in function

2006-10-22 Thread A.J.Mechelynck

Meino Christian Cramer wrote:

From: A.J.Mechelynck [EMAIL PROTECTED]
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 11:00:14 +0200


Meino Christian Cramer wrote:

From: A.J.Mechelynck [EMAIL PROTECTED]
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 09:33:01 +0200


Meino Christian Cramer wrote:

Hi,

 I wrote this snippet:


fun! Ffunchdr()
let date = strftime( %F )

put='/*-*/'
put='/**'
put=' * desc'
put=' *'
put=' *'
put=' *'
put=' * Created: ' . date . '
put=' *'
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' *'
put=' * result 0 - Success, -1 - Failure'
put=' *'
put=' */'
?desc
endfun
command! Funchdr :call Ffunchdr()



This should give nme the header comment for function definitions in C.
My problem seems to be the ?desc command at the end.
It /should/ move the cursor onto the desc keyword right in the
beginning of the comment block.

But it move the cursor to here:

  * desc 
  ^

  |
  cursor position

My analysis (a too big word...) of the problem is: ? is still
waiting for input. I tried


?descCR

instead, but now ? tries to find descCR literally and did not
find it.

There seem to be an exception of the type the commands as you would
do normally-rule here...but what is the rule to recognize that the
current situation is an exception and what is the solution?

Thank you very much in advance for any help ! :)

Have a nice weekend!
mcc


What you're using is a searching range (as in :?desc from the keyboard). 
It positions the cursor on the first nonblank in the matched line.


To use a search command (as in ?desc from the keyboard) in an Ex-command 
line, use :normal:


normal ?desc

see
:help :range
:help :normal


Best regards,
Tony.


Hi Tony,

 :O) thank you,Tony !:O)

  
 execute normal ?desc\CR
 
 will do the job and it seems, that a final


 execute normal cw on the found desc cannot be done correctly,
 since the command is not finished (which it should eb according to
 the :help normal text).

 Have a nice weekend!
 mcc
  



 

normal cw is not finished since the c (change) commands needs to be told 
_to_ what you want to change the replaced word. What you can do instead (IIUC) 
is normal diw (delete inner word) followed by startinsert!. Note that 
startinsert[!] only makes sense as the last statement of the script (because 
insert-mode will be delayed until then).


Have a nice weekend too.


Best regards,
Tony.



Hi Tony,

 ...the normal diw+startinsert!-trick works nice !
 Thanks a lot -- such little helpers like the now
 finally working Function-header-function() are the
 _real_ stuff helping one to speed up the daily work --
 and of course the helping hands, which make the helper-function 
 work ... :O)


 Happy VIMming!
 mcc




 



BTW, instead of all those put statements, wouldn't it be simpler to have 
your template as a separate file, and use :r filename to insert it after the 
cursor?



Best regards,
Tonoy.


Re: cnoremap + getcmdtype()

2006-10-22 Thread Yakov Lerner

On 10/22/06, Bram Moolenaar [EMAIL PROTECTED] wrote:


Yakov Lerner wrote:

 cnoremap exprenter (getcmdtype()=='/' ? \n:redraw : \n)

 I am intercepring the enter in the /pattern search.

 When search is found, it works. E.g., type /.enter, and you see :redraw
 as a sign that mapping worked.

 But when search was not found, this mapping does not work.
 Why ? Type /xyzxyzenter, and :redraw does not appear. Why ?

The \n that executes the search will result in an error.  This error
will clear the typeahead, thus :redraw is gone.


Thanks
Yakov


Re: Tutorial Part 2

2006-10-22 Thread A.J.Mechelynck

Java Bob wrote:

I learnt most of what I know about gVim from the tutorial.  I know it's a
lot to ask for but a Tutorial Part 2 would be excellent.  It could
introduce concept and applications of:-
  Regular Expressions,
  Options,
autocmd,
  text formatting,
  scripting,
  compiling,
  map/noremap

I admit that all the information is in the manuals but I learnt so much, so
fast, with the tutorial that it is only natural to want more.  And there are
some people on this list who are already writing books in small email steps
anyway.

However if you say go away, you lazy person you'd be well within your
rights!  :-)





I'd not call you lazy, nor even tell you to go away, but go ahead and write 
it up!.



Best regards,
Tony.


Bug: CursorHoldI not triggered after startinsert

2006-10-22 Thread Hari Krishna Dara

I am using :startinsert! from my plugin to put the user in insert mode,
but if the user doesn't type anything for 'updatetime' after this, no
CursorHoldI event is generated. I tried doing an explicit :doauto right
after :startinsert!, but Vim ignores it, probably because the command
only schedules for an insert mode (doesn't immediate change it).

Note that the CursorMovedI gets triggered correctly in this case, but I
don't want to use that as I don't want to know about every character
that user types, but only when the user is holding.

Any suggestions for a workaround?

I have Vim7 upto the patch 146.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Terminating search in function

2006-10-22 Thread Yakov Lerner

Meino Christian Cramer wrote:
execute normal ?desc\CR


Yes. There is also :call search('pattern', 'b'). It is a bit less
painful substitute to exe normal ?pattern\cr.

Yakov


RE: Tutorial Part 2

2006-10-22 Thread Java Bob
 
 Java Bob wrote:
  I learnt most of what I know about gVim from the tutorial.  I 
 know it's a
  lot to ask for but a Tutorial Part 2 would be excellent.  It could
  introduce concept and applications of:-
Regular Expressions,
Options,
  autocmd,
text formatting,
scripting,
compiling,
map/noremap
  
  I admit that all the information is in the manuals but I learnt 
 so much, so
  fast, with the tutorial that it is only natural to want more.  
 And there are
  some people on this list who are already writing books in small 
 email steps
  anyway.
  
  However if you say go away, you lazy person you'd be well within your
  rights!  :-)
  
  
  
 
 I'd not call you lazy, nor even tell you to go away, but go 
 ahead and write 
 it up!.
 
 
 Best regards,
 Tony.
 

Um, err, well its an idea, cheers Tony   :-)



Re: Terminating search in function

2006-10-22 Thread Meino Christian Cramer
From: A.J.Mechelynck [EMAIL PROTECTED]
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 12:29:36 +0200

 Meino Christian Cramer wrote:
  From: A.J.Mechelynck [EMAIL PROTECTED]
  Subject: Re: Terminating search in function
  Date: Sun, 22 Oct 2006 11:00:14 +0200
  
  Meino Christian Cramer wrote:
  From: A.J.Mechelynck [EMAIL PROTECTED]
  Subject: Re: Terminating search in function
  Date: Sun, 22 Oct 2006 09:33:01 +0200
 
  Meino Christian Cramer wrote:
  Hi,
 
   I wrote this snippet:
 
  
  fun! Ffunchdr()
  let date = strftime( %F )
  
  put='/*-*/'
  put='/**'
  put=' * desc'
  put=' *'
  put=' *'
  put=' *'
  put=' * Created: ' . date . '
  put=' *'
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' * parameter:
  put=' *'
  put=' * result 0 - Success, -1 - Failure'
  put=' *'
  put=' */'
  ?desc
  endfun
  command! Funchdr :call Ffunchdr()
 
 
 
  This should give nme the header comment for function definitions in C.
  My problem seems to be the ?desc command at the end.
  It /should/ move the cursor onto the desc keyword right in the
  beginning of the comment block.
 
  But it move the cursor to here:
 
* desc 
^
|
cursor position
 
  My analysis (a too big word...) of the problem is: ? is still
  waiting for input. I tried
 
 
  ?descCR
 
  instead, but now ? tries to find descCR literally and did not
  find it.
 
  There seem to be an exception of the type the commands as you would
  do normally-rule here...but what is the rule to recognize that the
  current situation is an exception and what is the solution?
 
  Thank you very much in advance for any help ! :)
 
  Have a nice weekend!
  mcc
 
 
  What you're using is a searching range (as in :?desc from the 
  keyboard). 
  It positions the cursor on the first nonblank in the matched line.
 
  To use a search command (as in ?desc from the keyboard) in an 
  Ex-command 
  line, use :normal:
 
   normal ?desc
 
  see
   :help :range
   :help :normal
 
 
  Best regards,
  Tony.
 
  Hi Tony,
 
   :O) thank you,Tony !:O)
 

   execute normal ?desc\CR
   
   will do the job and it seems, that a final
 
   execute normal cw on the found desc cannot be done correctly,
   since the command is not finished (which it should eb according to
   the :help normal text).
 
   Have a nice weekend!
   mcc

 
 
   
 
  normal cw is not finished since the c (change) commands needs to be told 
  _to_ what you want to change the replaced word. What you can do instead 
  (IIUC) 
  is normal diw (delete inner word) followed by startinsert!. Note that 
  startinsert[!] only makes sense as the last statement of the script 
  (because 
  insert-mode will be delayed until then).
 
  Have a nice weekend too.
 
 
  Best regards,
  Tony.
 
  
  Hi Tony,
  
   ...the normal diw+startinsert!-trick works nice !
   Thanks a lot -- such little helpers like the now
   finally working Function-header-function() are the
   _real_ stuff helping one to speed up the daily work --
   and of course the helping hands, which make the helper-function 
   work ... :O)
  
   Happy VIMming!
   mcc
  
  
  
  
   
  
 
 BTW, instead of all those put statements, wouldn't it be simpler to have 
 your template as a separate file, and use :r filename to insert it after 
 the 
 cursor?
 
 
 Best regards,
 Tonoy.
 

Hi Tony,

 ...hrrr clear answer: yesno! :O)

 Yes: It would be the cleaner and more flexible way to implement this, no doubt!
 No : Currently it is the only thing inserting an header/template or
  such into text. It would just add another file to care of. As
  soon as I have more than a single template to handle, it will
  surely the better way to do it with seperated files.

 By the way: Is there a way to puts more than a single line?
 Something like an HERE-doc? 

 :h permutations of 'here-doc'

 gives me nothing...

 Keep hacking!
 mcc


  


Vim charity: Drought continues

2006-10-22 Thread Bram Moolenaar

Greetings, Vim users.

If you don't care about helping needy children in Uganda, which is Vim's
charity, then skip this message.


As mentioned before, the area of Kibaale has been suffering from a
drought for several months now.  Here is an update from Jackie Ammeter
that I received today:

The famine and drought continue to worsen. Yes, we have been getting a
bit of rain, but a shower once a week is far from adequate. We should be
getting 2 or 3 hours of rain every other day for two months straight in
order to bring everything back to life. People are actually beginning to
die of hunger.

Everyday we are having hungry and needy people coming for help. I can't
really describe the difficulty of the situation. On Monday, about 20
people came to the community development office pleading for help.
Justine came and told me about the most heart-wrenching case of the day:
a 10 year old girl came asking for food for herself and for her siblings
aged 8, 6, and 4 whom she was looking after. Their parents had died and
they were living with a grandmother who was currently in the hospital.
They hadn't eaten in 3 or 4 days. Justine said the girl was just
shaking.

We also had a grandfather who was caring for a baby grandchild. He had
no milk to give the baby. We gave him 6,000 (about $4) to buy milk for
one month. The needs are endless and people are now saying the crisis
far surpasses that of 1992.


For more background information read about the famine relief program:

http://iccf-holland.org/famine2006.html


-- 
From know your smileys:
 :-)-O  Smiling doctor with stethoscope

 /// 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: Terminating search in function

2006-10-22 Thread A.J.Mechelynck

Meino Christian Cramer wrote:

From: A.J.Mechelynck [EMAIL PROTECTED]

[...]
BTW, instead of all those put statements, wouldn't it be simpler to have 
your template as a separate file, and use :r filename to insert it after the 
cursor?



Best regards,
Tony.



Hi Tony,

 ...hrrr clear answer: yesno! :O)

 Yes: It would be the cleaner and more flexible way to implement this, no doubt!
 No : Currently it is the only thing inserting an header/template or
  such into text. It would just add another file to care of. As
  soon as I have more than a single template to handle, it will
  surely the better way to do it with seperated files.

 By the way: Is there a way to puts more than a single line?
 Something like an HERE-doc? 


 :h permutations of 'here-doc'

 gives me nothing...

 Keep hacking!
 mcc


See :help :append and :help :insert. I didn't know about them either but I 
knew that perl  EOF (or similar) could start a here-document for any of 
the 5 interpreted languages. :helpgrep  brought (among others) a page 
where :append and :insert were mentioned.



Best regards,
Tony.


Re: Adding (put) more than a single line

2006-10-22 Thread Yegappan Lakshmanan

Hi,

On 10/22/06, Meino Christian Cramer [EMAIL PROTECTED] wrote:


 By the way: Is there a way to puts more than a single line?
 Something like an HERE-doc?

 :h permutations of 'here-doc'

 gives me nothing...



You can use any one of the following methods to add/put more than
a single line:

---
   0append
# Filename:
# Description:
# Author:
# Last Modified:
.
---

---
   let t = [# Filename:,
   \ # Description:,
   \ # Author:,
   \ # Last Modified:]
   call append(0, t)
---

---
   0put ='# Filename:'
   put ='# Description:'
   put ='# Author:'
   put ='# Last Modified:'
---

---
   let x = # Filename:\n# Description:\n# Author:\n# Last Modified:
   0put =x
---

- Yegappan


missing setbufline()?

2006-10-22 Thread Hari Krishna Dara

I see functions for creating new unlisted buffers (bufnr() with {create}
option), and for reading the lines from the buffer using getbufline(),
all without having to change the current buffer, but I don't see a
setbufline() so there is no way to set the lines without having to
switch to it. Is there a reason to leave this circle incomplete?

-- 
Thank you,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


filter text through python script

2006-10-22 Thread Rick Dooling
Hello,

I'm sure this is my fault or some Windows snafu. But using gvim 7.0 on
Windows XP, I can't seem to get gvim to successfully filter text
through a Python script. I also use NoteTab and have no problems
running text from NoteTab through the same Python script.

Any vimmers help with this?

I'm sending standard text with the vim command :%!sort.py

The Python script (sort.py) is:

from sys import stdin
input = stdin.read().split('\n')
input.sort()
print '\n'.join(input)

I get:

Traceback (most recent call last):
  File d:\python\sort.py, line 2, in ?
input = stdin.read().split('\n')
IOError: [Errno 9] Bad file descriptor

Thanks, 

rd

ps - I posted on Python group also, sorry for any duplication.





Re: Bug: CursorHoldI not triggered after startinsert

2006-10-22 Thread Hari Krishna Dara

On Sun, 22 Oct 2006 at 5:25pm, Hari Krishna Dara wrote:


 I am using :startinsert! from my plugin to put the user in insert mode,
 but if the user doesn't type anything for 'updatetime' after this, no
 CursorHoldI event is generated. I tried doing an explicit :doauto right
 after :startinsert!, but Vim ignores it, probably because the command
 only schedules for an insert mode (doesn't immediate change it).

 Note that the CursorMovedI gets triggered correctly in this case, but I
 don't want to use that as I don't want to know about every character
 that user types, but only when the user is holding.

 Any suggestions for a workaround?

 I have Vim7 upto the patch 146.

I tried to convert the first CursorMovedI to CursorHoldI using the below code:

aug LookupFileCursorHoldIHACK
  au!
  au CursorMovedI buffer nested exec 'doautocmd LookupFile CursorHoldI' | au!
LookupFileCursorHoldIHACK
aug END

This also gets ignored :(

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Spam on vim.org

2006-10-22 Thread Peter Hodge
Hello,

Can the person responsible please remove this spam from vim.org?

http://www.vim.org/tips/tip.php?tip_id=1367

regards,
Peter



 
Do you Yahoo!? 
Yahoo!7 Time Capsule - Make your mark and be a part of history
http://www.yahoo7.com.au/timecapsule


Re: missing setbufline()?

2006-10-22 Thread Yegappan Lakshmanan

Hi Hari,

On 10/22/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:


I see functions for creating new unlisted buffers (bufnr() with {create}
option), and for reading the lines from the buffer using getbufline(),
all without having to change the current buffer, but I don't see a
setbufline() so there is no way to set the lines without having to
switch to it. Is there a reason to leave this circle incomplete?



Yes. I had a patch for the setbufline() function last year. There were
several problems with it. So it was not included in Vim7 and only
the getbufline() function was included.

The setbufline() function worked only for loaded buffers. The undo
history was not updated correctly.

But I agree that it will be good to have the setbufline() function.

- Yegappan


Re: Spam on vim.org

2006-10-22 Thread Yongwei Wu

Removed.

Don't worry, spam won't stay there long. There are more than 10 people
checking for spam in different time zones. Checking the tip list you
will find holes in the sequence numbers, which indicates removed tips.

On 10/23/06, Peter Hodge [EMAIL PROTECTED] wrote:

Hello,

Can the person responsible please remove this spam from vim.org?

http://www.vim.org/tips/tip.php?tip_id=1367

regards,
Peter


--
Wu Yongwei
URL: http://wyw.dcweb.cn/


Re: missing setbufline()?

2006-10-22 Thread Hari Krishna Dara

On Sun, 22 Oct 2006 at 6:20pm, Yegappan Lakshmanan wrote:

 Hi Hari,

 On 10/22/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:
 
  I see functions for creating new unlisted buffers (bufnr() with {create}
  option), and for reading the lines from the buffer using getbufline(),
  all without having to change the current buffer, but I don't see a
  setbufline() so there is no way to set the lines without having to
  switch to it. Is there a reason to leave this circle incomplete?
 

 Yes. I had a patch for the setbufline() function last year. There were
 several problems with it. So it was not included in Vim7 and only
 the getbufline() function was included.

 The setbufline() function worked only for loaded buffers. The undo
 history was not updated correctly.

 But I agree that it will be good to have the setbufline() function.

 - Yegappan

Nice, so it will be included at some point after resolving these issues.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Need help about 3 questions

2006-10-22 Thread Raymond
Hello all, 

I'm new to Vim, now i'm using GVim 7.0 on Windows system.
Here is my questions.

1. Just installed UTL.VIM plugin ( http://vim.sf.net/script.php?script_id=293). 
 Its \gu
feature is usful to me. One thing I couldn't figure out is how to highlight 
URLs and email
address in text file. According to its doc file this should be possible. Could 
any one
help me?

2. Now I know how to install *.vim plugin. Then I encounter VISINCR.VBA plugin 
(http://www.vim.org/scripts/script.php?script_id=670). How to install this kind 
of *.vba
plugin?

3. Anyone here use Total Commander? When viewing Vim-edited file with TC 
lister, tab
alignment is a little mess up. How can I adjust vimrc configuration so tab 
alignment looks
the same both in Vim and in TC lister?
At present related configuration in my vimrc like this:
set tabstop=4
set shiftwidth=4

I appreciate if anyone could help me.

Best Regards,
Raymond




Re: missing setbufline()?

2006-10-22 Thread Yegappan Lakshmanan

Hi Hari,

On 10/22/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:

 On 10/22/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:
 
  I see functions for creating new unlisted buffers (bufnr() with {create}
  option), and for reading the lines from the buffer using getbufline(),
  all without having to change the current buffer, but I don't see a
  setbufline() so there is no way to set the lines without having to
  switch to it. Is there a reason to leave this circle incomplete?
 

 Yes. I had a patch for the setbufline() function last year. There were
 several problems with it. So it was not included in Vim7 and only
 the getbufline() function was included.

 The setbufline() function worked only for loaded buffers. The undo
 history was not updated correctly.

 But I agree that it will be good to have the setbufline() function.

 - Yegappan

Nice, so it will be included at some point after resolving these issues.



You can try the attached patch against the latest Vim7 sources.
The syntax of the new function is:

   setbufline({expr}, {lnum}, {line})

where, {expr} specifies the loaded buffer name/number, {lnum} specifies
a valid line number in that buffer and {line} is either a single line
or a List of lines.

Note. The patch also includes the new gettabvar() and settabvar()
functions.

- Yegappan
Index: src/eval.c
===
RCS file: /cvsroot/vim/vim7/src/eval.c,v
retrieving revision 1.198
diff -c -p -r1.198 eval.c
*** src/eval.c	17 Oct 2006 13:16:39 -	1.198
--- src/eval.c	23 Oct 2006 04:26:57 -
*** static void f_getpos __ARGS((typval_T *a
*** 531,536 
--- 531,537 
  static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_getregtype __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_gettabvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_gettabwinvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_getwinposx __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_getwinposy __ARGS((typval_T *argvars, typval_T *rettv));
*** static void f_searchpairpos __ARGS((typv
*** 611,616 
--- 612,618 
  static void f_searchpos __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_server2client __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_serverlist __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_setbufline __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setbufvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setcmdpos __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setline __ARGS((typval_T *argvars, typval_T *rettv));
*** static void f_setloclist __ARGS((typval_
*** 618,623 
--- 620,626 
  static void f_setpos __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setqflist __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setreg __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_settabvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_settabwinvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_shellescape __ARGS((typval_T *argvars, typval_T *rettv));
*** static void getwinvar __ARGS((typval_T *
*** 740,745 
--- 743,749 
  static int searchpair_cmn __ARGS((typval_T *argvars, pos_T *match_pos));
  static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos, int *flagsp));
  static void setwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
+ static void set_buffer_lines __ARGS((buf_T *buf, linenr_T lnum, char_u *line, list_T *l, typval_T *rettv));
  
  /* Character used as separated in autoload function/variable names. */
  #define AUTOLOAD_CHAR '#'
*** static struct fst
*** 7077,7082 
--- 7081,7087 
  {getqflist,	0, 0, f_getqflist},
  {getreg,		0, 2, f_getreg},
  {getregtype,	0, 1, f_getregtype},
+ {gettabvar,	2, 2, f_gettabvar},
  {gettabwinvar,	3, 3, f_gettabwinvar},
  {getwinposx,	0, 0, f_getwinposx},
  {getwinposy,	0, 0, f_getwinposy},
*** static struct fst
*** 7159,7164 
--- 7164,7170 
  {searchpos,	1, 3, f_searchpos},
  {server2client,	2, 2, f_server2client},
  {serverlist,	0, 0, f_serverlist},
+ {setbufline,	3, 3, f_setbufline},
  {setbufvar,	3, 3, f_setbufvar},
  {setcmdpos,	1, 1, f_setcmdpos},
  {setline,		2, 2, f_setline},
*** static struct fst
*** 7166,7171 
--- 7172,7178 
  {setpos,		2, 2, f_setpos},
  {setqflist,	1, 2, f_setqflist},
  {setreg,		2, 3, f_setreg},
+ {settabvar,	3, 3, f_settabvar},
  {settabwinvar,	4, 4, f_settabwinvar},
  {setwinvar,	3, 3, f_setwinvar},
  {shellescape,	1, 1, f_shellescape},
*** f_getregtype(argvars, 

Re: Need help about 3 questions

2006-10-22 Thread Bill McCarthy
On Sun 22-Oct-06 11:09pm -0600, Raymond wrote:

 I'm new to Vim, now i'm using GVim 7.0 on Windows system.
 Here is my questions.

 2. Now I know how to install *.vim plugin. Then I
 encounter VISINCR.VBA plugin
 (http://www.vim.org/scripts/script.php?script_id=670). How
 to install this kind of *.vba
 plugin?

I don't use UTL.vim or Total Commander, so I can't help you.

However, *.vba are vimballs (kind of like tarballs).  All
you do is edit one and it tells you what to do - type:

:so %

That will place the files in the appropriate directories
(usually under your vimfiles subdirectory).  The actual
place is the first directory of 'rtp' (type :set rtp?).

You should have a recent version of the vimball plugin (the
one in the distribution is about 5 months old).  You can the
latest at the author's site:

http://mysite.verizon.net/astronaut/vim

or at vim online:

http://vim.sf.net

An even better approach for updating you runtime files is to
update from the vim ftp site.  For windows, and using 4nt as
your shell, the command is:

copy /[!*~] /u /s ftp://ftp.home.vim.org/pub/vim/runtime/dos/*; 
c:\vim\vim70\

That's all on one line.  It copies all new or newer files
for all subdirectories excluding files ending with '~'.
c:\vim\vim70 is my runtime directory - replace it with
yours.

-- 
Best regards,
Bill