Re: getchar() trick with recursive expr map

2006-10-26 Thread A.J.Mechelynck
Hari Krishna Dara wrote: On Wed, 25 Oct 2006 at 11:33pm, Mikolaj Machowski wrote: On ¶ro pa¼ 25 2006, Mikolaj Machowski wrote: In Linux terminal and GTK2 versions cursor is stuck in command line and don't at its real position making inserting of text almost random. Getting stuck at

Re: getchar() trick with recursive expr map

2006-10-25 Thread Mikolaj Machowski
On śro paź 25 2006, Mikolaj Machowski wrote: In Linux terminal and GTK2 versions cursor is stuck in command line and don't at its real position making inserting of text almost random. Getting stuck at command-line is normal, as it is always waiting on getchar(). I realize will not be

Re: getchar() trick with recursive expr map

2006-10-25 Thread Hari Krishna Dara
On Wed, 25 Oct 2006 at 11:33pm, Mikolaj Machowski wrote: On ¶ro pa¼ 25 2006, Mikolaj Machowski wrote: In Linux terminal and GTK2 versions cursor is stuck in command line and don't at its real position making inserting of text almost random. Getting stuck at command-line is normal, as it

getchar() trick with recursive expr map

2006-10-20 Thread Hari Krishna Dara
I remember someone posting a patch to add a new event called GetChar to receive an event for every keypress. This trick is not as powerful and flexible as that, but it can be very useful for a plugin, and is supported in Vim7.0 with no patches. Often there are questions on this list on how to

Re: getchar() trick with recursive expr map

2006-10-20 Thread Benji Fisher
On Thu, Oct 19, 2006 at 11:26:53PM -0700, Hari Krishna Dara wrote: [snip] imap buffer silent expr F12 Double(\F12) function! Double(mymap) try let char = getchar() catch /^Vim:Interrupt$/ let char = \Esc endtry exec BPBreakIf(char == 32, 1) if char == '^\d\+$' ||

Re: getchar() trick with recursive expr map

2006-10-20 Thread mzyzik
Great. Yeah it always bothered me that there's no way to monitor every keypress unless you map every key, which is quite ugly. --Matt On Thu, Oct 19, 2006 at 11:26:53PM -0700, Hari Krishna Dara wrote: I remember someone posting a patch to add a new event called GetChar to receive an event

RE: getchar() trick with recursive expr map

2006-10-20 Thread Steve Hall
From: Hari Krishna Dara, Fri, October 20, 2006 2:26 am Often there are questions on this list on how to capture every key press from a user, and the answer is that it can't, unless you map all keys. But even if you map all keys, it is not flexible enough. Here is a trick with recursive expr

Re: getchar() trick with recursive expr map

2006-10-20 Thread Mikolaj Machowski
Dnia piątek, 20 października 2006 08:26, Hari Krishna Dara napisał: Here is a demo that shows how to use it in insert mode. What the function does is to double every key you press, except Esc and C-C, when it breaks the loop. If world could be so beautiful... In Linux terminal and GTK2

Re: getchar() trick with recursive expr map

2006-10-20 Thread Hari Krishna Dara
On Fri, 20 Oct 2006 at 8:33am, Benji Fisher wrote: On Thu, Oct 19, 2006 at 11:26:53PM -0700, Hari Krishna Dara wrote: [snip] imap buffer silent expr F12 Double(\F12) function! Double(mymap) try let char = getchar() catch /^Vim:Interrupt$/ let char = \Esc endtry

Re: getchar() trick with recursive expr map

2006-10-20 Thread Hari Krishna Dara
On Fri, 20 Oct 2006 at 4:34pm, Mikolaj Machowski wrote: Dnia pi±tek, 20 pa¼dziernika 2006 08:26, Hari Krishna Dara napisa³: Here is a demo that shows how to use it in insert mode. What the function does is to double every key you press, except Esc and C-C, when it breaks the loop. If

RE: getchar() trick with recursive expr map

2006-10-20 Thread Hari Krishna Dara
On Fri, 20 Oct 2006 at 8:24am, Steve Hall wrote: From: Hari Krishna Dara, Fri, October 20, 2006 2:26 am Often there are questions on this list on how to capture every key press from a user, and the answer is that it can't, unless you map all keys. But even if you map all keys, it is not