Re: Time to remove naming restrictions?

2006-10-03 Thread Yakov Lerner

On 10/3/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Nikolai Weibull wrote:
 On 10/1/06, Bram Moolenaar [EMAIL PROTECTED] wrote:

 Nikolai Weibull wrote:

  One thing that really annoys me with Vim is the limits it emposes on
  what names are legal for user-defined functions and commands.  I know
  the reason for these restrictions, but I don't think they make much
  sense, especially so for user-defined commands.  I realize that
  overriding :quit does have its implications, but done carefully, this
  does allow for some interesting effects.
 
  So, why not lift the restrictions on valid names for user-defined
  functions and commands?
 
  That is, give me good reasons for why they should be maintained and
  I'll drop this request.

 Predictability.

 As in what?  That :quit always works as documented?  Sure, that's
 great, but if that's the problem, the restriction should be limited to
 commands already defined.  And what happens when more commands are
 added?  Hell, then they'll break the user-defined commands with the
 same name.  Big deal; that's life, you'll get over it - everyone does,
 eventually.

 I really don't see the big difference between user-defined commands
 clashing with built-in commands and user-defined commands clashing
 with each other.  It'll happen; unless you start adding prefixes or
 namespaces or some other way of separating your commands.  But then
 you lose out on simplicity.  You don't want to type :NOWCommand (given
 that NOW is my prefix), and I don't want to type :Command; I want
 to type :command.

 Sure, it only saves my fingers from giving up on me for so long, but
 every little bit helps.

 I guess my problem is that I want - and I've always wanted - the
 flexibility of Emacs coupled with the simplicity and efficiency of
 Vim's command set and modes.  I guess that's why I nitpick at things
 such as this.

  nikolai


:command -bar Command  ...
:cabbrev command Command

and then you'll wonder why you can't define a new user-command but it's your
funeral.


You can (via source); cabbrev don't affect sourced scritps.

Yakov


Re: Fwd: Do Not Reply To This Message:Re: Time to remove naming restrictions?

2006-10-03 Thread A.J.Mechelynck

Nikolai Weibull wrote:

I keep getting this f**king message every time I post to vim-dev.
Seriously, wtf?

 nikolai (awaiting another notification for this mail not getting through)

-- Forwarded message --
From: System Administrator [EMAIL PROTECTED]
Date: 2 Oct 2006 14:19:05 -0400
Subject: Do Not Reply To This Message:Re: Time to remove naming 
restrictions?

To: Nikolai Weibull [EMAIL PROTECTED]

[...]

Yeah, I get them too. It means someone at knbt discontinued his mail account 
(or got it cancelled) without going to the trouble of unsubscribing from Vim. 
Since the pseudo-bounce does not include the address in question, there's no 
way to know who it was. You can either blacklist [EMAIL PROTECTED] 
in your mail reader (e.g. by creating a new filter rule, 'if From: is 
[EMAIL PROTECTED] then Move to Trash'), or treat it in whatever 
manner you treat spam.


And since the bounce doesn't go thru the list (it goes direct to the poster), 
no one can filter the bounces away in our place.



Best regards,
Tony.


Re: Do Not Reply To This Message:Re: Time to remove naming restrictions?

2006-10-03 Thread A.J.Mechelynck

Nikolai Weibull wrote:
[...]

So anyway, I guess my request is for Felix von Leitner, or whoever
doesn't maintain this mailing list anymore (according to earlier
discussions on similar subjects), to remove the offending email
address from the mailing address.

Thanks.

 nikolai

P.S.
Sorry about the extra traffic about this.
D.S.



The problem is, not only the KNBT pseudo-bounce is misdirected, it is 
incomplete. In particular, it doesn't say which address was not found, so all 
Felix (or Bram or someone) can know is that someone @knbt.com is no longer a 
valid address. But they can't go forcibly unsubscribing _every_ @knbt.com 
subscriber, can they? Quite probably there are more than one.



Best regards,
Tony.


Re: Fwd: Do Not Reply To This Message:Re: Time to remove naming restrictions?

2006-10-03 Thread A.J.Mechelynck

Ali Akcaagac wrote:

On Tue, 2006-10-03 at 11:34 +0200, A.J.Mechelynck wrote:

You can either blacklist [EMAIL PROTECTED]
in your mail reader (e.g. by creating a new filter rule,
'if From: is [EMAIL PROTECTED] then Move
to Trash'), or treat it in whatever manner you treat spam.


Hello,

I'm getting these mails as well

I think this is definately no solution. Think about new people who like
joining this mailinglist in regard of contributing or giving feedback to
this list. You definately don't want them to blacklist half a dozen
unwanted emails before they can finally start posting something or
participating to this mailinglist.

mfg,

Ali Akcaagac





It's not half a dozen unwanted emails. It's just one email address, i.e., 
[EMAIL PROTECTED] -- these false bounces all come from the same 
source. If you feel up to it, write [EMAIL PROTECTED] telling them their 
mail routers are misconfigured (you can use my mail to Yakov in this thread as 
a kind of boilerplate). You can also point him to 
http://www.spamcop.net/fom-serve/cache/329.html . But don't expect quick and 
accurate action, that postmaster could quite possibly be an arrogant blockhead 
wo won't do anything you suggest to him for his own good.



Best regards,
Tony.


Re: compilation of regular expressions/ enhancement?

2006-10-03 Thread A.J.Mechelynck

Marc Weber wrote:

When doing something like
map([a,b],matchstr(v:val, \(.\)))
will the regular expression \(.\) be compiled on every iteration?

How about this:

for l in lines
	if l =~regex 
	...

?

I noticed this beeing slow compared to executing grep once ago.

If this is an issue, there might be the solution introducing a compiled
regular expression as used in python additional to Number, String,
Funcref, List, Dictionary

What do you think? Would this be an enhancement?

Marc Weber



\(.\) is equivalent to . in this case. \(\) is never necessary around the 
whole pattern; in a substitute, \(.\) can be useful as part of a larger 
pattern if you want to refer to it as \1 to \9 or via submatch().


About a compiled regular expression type, I don't think it would be useful 
since we already have :g and :vimgrep. IMO the bigger overhead in your example 
is in the for and if constructs.



Best regards,
Tony.


Patch 7.0.113

2006-10-03 Thread Bram Moolenaar

Patch 7.0.113
Problem:Using CTRL-L in Insert completion when there is no current match
may cause a crash. (Yukihiro Nakadaira)
Solution:   Check for compl_leader to be NULL
Files:  src/edit.c


*** ../vim-7.0.112/src/edit.c   Thu Sep 14 11:07:08 2006
--- src/edit.c  Tue Oct  3 14:57:47 2006
***
*** 3206,3212 
for (cp = compl_shown_match-cp_next; cp != NULL
  cp != compl_first_match; cp = cp-cp_next)
{
!   if (ins_compl_equal(cp, compl_leader,
   (int)STRLEN(compl_leader)))
{
p = cp-cp_str;
--- 3206,3213 
for (cp = compl_shown_match-cp_next; cp != NULL
  cp != compl_first_match; cp = cp-cp_next)
{
!   if (compl_leader == NULL
!   || ins_compl_equal(cp, compl_leader,
   (int)STRLEN(compl_leader)))
{
p = cp-cp_str;
*** ../vim-7.0.112/src/version.cTue Oct  3 15:02:11 2006
--- src/version.c   Tue Oct  3 15:20:13 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 113,
  /**/

-- 
I recommend ordering large cargo containers of paper towels to make up
whatever budget underruns you have.  Paper products are always useful and they
have the advantage of being completely flushable if you need to make room in
the storage area later.
(Scott Adams - The Dilbert principle)

 /// 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: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Charles E Campbell Jr

Bram Moolenaar wrote:


Suresh Govindachar wrote:
 


Is it possible to add an autocommand-event for Clipboard Changed?
   



Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.
 

Bram -- would you be willing to give out a bit of code that will send a 
remote message to vim?
Some function, perhaps SendCmd2Vim(string).  That way it'll be simple 
for folks to make their
own external programs to send a command to vim via the already available 
remote vim stuff.


Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
something for vim.sf.net?


Just an idea...
Chip Campbell



Patch 7.0.115

2006-10-03 Thread Bram Moolenaar

Patch 7.0.115
Problem:When 'ignorecase' is set, Insert mode completion only adds foo
and not Foo when both are found.
A found match isn't displayed right away when 'completeopt' does
not have menu or menuone.
Solution:   Do not ignore case when checking if a completion match already
exists.  call ins_compl_check_keys() also when not using a popup
menu. (Yukihiro Nakadaira)
Files:  src/edit.c


*** ../vim-7.0.114/src/edit.c   Tue Oct  3 15:22:00 2006
--- src/edit.c  Tue Oct  3 14:57:47 2006
***
*** 2157,2163 
do
{
if (!(match-cp_flags  ORIGINAL_TEXT)
!ins_compl_equal(match, str, len)
 match-cp_str[len] == NUL)
return NOTDONE;
match = match-cp_next;
--- 2157,2163 
do
{
if (!(match-cp_flags  ORIGINAL_TEXT)
!STRNCMP(match-cp_str, str, len) == 0
 match-cp_str[len] == NUL)
return NOTDONE;
match = match-cp_next;
***
*** 4042,4048 
if (got_int)
break;
/* Fill the popup menu as soon as possible. */
!   if (pum_wanted()  type != -1)
ins_compl_check_keys(0);
  
if ((ctrl_x_mode != 0  ctrl_x_mode != CTRL_X_WHOLE_LINE)
--- 4042,4048 
if (got_int)
break;
/* Fill the popup menu as soon as possible. */
!   if (type != -1)
ins_compl_check_keys(0);
  
if ((ctrl_x_mode != 0  ctrl_x_mode != CTRL_X_WHOLE_LINE)
*** ../vim-7.0.114/src/version.cTue Oct  3 15:36:09 2006
--- src/version.c   Tue Oct  3 15:46:15 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 115,
  /**/

-- 
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
(Scott Adams - The Dilbert principle)

 /// 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: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Bram Moolenaar wrote:


Suresh Govindachar wrote:
 


Is it possible to add an autocommand-event for Clipboard Changed?
  


Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.
 

Bram -- would you be willing to give out a bit of code that will send a 
remote message to vim?
Some function, perhaps SendCmd2Vim(string).  That way it'll be simple 
for folks to make their
own external programs to send a command to vim via the already available 
remote vim stuff.


Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
something for vim.sf.net?


Just an idea...
Chip Campbell




:call remote_send({server}, {string}[, {idvar}])

:let x = remote_expr({server}, {string}[, {idvar}])

etc.

For other programs: there are two protocols used: Windows and X11. You may 
want to dig into the Vim source to see how it does it. The server code (or the 
X11 server code?) is in src/if_xcmdsrv.c. The client code may be in eval.c or 
something -- look for Vim functions with names starting remote_ (or C 
functions with names starting f_remote_). In the source I have here 
(7.0.114) there is an #ifdef FEAT_CLIENTSERVER at eval_c line 13051.



Best regards,
Tony.


Patch 7.0.116

2006-10-03 Thread Bram Moolenaar

Patch 7.0.116
Problem:64 bit Windows version reports 32 bit in the :version output.
(M. Veerman)
Solution:   Change the text for Win64.
Files:  src/version.c


*** ../vim-7.0.115/src/version.cTue Oct  3 15:49:20 2006
--- src/version.c   Tue Oct  3 16:29:31 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 116,
  /**/
***
*** 962,966 
--- 964,972 
  MSG_PUTS(_(\nMS-Windows 16/32 bit GUI version));
  #  else
+ #   ifdef _WIN64
+ MSG_PUTS(_(\nMS-Windows 64 bit GUI version));
+ #   else
  MSG_PUTS(_(\nMS-Windows 32 bit GUI version));
+ #   endif
  #  endif
  if (gui_is_win32s())

-- 
Article in the first Free Software Magazine: Bram Moolenaar studied electrical
engineering at the Technical University of Delft and graduated in 1985 on a
multi-processor Unix architecture.
Response by dimator: Could the school not afford a proper stage for the
ceremony?

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Patch 7.0.117

2006-10-03 Thread Bram Moolenaar

Patch 7.0.117
Problem:Using extend on a syntax item inside a region with keepend, an
intermediate item may be truncated.
When applying the keepend and there is an offset to the end
pattern the highlighting of a contained item isn't adjusted.
Solution:   Use the seen_keepend flag to remember when to apply the keepend
flag.  Adjust the keepend highlighting properly. (Ilya Bobir)
Files:  src/syntax.c


*** ../vim-7.0.116/src/syntax.c Thu Apr 27 01:58:59 2006
--- src/syntax.cTue Oct  3 17:00:44 2006
***
*** 977,982 
--- 977,983 
  {
  stateitem_T   *cur_si;
  int   i;
+ int   seen_keepend;
  
  if (startofline)
  {
***
*** 1002,1008 
  /*
   * Need to update the end of a start/skip/end that continues from the
   * previous line.  And regions that have keepend, because they may
!  * influence contained items.
   * Then check for items ending in column 0.
   */
  i = current_state.ga_len - 1;
--- 1003,1012 
  /*
   * Need to update the end of a start/skip/end that continues from the
   * previous line.  And regions that have keepend, because they may
!  * influence contained items.  If we've just removed extend
!  * (startofline == 0) then we should update ends of normal regions
!  * contained inside keepend because extend could have extended
!  * these keepend regions as well as contained normal regions.
   * Then check for items ending in column 0.
   */
  i = current_state.ga_len - 1;
***
*** 1010,1019 
--- 1014,1026 
for ( ; i  keepend_level; --i)
if (CUR_STATE(i).si_flags  HL_EXTEND)
break;
+ 
+ seen_keepend = FALSE;
  for ( ; i  current_state.ga_len; ++i)
  {
cur_si = CUR_STATE(i);
if ((cur_si-si_flags  HL_KEEPEND)
+   || (seen_keepend  !startofline)
|| (i == current_state.ga_len - 1  startofline))
{
cur_si-si_h_startpos.col = 0;  /* start highl. in col 0 */
***
*** 1021,1026 
--- 1028,1036 
  
if (!(cur_si-si_flags  HL_MATCHCONT))
update_si_end(cur_si, (int)current_col, !startofline);
+ 
+   if (!startofline  (cur_si-si_flags  HL_KEEPEND))
+   seen_keepend = TRUE;
}
  }
  check_keepend();
***
*** 2564,2569 
--- 2574,2580 
  {
  int   i;
  lpos_Tmaxpos;
+ lpos_Tmaxpos_h;
  stateitem_T   *sip;
  
  /*
***
*** 2583,2605 
break;
  
  maxpos.lnum = 0;
  for ( ; i  current_state.ga_len; ++i)
  {
sip = CUR_STATE(i);
if (maxpos.lnum != 0)
{
limit_pos_zero(sip-si_m_endpos, maxpos);
!   limit_pos_zero(sip-si_h_endpos, maxpos);
limit_pos_zero(sip-si_eoe_pos, maxpos);
sip-si_ends = TRUE;
}
!   if (sip-si_ends
!(sip-si_flags  HL_KEEPEND)
!(maxpos.lnum == 0
|| maxpos.lnum  sip-si_m_endpos.lnum
|| (maxpos.lnum == sip-si_m_endpos.lnum
!maxpos.col  sip-si_m_endpos.col)))
!   maxpos = sip-si_m_endpos;
  }
  }
  
--- 2594,2623 
break;
  
  maxpos.lnum = 0;
+ maxpos_h.lnum = 0;
  for ( ; i  current_state.ga_len; ++i)
  {
sip = CUR_STATE(i);
if (maxpos.lnum != 0)
{
limit_pos_zero(sip-si_m_endpos, maxpos);
!   limit_pos_zero(sip-si_h_endpos, maxpos_h);
limit_pos_zero(sip-si_eoe_pos, maxpos);
sip-si_ends = TRUE;
}
!   if (sip-si_ends  (sip-si_flags  HL_KEEPEND))
!   {
!   if (maxpos.lnum == 0
|| maxpos.lnum  sip-si_m_endpos.lnum
|| (maxpos.lnum == sip-si_m_endpos.lnum
!maxpos.col  sip-si_m_endpos.col))
!   maxpos = sip-si_m_endpos;
!   if (maxpos_h.lnum == 0
!   || maxpos_h.lnum  sip-si_h_endpos.lnum
!   || (maxpos_h.lnum == sip-si_h_endpos.lnum
!maxpos_h.col  sip-si_h_endpos.col))
!   maxpos_h = sip-si_h_endpos;
!   }
  }
  }
  
*** ../vim-7.0.116/src/version.cTue Oct  3 16:30:40 2006
--- src/version.c   Tue Oct  3 16:59:50 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 117,
  /**/

-- 
For humans, honesty is a matter of degree.  Engineers are always honest in
matters of technology and human relationships.  That's why it's a good idea
to keep engineers away from customers, romantic interests, and other people
who can't handle the truth.
(Scott Adams - The Dilbert principle)

 /// Bram 

Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Bram Moolenaar

Charles Campbell wrote:

 Bram Moolenaar wrote:
 
 Suresh Govindachar wrote:
 
 Is it possible to add an autocommand-event for Clipboard Changed?
 
 Not really.  This is not something that happens inside Vim.  Polling for
 changes in the system is not really something I would like to add to Vim.

 Bram -- would you be willing to give out a bit of code that will send a 
 remote message to vim?
 Some function, perhaps SendCmd2Vim(string).  That way it'll be simple 
 for folks to make their own external programs to send a command to vim
 via the already available remote vim stuff.
 
 Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
 something for vim.sf.net?

I don't know what you mean with would you be willing.
src/if_xcmdsrv.c contains info for writing a C program.  os_mswin.c also
has some code that can be used for Win32.  It's not easy, of course.
I can't remember seeing a program that actually does this.

-- 
Engineers will go without food and hygiene for days to solve a problem.
(Other times just because they forgot.)
(Scott Adams - The Dilbert principle)

 /// 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: [macvim] modifiers should be applied to special keys too (patch)

2006-10-03 Thread Bram Moolenaar

Nicolas Weber wrote:

  Hmmm… I’m having a problem. Ctrl-A, ctrl-e, ctrl-k, ctrl-u, etc.  
  don’t seem to work anymore. I have these lines in my vimrc:
 
 The attached patch should fix this problem as well (again the diff is  
 against vim svn).
 
 The problem was that chars like ^A (ctrl-a) were sent with  
 MOD_MASK_CTRL set. I worked around this by adding the lines
  /* remove CTRL from keys that already have it */
  if (key_char  0x20)
  vimModifiers = ~MOD_MASK_CTRL;
 
 I don't know if this the right solution, but it works. At least on my  
 system. :-P

I tried the patch, but it appears that CTRL-F and CTRL-B no longer work
in Normal mode.  They do something in Insert mode after CTRL-V.

It looks like this patch needs more careful testing.  Perhaps you should
make a list of keys with various modifiers that need to be tried to
verify the code works correctly.

-- 
Engineers are always delighted to share wisdom, even in areas in which they
have no experience whatsoever.  Their logic provides them with inherent
insight into any field of expertise.  This can be a problem when dealing with
the illogical people who believe that knowledge can only be derived through
experience.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Patch 7.0.118

2006-10-03 Thread Bram Moolenaar

Patch 7.0.118
Problem:printf() does not do zero padding for strings.
Solution:   Do allow zero padding for strings.
Files:  src/message.c


*** ../vim-7.0.117/src/message.cSun Sep  3 16:39:51 2006
--- src/message.c   Tue Oct  3 15:41:44 2006
***
*** 4124,4131 
case 'c':
case 's':
length_modifier = '\0';
-   zero_padding = 0;/* turn zero padding off for string
-   conversions */
str_arg_l = 1;
switch (fmt_spec)
{
--- 4124,4129 
*** ../vim-7.0.117/src/version.cTue Oct  3 17:04:21 2006
--- src/version.c   Tue Oct  3 17:20:11 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 118,
  /**/

-- 
While it's true that many normal people whould prefer not to _date_ an
engineer, most normal people harbor an intense desire to _mate_ with them,
thus producing engineerlike children who will have high-paying jobs long
before losing their virginity.
(Scott Adams - The Dilbert principle)

 /// 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: compilation of regular expressions/ enhancement?

2006-10-03 Thread Marc Weber
Hi Tony.
Of course this was a trivial example.
I was grepping the output of jar - content-texfile to find the packages
of a java-class.
Currently I'm using this function.
I'm invoking this function for up to 40 files or more.. That depends on
how many modules I have imported.
  let type_pattern = 
'\zs\('.func_name.'\)\%(\s*,\s*\%('.func_name.'\)\)*\ze\s*::'
if line =~ type_pattern
This is no longer that simple.
But I can do a deepcopy and use filter.. But then I'll no longer able to get
the line numbers.. 
My question was meant to be more general as my example given in the last
post.

Greetings Marc

function! vl#dev#haskell#modules_list_cache_jump#ScanModuleForFunctions(file)
   a function is recognized as function if the looks like 
   a b c = ...
   and a is no keyword (data, new\=type, instance)
  let func_name = '\w\+'
  let no_f_pattern = '\%(\%(\%(new\)\=type\)\|data\)'
   pattern1 / 2 matches
   1) function_name arg1 arg2 =
   2) arg1 `function_name` arg2 =
  let f_pattern1 = '\zs'.func_name.'\ze\%(\s\+\w\+\)*\s*='
  let f_pattern2 = '\w\+\s*`\zs\w\+\ze`\s*\w\+\s*='
  let f_pattern = '^\s*\%(\%('.f_pattern1.'\)\|\%('.f_pattern2.'\)\)'

  let result = {}
  for line_nr in range(0,len(a:file)-1)
let line = a:file[line_nr]
if line =~ no_f_pattern
  continue
endif
if line =~ f_pattern
  let result[matchstr(line, f_pattern1)]={impl: line_nr}
endif
  endfor
  
   add type declarations.. doesn't recognize lists (a, b :: ) yet.
   Is needed to get the function names eg of
   newtype Cont r a = Cont { runCont :: (a - r) - r }
  let type_pattern = 
'\zs\('.func_name.'\)\%(\s*,\s*\%('.func_name.'\)\)*\ze\s*::'
  let g:tp = type_pattern
  for line_nr in range(0,len(a:file)-1)
let line = a:file[line_nr]
if line =~ type_pattern
  let list = split(matchstr(line, type_pattern),'\s*,\s*')
  for func_name in list
if exists(result['.func_name.'])
  let result[func_name]['type'] = line_nr
else
  let result[func_name]={type: line_nr}
endif
  endfor
endif
  endfor
  return result
endfunction


Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Yakov Lerner

On 10/3/06, Charles E Campbell Jr [EMAIL PROTECTED] wrote:

Bram Moolenaar wrote:

Suresh Govindachar wrote:


Is it possible to add an autocommand-event for Clipboard Changed?



Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.


Bram -- would you be willing to give out a bit of code that will send a
remote message to vim?
Some function, perhaps SendCmd2Vim(string).  That way it'll be simple
for folks to make their
own external programs to send a command to vim via the already available
remote vim stuff.


Charles,
What's wrong with doing system(vim --remote-xxx yyy zzz) in
any programming language ?

Yakov


Re: compilation of regular expressions/ enhancement?

2006-10-03 Thread A.J.Mechelynck

Marc Weber wrote:

Hi Tony.
Of course this was a trivial example.
I was grepping the output of jar - content-texfile to find the packages
of a java-class.
Currently I'm using this function.
I'm invoking this function for up to 40 files or more.. That depends on
how many modules I have imported.
  let type_pattern = 
'\zs\('.func_name.'\)\%(\s*,\s*\%('.func_name.'\)\)*\ze\s*::'
if line =~ type_pattern
This is no longer that simple.
But I can do a deepcopy and use filter.. But then I'll no longer able to get
the line numbers.. 
My question was meant to be more general as my example given in the last

post.

Greetings Marc


When you don't need backrefs, use \%( rather than \( -- it may be marginally 
faster.


I still don't see the advantage of compiling regexps while scripts remain 
interpreted.



Best regards,
Tony.


Re: compilation of regular expressions/ enhancement?

2006-10-03 Thread Nikolai Weibull

On 10/3/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:


I still don't see the advantage of compiling regexps while scripts remain
interpreted.


Well, storing the compiled regex is surely a lot faster.  However, I
don't think that's the way to do it for VimScript, as it isn't really
parsed, it's just executed line-by-line.  What /would/ make sense is
to cache the compiled regexes so that regexes used in a loop won't
have to be compiled as often.  That's a fairly trivial fix, although
I'm not going to perform it.

 nikolai


Re: Do Not Reply To This Message

2006-10-03 Thread Ilya Sher
A.J.Mechelynck wrote:

[snip]

 The problem is, not only the KNBT pseudo-bounce is misdirected, it is
 incomplete. In particular, it doesn't say which address was not found,
 so all Felix (or Bram or someone) can know is that someone @knbt.com
 is no longer a valid address. But they can't go forcibly unsubscribing
 _every_ @knbt.com subscriber, can they? Quite probably there are more
 than one.
Anyone knows how much of [EMAIL PROTECTED] are subscribed ?
If they are not many we can even do manual check(s)...


 Best regards,
 Tony.


-- 
For robots (please don't mail me there): [EMAIL PROTECTED]
My real email is ilya @ same domain



Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Yegappan Lakshmanan

Hi Charles,

On 10/3/06, Charles E Campbell Jr [EMAIL PROTECTED] wrote:

Bram Moolenaar wrote:

Suresh Govindachar wrote:


Is it possible to add an autocommand-event for Clipboard Changed?



Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.


Bram -- would you be willing to give out a bit of code that will send a
remote message to vim?
Some function, perhaps SendCmd2Vim(string).  That way it'll be simple
for folks to make their
own external programs to send a command to vim via the already available
remote vim stuff.

Presumably the code snippet wouldn't be a Part of Vim itself; maybe
something for vim.sf.net?

Just an idea...
Chip Campbell



Are you referring to a sample code similar to the xcmdsrv_client.c file under
the $VIM/tools directory? This sample code shows how to send commands
to a remote Vim from a C program in Unix systems running X-Windows.
A similar sample code for MS-Windows is needed.

- Yegappan


Re: [macvim] modifiers should be applied to special keys too (patch)

2006-10-03 Thread Nicolas Weber

Hi,

I tried the patch, but it appears that CTRL-F and CTRL-B no longer  
work

in Normal mode.  They do something in Insert mode after CTRL-V.


CTRL-F and CTRL-B work for me in Normal mode (they scroll forward/ 
backward). I'm using mac gvim svn (patches 1-110) and the second  
version of my patch.


Can you give more detailed instructions on how to reproduce the problem?

It looks like this patch needs more careful testing.  Perhaps you  
should

make a list of keys with various modifiers that need to be tried to
verify the code works correctly.


I made a small list ( http://macvim.blogspot.com/2006/10/keyboard- 
handling-patch.html ), I'll add further items as problems arise.


Bye,
Nico




Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Charles E Campbell Jr

Yegappan Lakshmanan wrote:

Are you referring to a sample code similar to the xcmdsrv_client.c 
file under

the $VIM/tools directory? This sample code shows how to send commands
to a remote Vim from a C program in Unix systems running X-Windows.
A similar sample code for MS-Windows is needed.


Looks like Bram is a precognitive!  Yep, that's what I meant.

Regards,
Chip Campbell



Re: compilation of regular expressions/ enhancement?

2006-10-03 Thread Ilya Bobir

Marc Weber wrote:

When doing something like
map([a,b],matchstr(v:val, \(.\)))
will the regular expression \(.\) be compiled on every iteration?

How about this:

for l in lines
	if l =~regex 
	...

?
  

How about :help profile ? ;)

[...]




Re: Time to remove naming restrictions?

2006-10-03 Thread Hari Krishna Dara

On Tue, 3 Oct 2006 at 10:30am, A.J.Mechelynck wrote:

 Nikolai Weibull wrote:
  On 10/1/06, Bram Moolenaar [EMAIL PROTECTED] wrote:
 
  Nikolai Weibull wrote:
 
   One thing that really annoys me with Vim is the limits it emposes on
   what names are legal for user-defined functions and commands.  I know
   the reason for these restrictions, but I don't think they make much
   sense, especially so for user-defined commands.  I realize that
   overriding :quit does have its implications, but done carefully, this
   does allow for some interesting effects.
  
   So, why not lift the restrictions on valid names for user-defined
   functions and commands?
  
   That is, give me good reasons for why they should be maintained and
   I'll drop this request.
 
  Predictability.
 
  As in what?  That :quit always works as documented?  Sure, that's
  great, but if that's the problem, the restriction should be limited to
  commands already defined.  And what happens when more commands are
  added?  Hell, then they'll break the user-defined commands with the
  same name.  Big deal; that's life, you'll get over it - everyone does,
  eventually.
 
  I really don't see the big difference between user-defined commands
  clashing with built-in commands and user-defined commands clashing
  with each other.  It'll happen; unless you start adding prefixes or
  namespaces or some other way of separating your commands.  But then
  you lose out on simplicity.  You don't want to type :NOWCommand (given
  that NOW is my prefix), and I don't want to type :Command; I want
  to type :command.
 
  Sure, it only saves my fingers from giving up on me for so long, but
  every little bit helps.
 
  I guess my problem is that I want - and I've always wanted - the
  flexibility of Emacs coupled with the simplicity and efficiency of
  Vim's command set and modes.  I guess that's why I nitpick at things
  such as this.
 
   nikolai
 

   :command -bar Command  ...
   :cabbrev command Command

 and then you'll wonder why you can't define a new user-command but it's your
 funeral.

 It's still not perfect though; the cabbrev will be expanded even if it's not
 at the start (but that may be not-so-bad if you use :verbose command,
 :vertical command, etc.)


 Best regards,
 Tony.

You can use the Vim7 expr abbreviation in combination of getcmdpos()
and getcmdtype() to make this a lot more reliable, and avoid expanding
everywhere. I have created the cmdalias.vim plugin
(http://www.vim.org/script.php?script_id=745) just to address this
problem (as it bothered me as well). The only case this breaks is the
debug mode because of a bug in Vim (the expression itself is executed in
the debug mode).

Another oddity in using this approach is the history. If you execute:

:command

what will end up getting stored in the history is:

:Command

which means you have to remember to use the righ case while retrieving
the last command (:comUp will not work).

-- 
HTH,
Hari

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


Re: Time to remove naming restrictions?

2006-10-03 Thread Nikolai Weibull

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


Nikolai Weibull wrote:



 One thing that really annoys me with Vim is the limits it emposes on
 what names are legal for user-defined functions and commands.



Another oddity in using this approach is the history. If you execute:

:command

what will end up getting stored in the history is:

:Command

which means you have to remember to use the righ case while retrieving
the last command (:comUp will not work).


Argh.  This is exactly why all the hacks one has to employ never
really quite make it.  There's always some base you haven't covered,
some point you can't reach.

Seriously, if people want to f**k up their session, let them.  No one
who isn't prepared to get burned is going to override :quit.  No one
who isn't prepared for an unpredictable future (is there a second
kind?) is going to install a plugin that adds a command called :vfold.
Let us who really want our Vim to be what we want it to be have the
tools to make it so.  I'm obviously not the only person who feels this
way.  And I haven't even spent time writing a plugin to circumvent
this, like Hari has.

 nikolai


Chaining of function calls

2006-10-03 Thread Nikolai Weibull

So you can't write

 :call object.method().results_method()

in VimScript.  But it would be sweet if one could.  Can't find
anything in the TODO on this.  Any plans for the future?

 nikolai


Re: Chaining of function calls

2006-10-03 Thread Nikolai Weibull

On 10/3/06, Nikolai Weibull [EMAIL PROTECTED] wrote:

So you can't write

  :call object.method().results_method()

in VimScript.  But it would be sweet if one could.  Can't find
anything in the TODO on this.  Any plans for the future?


But you can write

 :let _ = object.method().results_method()

Sort of an ugly hack, though, if you don't care about
results_method()s result (or it doesn't have one).

 nikolai


Re: Chaining of function calls

2006-10-03 Thread Nikolai Weibull

On 10/3/06, Nikolai Weibull [EMAIL PROTECTED] wrote:

On 10/3/06, Nikolai Weibull [EMAIL PROTECTED] wrote:
 So you can't write

   :call object.method().results_method()

 in VimScript.  But it would be sweet if one could.  Can't find
 anything in the TODO on this.  Any plans for the future?

But you can write

  :let _ = object.method().results_method()


And of course

 :call call(object.method().results_method)

but that's plain horrendous under the circumstances.

Sorry about the IRC-session-style messages.  I'll stop now.

 nikolai


Re: Time to remove naming restrictions?

2006-10-03 Thread Peter Hodge
 Argh.  This is exactly why all the hacks one has to employ never
 really quite make it.  There's always some base you haven't covered,
 some point you can't reach.
 
 Seriously, if people want to f**k up their session, let them.  No one
 who isn't prepared to get burned is going to override :quit.  No one
 who isn't prepared for an unpredictable future (is there a second
 kind?) is going to install a plugin that adds a command called :vfold.
  Let us who really want our Vim to be what we want it to be have the
 tools to make it so.  I'm obviously not the only person who feels this
 way.  And I haven't even spent time writing a plugin to circumvent
 this, like Hari has.

There's about 4 lines of vim source code which you need to remove so that you
can have lower-case user commands.  You're not interested in making your own
patch?

regards,
Peter







 
On Yahoo!7 
Messenger - IM with Windows Live™ Messenger friends. 
http://au.messenger.yahoo.com 



Re: Forms highlighting

2006-10-03 Thread Hari Krishna Dara

I have updated it again. The main difference is some syntax highlighting
rules and some tweaks. I also changed the hotkey to link to Underlined,
which has both a color as well as underscore by default (and I doubt any
colorscheme change this). I also added a few extra rules/conditions to
highlight the right hotkey as well as the boundaries of fields and
button labels.

-- 
Thanks,
Hari

On Mon, 2 Oct 2006 at 5:33pm, Hari Krishna Dara wrote:

 My comments below. If anyone is still interested to try, here is how you
 do it:

 - Download the below file and put it in your autoload directory:
 http://haridara.googlepages.com/forms.vim
 - Start a fresh Vim session and execute:
 :call forms#demo()
 - Optionally, remove the downloaded file after you are done trying.

 It is very easy and safe to try it (I hope I haven't scared away folks
 with the warning in my previous email :)

 On Tue, 3 Oct 2006 at 1:31am, Mikolaj Machowski wrote:

  Hello,
 
  Below patch to yesterday version of forms.vim .
 
  Rather proof of concept than full solution but looks much nicer:
 
  Features:
 
  - highlight header of form in Comment
  - highlight labels of fields as Questions
  - hightlight hotkeys as Statements

 I applied your patch and it looks very nice, thanks for taking the time.
 One minor problem is that if the hotkey repeats multiple times in the
 label, it is highlighted multiple times.

 
  Limitations:
 
  - Buttons are not supported

 We can also highlight checkboxes and comboboxes differently.

  Problems with current version of forms:
 
  - arrows doesn't work in terminal. They are completely messing things
eg. destroy knowledge about default value.

 Do arrows work like j and k outside form? Since I am mapping Up and
 Down keys, as long as they work outside form, I am assuming they
 shoudl work inside form also.

  - when there is more than one the same character as hotkey repeating
hotkey doesn't cycle between them. It stucks with last entry with that
hotkey

 I noted this down as a limitation for now. We can look at it later. I am
 creating a map of hotkey-field which will obviously not work if the
 same hotkey is used multiple times.

 On Mon, 2 Oct 2006 at 10:28am, Mikolaj Machowski wrote:

  Maybe not all. You should catch only switching between major modes
  and vertical movement. The rest isn't so important.

 When you Tab into the fields, the values are first selected so that the
 user can easily overwrite it (like most GUIs do). However, the user can
 press Esc once to get into the normal insert mode and change the
 values (there is currently a known issue with this that you can't change
 the value, unless 'backspace' has start). If you want, you can press
 Esc again to get into the normal mode to move around, but this will
 put the buffer in a 'readonly' state, so when you find the field that
 you want to edit, you can press Space on the field to get back into
 edit mode. Let me know if you have ideas on how this can be improved.

  After some consideration C-K wasn't best suggestion. I think in such
  forms is bigger probability of digraphs than somewhere else. Other
  possibilities; C-F (may break behave mswin and/or Cream - obvious
  client of such script); C-D/T no mnemonic value but are covering
  indenting mappings.

 How about using C-G? i_CTRL_G is used to move around the buffer, which
 we prevent anyway, and it could be a good mnemonic too.

  Maybe you are right. I am biased here - I hate buffer management and if
  someone else can take care about that... ;)

 I agree, buffer management is messy, which is why putting the task on
 the user makes it a little easier for the first version to get out :)

 I have now uploaded a version with your changes.

 http://haridara.googlepages.com/forms.vim

 This version also contains an API to create forms. The forms#demo()
 function shows you how to use the API. You can invoke it as:

 :call forms#demo()

 I will enhance the demo with some buffer management as a suggested
 pattern for the users.

 Are you interested to use the forms for any of your plugins or are you
 just helping me out? :) (in either case, many thanks).

 I wish more people will come forward to try and give feedback,
 especially that it is so easy to try it.

 --
 Thanks,
 Hari


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


Re: Mapping of keysequences...

2006-10-03 Thread A.J.Mechelynck

Brian McKee wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 2-Oct-06, at 3:51 PM, Andy Wokula wrote:


Meino Christian Cramer schrieb:

Thanks for all, Tony!!! :O)

I think Bram should add

  :he Tony


Add it yourself

:e ~/.vim/doc/tony.txt
:i
*tony.txt*Tony's mail address

*Tony* A.J.Mechelynck antoine(dot)mechelynck(at)skynet(dot)be

 vim:tw=78:ts=8:ft=help:norl:
.
:w
:helptags ~/.vim/doc
:he Tony





Ya know - not only is that funny - it's useful !
It made me realize I can make my own crib sheet for the stuff I can't 
remember and embed it right in Vim!

Cool

e.g. :','!sort -t ^I -k 9
I use that once a month or so, but never remember it... now it's :he sort9


Thanks!
Brian


The principle of creating cribsheet helpfiles in ~/.vim/doc is certainly 
useful (though not for my email addy which I don't read as often as vim, 
vim-dev or vim-multibyte @vim.org).


The above is for external sort. Do you know Vim 7 has an internal sort (see 
:help :sort)?



Best regards,
Tony.


reg expression in vim

2006-10-03 Thread [EMAIL PROTECTED]

Can you help me please?
I have a long text and I need to find all words beginning with hell and
copy these words at the end of the file.
I found a helpful command :g/hell/t$
But this command copies the whole line. I want only the relevant word (and
each word on a new line).
Does anybody know how to solve this?
thanks!!!


-- 
View this message in context: 
http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6615808
Sent from the Vim - General mailing list archive at Nabble.com.



Re: imd don't take effect under linux

2006-10-03 Thread A.J.Mechelynck

Dasn wrote:
[...

The exists() is formal way to achieve this, especially when we
writing scripts. But sometimes dirty trick comes handy. e.g.:

:echo exists(+ruler)  - 1 , has 'ruler'
:echo exists(+noruler)  - 0, doesn't has 'ruler'?


IIUC, this one will always be zero. If you want an if that comes true if 
'ruler' is not working, use :if !exists('+ru')



:set ruler?  check the 'ruler' option
:set noru?  also check the 'ruler' option. 



Your choice. I don't like triggering an error if I don't have to. The 
advantage of this method, OTOH, is that if the option is working you get its 
value. And if you want to see where (if anywhere) it was set, use :verbose 
set ruler? or :verb set ru?. But don't forget the question mark.



Best regards,
Tony.


Re: reg expression in vim

2006-10-03 Thread Yakov Lerner

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Can you help me please?
I have a long text and I need to find all words beginning with hell and
copy these words at the end of the file.
I found a helpful command :g/hell/t$
But this command copies the whole line. I want only the relevant word (and
each word on a new line).


Does the following do what you want, when you press F5:

function! CopyHellWords()
  exe norm Gmao\escgg
  let kount=0
  while line('.') = line('a)
 if expand('cword') =~ ^hell
 call append(line('$'), expand('cword'))
 let kount = kount + 1
 endif
 call search('\')
  endw
  echo kount . words copied
endfun

nmap F5 :call CopyHellWords()cr

Yakov


Re: Nul ?

2006-10-03 Thread A.J.Mechelynck

Meino Christian Cramer wrote:

From: Yakov Lerner [EMAIL PROTECTED]
Subject: Re: Nul ?
Date: Mon, 2 Oct 2006 22:12:46 +0300


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

 what does it mean or what is the meaining of:

 When i_Ctrl-k key returns Nul   ???

It means you pressed Ctrl-@

Yakov



Interesting...but I pressed Ctrl-Space... :)
Mismapped key? Do I have to fix it via Xmodmap?

Keep hacking!
mc



Ctrl-Space is not a portably mappable key. Portably mappable keys are those 
which are reliably detected on all platforms. Ctrl + printable keys are 
defined as follows (on ASCII systems; I don't know about EBCDIC):


Ctrl-@  0x00
Ctrl-a  0x01
...other alphabet keys in ascending sequence...
Ctrl-z  0x1A
Ctrl-[  0x1B
Ctrl-\  0x1C
Ctrl-]  0x1D
Ctrl-^  0x1E
Ctrl-_  0x1F
Ctrl-?  0x7F

In Vim, Ctrl-J also returns a null byte because of the way line breaks are 
handled.


On national keyboards, Ctrl + nonalphabetic printable keys may be hard to 
find on your keyboard (e.g., Ctrl-_ may be on the key which gives _ on a US 
QWERTY keyboard, which can be different from the key which gives _ on your own 
keyboard). If you don't find them, you can always remap them, e.g. :map F10 
C-_.


Ctrl + non-printable keys (like Ctrl-Up or Ctrl-F1) is mappable too unless 
your OS snatches them before they get to Vim (my window manager snatches 
Ctrl-F1 to Ctrl-F12 so I never see them in gvim or in vim-in-konsole); but 
Ctrl + other printable keys is not defined; Vim may see it or not, or see it 
as the same as something else, depending on your system and on its keyboard 
driver. On my system gvim sees Ctrl-space as just a plain space.



Best regards,
Tony.


Re: reg expression in vim

2006-10-03 Thread [EMAIL PROTECTED]

thank you - yes, it works absolutely correctly.
One more question: searching for hell for just an example. In fact, I need
to search for V$
(i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on).
What would be correct syntax? I have problem with the $ sign, of course.
thank you for your help  time.

Yakov Lerner-3 wrote:
 
 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Can you help me please?
 I have a long text and I need to find all words beginning with hell and
 copy these words at the end of the file.
 I found a helpful command :g/hell/t$
 But this command copies the whole line. I want only the relevant word
 (and
 each word on a new line).
 
 Does the following do what you want, when you press F5:
 
 function! CopyHellWords()
exe norm Gmao\escgg
let kount=0
while line('.') = line('a)
   if expand('cword') =~ ^hell
   call append(line('$'), expand('cword'))
   let kount = kount + 1
   endif
   call search('\')
endw
echo kount . words copied
 endfun
 
 nmap F5 :call CopyHellWords()cr
 
 Yakov
 
 

-- 
View this message in context: 
http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6616847
Sent from the Vim - General mailing list archive at Nabble.com.



Re: reg expression in vim

2006-10-03 Thread Yakov Lerner

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner-3 wrote:

 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Can you help me please?
 I have a long text and I need to find all words beginning with hell and
 copy these words at the end of the file.
 I found a helpful command :g/hell/t$
 But this command copies the whole line. I want only the relevant word
 (and
 each word on a new line).

 Does the following do what you want, when you press F5:

 function! CopyHellWords()
exe norm Gmao\escgg
let kount=0
while line('.') = line('a)
   if expand('cword') =~ ^hell
   call append(line('$'), expand('cword'))
   let kount = kount + 1
   endif
   call search('\')
endw
echo kount . words copied
 endfun

 nmap F5 :call CopyHellWords()cr

thank you - yes, it works absolutely correctly.
One more question: searching for hell for just an example. In fact, I need
to search for V$
(i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on).
What would be correct syntax? I have problem with the $ sign, of course.
thank you for your help  time.



If you mean V$ at beginning of the word, then
if expand('cword') =~ '^V\$'
If you mean V$ anywhere in the word, then
if expand('cword') =~ 'V\$'
and then

Yakov


Re: reg expression in vim

2006-10-03 Thread [EMAIL PROTECTED]

thanks, I already tried this and it does not work. It freezes the whole
editor.
(I am using gVim on Win XP, but it should not matter, I believe.)


Yakov Lerner-3 wrote:
 
 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Yakov Lerner-3 wrote:
 
  On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  Can you help me please?
  I have a long text and I need to find all words beginning with hell
 and
  copy these words at the end of the file.
  I found a helpful command :g/hell/t$
  But this command copies the whole line. I want only the relevant word
  (and
  each word on a new line).
 
  Does the following do what you want, when you press F5:
 
  function! CopyHellWords()
 exe norm Gmao\escgg
 let kount=0
 while line('.') = line('a)
if expand('cword') =~ ^hell
call append(line('$'), expand('cword'))
let kount = kount + 1
endif
call search('\')
 endw
 echo kount . words copied
  endfun
 
  nmap F5 :call CopyHellWords()cr

 thank you - yes, it works absolutely correctly.
 One more question: searching for hell for just an example. In fact, I
 need
 to search for V$
 (i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on).
 What would be correct syntax? I have problem with the $ sign, of
 course.
 thank you for your help  time.

 
 If you mean V$ at beginning of the word, then
  if expand('cword') =~ '^V\$'
 If you mean V$ anywhere in the word, then
  if expand('cword') =~ 'V\$'
 and then
 
 Yakov
 
 

-- 
View this message in context: 
http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6617059
Sent from the Vim - General mailing list archive at Nabble.com.



Re: reg expression in vim

2006-10-03 Thread Yakov Lerner

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


thanks, I already tried this and it does not work. It freezes the whole
editor.
(I am using gVim on Win XP, but it should not matter, I believe.)


Yes, you need to add $ char to your isk setting. (iskeyword).
Try  :set isk+=36


Yakov Lerner-3 wrote:

 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Yakov Lerner-3 wrote:
 
  On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  Can you help me please?
  I have a long text and I need to find all words beginning with hell
 and
  copy these words at the end of the file.
  I found a helpful command :g/hell/t$
  But this command copies the whole line. I want only the relevant word
  (and
  each word on a new line).
 
  Does the following do what you want, when you press F5:
 
  function! CopyHellWords()
 exe norm Gmao\escgg
 let kount=0
 while line('.') = line('a)
if expand('cword') =~ ^hell
call append(line('$'), expand('cword'))
let kount = kount + 1
endif
call search('\')
 endw
 echo kount . words copied
  endfun
 
  nmap F5 :call CopyHellWords()cr

 thank you - yes, it works absolutely correctly.
 One more question: searching for hell for just an example. In fact, I
 need
 to search for V$
 (i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on).
 What would be correct syntax? I have problem with the $ sign, of
 course.
 thank you for your help  time.


 If you mean V$ at beginning of the word, then
  if expand('cword') =~ '^V\$'
 If you mean V$ anywhere in the word, then
  if expand('cword') =~ 'V\$'
 and then

 Yakov



--
View this message in context: 
http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6617059
Sent from the Vim - General mailing list archive at Nabble.com.




Re: reg expression in vim

2006-10-03 Thread [EMAIL PROTECTED]

Great, it works.
Thank you so much. It will save me plenty of time!
bye


Yakov Lerner-3 wrote:
 
 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 thanks, I already tried this and it does not work. It freezes the whole
 editor.
 (I am using gVim on Win XP, but it should not matter, I believe.)
 
 Yes, you need to add $ char to your isk setting. (iskeyword).
 Try  :set isk+=36
 
 Yakov Lerner-3 wrote:
 
  On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Yakov Lerner-3 wrote:
  
   On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
   Can you help me please?
   I have a long text and I need to find all words beginning with
 hell
  and
   copy these words at the end of the file.
   I found a helpful command :g/hell/t$
   But this command copies the whole line. I want only the relevant
 word
   (and
   each word on a new line).
  
   Does the following do what you want, when you press F5:
  
   function! CopyHellWords()
  exe norm Gmao\escgg
  let kount=0
  while line('.') = line('a)
 if expand('cword') =~ ^hell
 call append(line('$'), expand('cword'))
 let kount = kount + 1
 endif
 call search('\')
  endw
  echo kount . words copied
   endfun
  
   nmap F5 :call CopyHellWords()cr
 
  thank you - yes, it works absolutely correctly.
  One more question: searching for hell for just an example. In fact,
 I
  need
  to search for V$
  (i.e. looking for V$SESSION_EVENT, V$SYSTEM_EVENT and so on).
  What would be correct syntax? I have problem with the $ sign, of
  course.
  thank you for your help  time.
 
 
  If you mean V$ at beginning of the word, then
   if expand('cword') =~ '^V\$'
  If you mean V$ anywhere in the word, then
   if expand('cword') =~ 'V\$'
  and then
 
  Yakov
 
 

 --
 View this message in context:
 http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6617059
 Sent from the Vim - General mailing list archive at Nabble.com.


 
 

-- 
View this message in context: 
http://www.nabble.com/reg-expression-in-vim-tf2374614.html#a6617231
Sent from the Vim - General mailing list archive at Nabble.com.



Re: Forms highlighting

2006-10-03 Thread Mikolaj Machowski
Dnia wtorek, 3 października 2006 02:35, Hari Krishna Dara napisał:
 - Start a fresh Vim session and execute:
 :call forms#demo()

Looks very good (I am using last version).

  Problems with current version of forms:
 
  - arrows doesn't work in terminal. They are completely messing things
eg. destroy knowledge about default value.

 Do arrows work like j and k outside form? Since I am mapping Up and
 Down keys, as long as they work outside form, I am assuming they
 shoudl work inside form also.

No. They are inserting some version of keycode: OA, OB, OC, OD. In gui
everything works well. In menus enabled

Bug: When completely remove value, leave field and later return
to it default value is forgotten, Esc is going to Normal mode.

Bug: Form is creating swap file which makes hard to use simultaneously
the same form in various Vims when editing files in the same directory.
Solution: Add 'setl noswapfile' after 'setl nomodified' in SetupBuf
function (this is local option and but it is easier to read when
explicitly declaring as local).

Wish: different highlighting of  in drop-down menu (State) and
combobox (Country). Maybe use {} somewhere?
I looked in the code: you are making just difference between editable
and non-editable combobox. IMO would be better to split this in two
widgets: combobox and dropdown menu. With that you will be able to make
visual differences between those two items (highlighting, braces).

  After some consideration C-K wasn't best suggestion. I think in such
  forms is bigger probability of digraphs than somewhere else. Other
  possibilities; C-F (may break behave mswin and/or Cream - obvious
  client of such script); C-D/T no mnemonic value but are covering
  indenting mappings.

 How about using C-G? i_CTRL_G is used to move around the buffer, which
 we prevent anyway, and it could be a good mnemonic too.

OK for me.

  Maybe you are right. I am biased here - I hate buffer management and
  if someone else can take care about that... ;)

 I agree, buffer management is messy, which is why putting the task on
 the user makes it a little easier for the first version to get out :)

 I have now uploaded a version with your changes.

 http://haridara.googlepages.com/forms.vim

 This version also contains an API to create forms. The forms#demo()

 function shows you how to use the API. You can invoke it as:
 :call forms#demo()

 I will enhance the demo with some buffer management as a suggested
 pattern for the users.

Good thing would be possibility to scale height of buffer to height of
form and width [1]. Usually when filling you want to check context. Also
in space preserving department: header is 3 lines high. First - empty
line should go to /dev/null; second - value of separator is doubtful
when highlighting works.

[1] User may want to split window vertically. Maybe full buffer
management isn't required but some elements for making it easier to user
would be good: eg. length and width of form.

This is complete addition to beginning SetupBuf::

  setl noswapfile
  let formheight = len(b:curForm.fields) + 3
  exe normal! .formheight.\C-W_
  let formwidth = b:curForm.maxLblSize * 2
  exe normal! .formwidth.\C-W|

Unfortunately it goes wild when form will be opened in vertical
window...

 Are you interested to use the forms for any of your plugins or are you
 just helping me out? :) (in either case, many thanks).

I have idea where I would like to use it but at the moment it is rather
vague (tag form for HTML/XML editing). At the moment I want to have
something good in tool-box (new screwdriver syndrome ;)

m.



Re: toggling keymap

2006-10-03 Thread A.J.Mechelynck

Sven Brueggemann wrote:

Hello,

where do I find CTRL-^ on a German keyboard? I know that I can
map it, but I'd like to see if the standard keystroke fits my
needs before changing it.

Kind regards

Sven



You may have to hunt around, using the Ctrl-V prefix in Insert mode; and it 
might not even be present. AFAICT my system either hasn't got it, or my 
keyboard driver or window manager strips the Ctrl bit away on non-alphabetic 
printable keys before gvim gets them. This is what I use on my Belgian keyboard:


:map! F8 C-^
:map F8 :let imi = !imiCR

It allows me to change it even in Normal mode (so the next r command, for 
instance, will or won't use the keymap). If you sometimes use an IME too you 
may want to refine the second mapping to


:map F8 :if kmp ==  Bar let imi = 2 * (!imi) Bar
  \ else Bar let imi = !imi Bar endifCR


Best regards,
Tony.


Re: toggling keymap

2006-10-03 Thread Sven Brueggemann
Hello,

A.J. Mechelynck wrote:
 Sven Brueggemann wrote:
 where do I find CTRL-^ on a German keyboard? I know that I can
 map it, but I'd like to see if the standard keystroke fits my
 needs before changing it.
 You may have to hunt around, using the Ctrl-V prefix in Insert mode;
 and it might not even be present. AFAICT my system either hasn't got
 it, or my keyboard driver or window manager strips the Ctrl bit away
 on non-alphabetic printable keys before gvim gets them.

Seems to be the first Vim command that's not available through my
keyboard.

 This is what  I use on my Belgian keyboard:
   :map! F8 C-^
   :map F8 :let imi = !imiCR
 It allows me to change it even in Normal mode (so the next r
 command, for instance, will or won't use the keymap).

Perfect, thanks!

Kind regards

Sven


Re: Colorschemes Need Updating

2006-10-03 Thread Tim Chase
Try GetLatestVimScripts -- 
http://vim.sourceforge.net/scripts/script.php?script_id=642

(also at http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs ; see
 getscript.tar.gz).  Set up a list of scripts you're interested in (an 
example is included

with either of the two downloads) and type
  :GLVS
whenever you want updates.


I have to laugh at how often questions get posted on the list of 
the form How can I do [horribly complex action that would be 
pretty much impossible in any other editor]? to which the reply 
is Oh, just download the [perform horribly complex action] 
script from [Dr. Chip's site | vim.org] and it will not only do 
[horribly complex action] but will also do [other tedious action] 
and [other crazy-hard action].


Is there a Notepad.exe mailing list?  Why is it so hard to write 
plugins for Notepad? ;)


Vim...what an editor! :)

-tim





Re: break very long line into short one with one g-command

2006-10-03 Thread Tim Chase

I have a line from about 40.000 characters.
I want to break this up into lines which are 80 charactes long.

In a previous thread, a few months ago this was possible with one g-command.
I did use it then also, but can't recall it anymore.


I presume you must be misremembering g.  I've done it with :s 
before:


:%s/.\{80\}/\r/g

It's a little trickier if you want it to fall exactly on 
word-boundaries, rather than hacking in the middle of words. 
However, if this is the case, drop a line back and I'll see what 
I can do.


-tim




Python in VIM auto completion

2006-10-03 Thread Gundala Viswanath

Dear all,

Perl and C/C++ is very lucky to have
perl-support.vim and c.vim by Fritz Mehner
that support a very convenient
auto completion shortcut in visual mode (e.g \aw for While construct).

Does anybody know if such a comprehensive scripts
also exist for Python?

python.vim doesn't seem to suppor this kind
of autocompletion.

--
Gundala Viswanath


Re: break very long line into short one with one g-command

2006-10-03 Thread A.J.Mechelynck

Eric Leenman wrote:

Hi,

I have a line from about 40.000 characters.
I want to break this up into lines which are 80 charactes long.

In a previous thread, a few months ago this was possible with one 
g-command.

I did use it then also, but can't recall it anymore.

Thanks,

Kind regards,
Eric

[ad snipped]

For one line:

:setlocal tw=80
gqq

Replace gqq by gqap for a paragraph, gggqG for the whole file, Visualgq etc.


Best regards,
Tony.


Re: break very long line into short one with one g-command

2006-10-03 Thread Eric Leenman

Hi Tim,

I might be mistaking, yes.

The line contains a codes like:
X200, X040, X200, X040, X3FF, X000, X000, X2AC,
Breaking the line after a , would be fine.

Rgds,
Eric


[...]

I presume you must be misremembering g.  I've done it with :s before:

:%s/.\{80\}/\r/g

It's a little trickier if you want it to fall exactly on word-boundaries, 
rather than hacking in the middle of words. However, if this is the case, 
drop a line back and I'll see what I can do.


-tim


_
Search—Your way, your world, right now!  
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-usFORM=WLMTAG




RE: break very long line into short one with one g-command

2006-10-03 Thread Suresh Govindachar

   I have a line from about 40.000 characters. I want to break 
   this up into lines which are 80 charactes long.
  
   In a previous thread, a few months ago this was possible with
   one g-command. I did use it then also, but can't recall it
   anymore.
  
   I presume you must be misremembering g. I've done it with
   :s before:
  
   :%s/.\{80\}/\r/g
  
   It's a little trickier if you want it to fall exactly on word-
   boundaries, rather than hacking in the middle of words.
   However, if this is the case, drop a line back and I'll see
   what I can do.

  :set tw=80 followed by gqq  

  Whether line break up happens at word boundaries or not depends on
  some parameter -- I have forgotten which.

  --Suresh



Windows Batch file with Tabs

2006-10-03 Thread thomas . hertneky

I thought that this would be easy, but I can not figure it out.
I have had a simple Windows CMD file for a long time to open several files
in VIM.
Each one gets its own window.
Now with V7.0 I would like to have a simple batch file to open the files in
one window, but with tabs.

I have found some complicated discussions in the archive about Windows and
tabs, but
they don't seem to fit.

Thank you for any help.




Tom Hertneky


The contents of this email are the property of PNC. If it was not addressed to 
you, you have no legal right to read it. If you think you received it in error, 
please notify the sender. Do not forward or copy without permission of the 
sender. This message may contain an advertisement of a product or service and 
thus may constitute a commercial electronic mail message under US Law. PNC’s 
postal address is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not wish to 
receive any additional advertising or promotional messages from PNC at this 
e-mail address, click here to Unsubscribe. 
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, 
you will be unsubscribed from all advertising or promotional messages from PNC. 
Removing your e-mail address from this mailing list will not affect your 
subscription to alerts, e-newsletters or account servicing e-mails..


Back to the Future! (...hrrrm...) ...the previous line!

2006-10-03 Thread Meino Christian Cramer
Hi,

 I would like an uninterrupted Left and Right stepping.

 Example

 This ist the end of the previous line.x$
 This is the beginnging of the line.$
 ^
 My cursor is here

 Now...when pressing Left I would like the cursor to jump to x in
 the previous line.

 And vice versa.

 Is it possible?

 Thanks a lot for any help in advance!
 Keep hacking!
 mcc


Re: Back to the Future! (...hrrrm...) ...the previous line!

2006-10-03 Thread Yakov Lerner

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

Hi,

 I would like an uninterrupted Left and Right stepping.

 Example

 This ist the end of the previous line.x$
 This is the beginnging of the line.$
 ^
 My cursor is here

 Now...when pressing Left I would like the cursor to jump to x in
 the previous line.


:set ww=,,[,]

:help 'whichwrap'

Yakov


Re: break very long line into short one with one g-command

2006-10-03 Thread A.J.Mechelynck

Suresh Govindachar wrote:
   I have a line from about 40.000 characters. I want to break 
   this up into lines which are 80 charactes long.

  
   In a previous thread, a few months ago this was possible with
   one g-command. I did use it then also, but can't recall it
   anymore.
  
   I presume you must be misremembering g. I've done it with
   :s before:
  
   :%s/.\{80\}/\r/g
  
   It's a little trickier if you want it to fall exactly on word-
   boundaries, rather than hacking in the middle of words.
   However, if this is the case, drop a line back and I'll see
   what I can do.

  :set tw=80 followed by gqq  


  Whether line break up happens at word boundaries or not depends on
  some parameter -- I have forgotten which.

  --Suresh




IIUC, hard line breaks always happen between words. When 'formatoptions' 
includes m then multibyte characters 255 are regarded as one word each in 
this respect (useful for CJK).


Soft breaks (i.e. line wrapping with 'wrap' on) happens at the screen edge 
(even in the middle of a word) unless you have both 'linebreak' and 'nolist'.



Best regards,
Tony.


Re: @ macro history

2006-10-03 Thread Tom Purl
I appreciate the recommendations, but my workflow is pretty much set
in stone for complex reasons.  

Thanks again!

Tom Purl

On Tue, Oct 03, 2006 at 11:23:38AM +0200, A.J.Mechelynck wrote:
 Tom Purl wrote:
 I'm trying to execute a series of Vim commands on multiple files.  Here's
 the workflow:
 
 1. Open a file using gvim
 2. Execute a named macro (that was recorded using the `q + a` command)
 3. Save and close my file (which forces me to close gvim in this
 example).
 4. Repeat on the next file without having to re-record my macro.
 
 This works for me with vim, but for some reason, when I re-open gvim, it
 forgets my @ macro.  What setting can I change to fix this?
 
 Thanks in advance!
 
 Tom Purl
 
 
 
 3. You don't have to close Vim for that.
 
 Save your file with :w then edit the next file with :e file2, which 
 implicitly closes your first file; or replace your file buffer by a 
 [NoFile] buffer by means of :enew.
 
 If you started Vim with several files as an argument list (e.g., vim 
 *.[ch] to edit all .c and .h files) or if you set the argument list 
 afterwards (:args *.htm *.html) you can simply go from one file to the 
 next using :next.
 
 What you registered using qa and replay using xa is in register a. The 
 :registers command should show it to you even after closing and 
 restarting Vim.
 
 
 Best regards,
 Tony.


Re: Windows Batch file with Tabs

2006-10-03 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

I thought that this would be easy, but I can not figure it out.
I have had a simple Windows CMD file for a long time to open several files
in VIM.
Each one gets its own window.
Now with V7.0 I would like to have a simple batch file to open the files in
one window, but with tabs.

I have found some complicated discussions in the archive about Windows and
tabs, but
they don't seem to fit.

Thank you for any help.




Tom Hertneky



gvimtabs.bat

gvim -p %1 %2 %3 %4 %5 %6 %7 %8 %9

Of course it won't work with Vim 6 or earlier.


Best regards,
Tony.


How to directly enter visual mode from insert mode ?

2006-10-03 Thread Ivan Vecerina
This is a problem I am occasionally stumbling on:
as I am done typing some new next in insert mode, I want
to highlight and erase some text ahead of the insert point.

Best case, I can type:   ESClv
But if I am at the end of the line, this won't work
 (the last character I inserted will be selected as well).

It would be nice if there was a convenient way to go
directly from insert mode to visual mode, while ensuring
that the visual selection starts at the current insertion
point.
Is there an easy way to do so ?

-- 
http://ivan.vecerina.com/



Re: How to directly enter visual mode from insert mode ?

2006-10-03 Thread Jean-Rene David
* Ivan Vecerina [2006.10.03 12:15]:
 [...]
 Best case, I can type:   ESClv
 [...]
 Is there an easy way to do so ?

According to 

:h i_esc

there is not builtin way to do this. But you could
use a mapping:

imap F8 esclv

-- 
JR


Re: How to directly enter visual mode from insert mode ?

2006-10-03 Thread Yakov Lerner

On 10/3/06, Ivan Vecerina [EMAIL PROTECTED] wrote:

This is a problem I am occasionally stumbling on:
as I am done typing some new next in insert mode, I want
to highlight and erase some text ahead of the insert point.

Best case, I can type:   ESClv
But if I am at the end of the line, this won't work
 (the last character I inserted will be selected as well).


I you have 'whichwrap' that includes  and  (as in
set whichwrap=,; see :help 'ww') then you can use
EscRightl

Yakov


Re: How to directly enter visual mode from insert mode ?

2006-10-03 Thread Dasn
On Tue, Oct 03, 2006 at 06:05:30PM +0200, Ivan Vecerina wrote:
 This is a problem I am occasionally stumbling on:
 as I am done typing some new next in insert mode, I want
 to highlight and erase some text ahead of the insert point.
 
 Best case, I can type:   ESClv

I prefer using C-Ov or C-\C-Ov to switch to Visual mode
temporarily

 But if I am at the end of the line, this won't work
  (the last character I inserted will be selected as well).
 
 It would be nice if there was a convenient way to go
 directly from insert mode to visual mode, while ensuring
 that the visual selection starts at the current insertion
 point.

:set selection=inclusive

-- 
Dasn



Re: How to directly enter visual mode from insert mode ?

2006-10-03 Thread cga2000
On Tue, Oct 03, 2006 at 12:05:30PM EDT, Ivan Vecerina wrote:
 This is a problem I am occasionally stumbling on:
 as I am done typing some new next in insert mode, I want
 to highlight and erase some text ahead of the insert point.
 
 Best case, I can type:   ESClv
 But if I am at the end of the line, this won't work
  (the last character I inserted will be selected as well).
 
 It would be nice if there was a convenient way to go
 directly from insert mode to visual mode, while ensuring
 that the visual selection starts at the current insertion
 point.
 Is there an easy way to do so ?

I do a Ctrl-O and then the lv commands .. May be convenient or er ..
less so .. depending on where you want to start you visual highlighting.
If you need to prefix three of four movement commands by a Ctrl-O to get
there it may be worth your while to escape back to command mode.

YMMV

Thanks

cga


Re: How to directly enter visual mode from insert mode ?

2006-10-03 Thread cga2000
On Tue, Oct 03, 2006 at 05:55:31PM EDT, Dasn wrote:
 On Tue, Oct 03, 2006 at 06:05:30PM +0200, Ivan Vecerina wrote:
  This is a problem I am occasionally stumbling on:
  as I am done typing some new next in insert mode, I want
  to highlight and erase some text ahead of the insert point.
  
  Best case, I can type:   ESClv
 
 I prefer using C-Ov or C-\C-Ov to switch to Visual mode
 temporarily

Shoot .. this was hidden on the next page and I didn't see it until it
was too late ..

:-( :-( :-(

Oh well .. should convince the OP that this is the way to go.. 

And then it may have the opposite effect...

:-)

Thanks

cga


Re: Windows Batch file with Tabs

2006-10-03 Thread Mark Woodward
Hi all,


On Tue, 03 Oct 2006 16:46:27 +0200
A.J.Mechelynck [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  I thought that this would be easy, but I can not figure it out.
  I have had a simple Windows CMD file for a long time to open
  several files in VIM.
  Each one gets its own window.
  Now with V7.0 I would like to have a simple batch file to open the
  files in one window, but with tabs.
  
  I have found some complicated discussions in the archive about
  Windows and tabs, but
  they don't seem to fit.
  
  Thank you for any help.
  
  
  
  
  Tom Hertneky
 
 
 gvimtabs.bat
 
   gvim -p %1 %2 %3 %4 %5 %6 %7 %8 %9
 
 Of course it won't work with Vim 6 or earlier.
 
 
 Best regards,
 Tony.


Tony, I just tried 'gvim -p *.php' from a dir containing 46 php files.
Vim only opened 10 tabs (but does have all 46 in the bufferlist). 10
tabs is more than enough, but I'm wondering if this is a setting
somewhere? ie why aren't there 46 tabs? 


-- 
Mark


Re: Colorschemes Need Updating

2006-10-03 Thread Mark Woodward
Hi all,

On Tue, 03 Oct 2006 08:09:42 -0500
Tim Chase [EMAIL PROTECTED] wrote:

 ... snip

 Is there a Notepad.exe mailing list?  Why is it so hard to write 
 plugins for Notepad? ;)
 
 Vim...what an editor! :)
 
 -tim
 

You can say that again Tim!!! I've been using it for 4-5yrs now and I'd
call myself 'capable' but by no means anywhere near the capacity of a
lot of the guys on this list (yourself, Antonie, Benji, David, Dr Chip,
Eric, Gary, Hari, Jürgen, Luc, Mikolaj, Peppe, Steve, Yakov, Yegappan,
and some guy who pops up occasionally. Bram I think his name is (he's
the guy with those funny python quotes in his sig) just to name a few).

I learn something every single time I read this list. It's the first
thing I do when I sit down! 

Anyway, enough Vim Love! I have to use it now to get some work done ;-)


-- 
Mark


BUG? getchar(0) and getchar(1) do not detect ESC

2006-10-03 Thread Peter Hodge
Hello all,

I am having trouble with getchar() detecting ESC.  If I use getchar(0) or
getchar(1), it will not pick up an ESC keystroke.  You can replicate this by
using the command:

  :sleep 3 | echo getchar(0)

... and pressing ESC quickly before the getchar() function is called.  In GUI
Vim, I correctly see 27 returned by getchar(0), but in Terminal Vim, getchar(0)
is returning '0', even though ESC has been pressed.  Is this a bug in Vim?

regards,
Peter




 
On Yahoo!7 
Answers:  25 million answers and counting. Learn something new today
http://www.yahoo7.com.au/answers


Re: Windows Batch file with Tabs

2006-10-03 Thread Manu Anand

I see tabpagemax is set to 10.
try changing that value..

On 10/3/06, Mark Woodward [EMAIL PROTECTED] wrote:

Hi all,


On Tue, 03 Oct 2006 16:46:27 +0200
A.J.Mechelynck [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  I thought that this would be easy, but I can not figure it out.
  I have had a simple Windows CMD file for a long time to open
  several files in VIM.
  Each one gets its own window.
  Now with V7.0 I would like to have a simple batch file to open the
  files in one window, but with tabs.
 
  I have found some complicated discussions in the archive about
  Windows and tabs, but
  they don't seem to fit.
 
  Thank you for any help.
 
 
 
 
  Tom Hertneky


 gvimtabs.bat

   gvim -p %1 %2 %3 %4 %5 %6 %7 %8 %9

 Of course it won't work with Vim 6 or earlier.


 Best regards,
 Tony.


Tony, I just tried 'gvim -p *.php' from a dir containing 46 php files.
Vim only opened 10 tabs (but does have all 46 in the bufferlist). 10
tabs is more than enough, but I'm wondering if this is a setting
somewhere? ie why aren't there 46 tabs?


--
Mark



Re: Questions regarding auto-guessing the encoding

2006-10-03 Thread Yongwei Wu

On 10/3/06, Yegappan Lakshmanan [EMAIL PROTECTED] wrote:

Hello,

On 10/2/06, Yongwei Wu [EMAIL PROTECTED] wrote:

 * Is there a way to tell a user-defined command to have file name completion?


Yes. You can use the -complete=file option when defining the
command. For example,


Thanks. It's useful info. Sorry that I missed it in the help.

No answer to my first question (detection of ++enc)? So it is not an
existing feature, right?

No matter, I have done most of the things. I'll post my current
results in some days (they are on my laptop, which has not a
connection to the Internet or this computer currently).

Best regards,

Yongwei

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


Re: Forms highlighting

2006-10-03 Thread Hari Krishna Dara
A new version is available, to try:

- Download the below file and put it in your autoload directory:
http://haridara.googlepages.com/forms.vim
- Start a fresh Vim session and execute:
:call forms#demo()

The new version has support for listening to changes in the field
values. The demo can now automatically lookup city and state when you
fill in your zipcode using a webservice (you need wget in the path and
need Internet connection).

On Tue, 3 Oct 2006 at 11:59am, Mikolaj Machowski wrote:

  Do arrows work like j and k outside form? Since I am mapping Up and
  Down keys, as long as they work outside form, I am assuming they
  shoudl work inside form also.

 No. They are inserting some version of keycode: OA, OB, OC, OD. In gui
 everything works well. In menus enabled

Doesn't that just mean your term is not properly setup? I tried it on
win32 console vim and it worked just fine.

 Bug: When completely remove value, leave field and later return
 to it default value is forgotten, Esc is going to Normal mode.

This is not a bug. When you leave the field, the value is immediately
saved, which means the new empty value overwrote the old value. When you
return back to the field, this empty value becomes your new default
value.

 Bug: Form is creating swap file which makes hard to use simultaneously
 the same form in various Vims when editing files in the same directory.
 Solution: Add 'setl noswapfile' after 'setl nomodified' in SetupBuf
 function (this is local option and but it is easier to read when
 explicitly declaring as local).

This is really not a bug. Since the user is creating the buffer, it is
his responsibility to set noswapfile if he is intending to open the same
form multiple times. We could set noswapfile in forms, but then if the
Vim crashes in the middle of the form entry, the user could loose some
important data :)

 Wish: different highlighting of  in drop-down menu (State) and
 combobox (Country). Maybe use {} somewhere?

Makes sense, I took a note in the TODO.

 I looked in the code: you are making just difference between editable
 and non-editable combobox. IMO would be better to split this in two
 widgets: combobox and dropdown menu. With that you will be able to make
 visual differences between those two items (highlighting, braces).

I don't know if this is more intuitive, but I know Java Swing/AWT
framework (the only GUI framework that I am familiar with) doesn't have
separate widgets.

 Good thing would be possibility to scale height of buffer to height of
 form and width [1]. Usually when filling you want to check context. Also
 in space preserving department: header is 3 lines high. First - empty
 line should go to /dev/null; second - value of separator is doubtful
 when highlighting works.

 [1] User may want to split window vertically. Maybe full buffer
 management isn't required but some elements for making it easier to user
 would be good: eg. length and width of form.

 This is complete addition to beginning SetupBuf::

   setl noswapfile
   let formheight = len(b:curForm.fields) + 3
   exe normal! .formheight.\C-W_
   let formwidth = b:curForm.maxLblSize * 2
   exe normal! .formwidth.\C-W|

We have to be careful in doing this. E.g., if you change the height
while there is only one window, Vim will behave strangely. I don't know
if there is any similar side effect of changing the width when there is
only one window. Again, since user is creating the window for now I
think we should leave this to the user. When buffer management is
implemented in forms, we can set these parameters.

 Unfortunately it goes wild when form will be opened in vertical
 window...

What do you mean?


  Are you interested to use the forms for any of your plugins or are you
  just helping me out? :) (in either case, many thanks).

 I have idea where I would like to use it but at the moment it is rather
 vague (tag form for HTML/XML editing). At the moment I want to have
 something good in tool-box (new screwdriver syndrome ;)

I get several such urges and try to control myself. :)
E.g., I created a softtabstop plugin to allow setting tabs at arbitrary
locations (just like a word processor), just for the fun of it and
because I needed it once. However, after I finished it a few weeks back,
I didn't need to use it even once. :))

-- 
Thanks,
Hari

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


Local scope ?

2006-10-03 Thread Meino Christian Cramer
Hi,

 when writing a function in vim script sometimes it makes sense to
 change options of vim.

 Are these changes local to the function ?
 And if not: Can I simply assign the current value of the option to a 
 variable, change the option and restore the option value from the
 value stored in that variable ?

 Or is this way just another kind of shooting into my own feet ? :)

 Keep hacking!
 mcc




Re: Local scope ?

2006-10-03 Thread Yegappan Lakshmanan

Hi,

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

Hi,

 when writing a function in vim script sometimes it makes sense to
 change options of vim.

 Are these changes local to the function ?
 And if not: Can I simply assign the current value of the option to a
 variable, change the option and restore the option value from the
 value stored in that variable ?



Yes. For example, to turn on the 'ignorecase' option, you can do the
following:

let old_ic = ignorecase
set ignorecase

 perform some operation

let ignorecase = old_ic

For more information, read the following Vim help topic:

   :help let-option

- Yegappan


Re: Local scope ?

2006-10-03 Thread Peter Hodge
Hello,

 Hi,
 
  when writing a function in vim script sometimes it makes sense to
  change options of vim.
 
  Are these changes local to the function ?

No, they persist after the function is ended.  As a simple example, you could
use a function like the following to toggle the 'number' option.

  map F5 :call ToggleNumberOption()CR
  function! ToggleNumberOption()
set number!
  endfunction

You'll see that the ToggleNumberOption function is changing the 'number' option
and the change persists after the function is ended.

  And if not: Can I simply assign the current value of the option to a 
  variable, change the option and restore the option value from the
  value stored in that variable?

Occasionally it is useful to store the value of an option and restore it later.
 You can do it like this:

   store the value
  let l:old_isk = iskeyword

   restore the value
  let iskeyword = l:old_isk

regards,
Peter




 
On Yahoo!7 
New Idea: Catch up on all the latest celebrity gossip 
http://www.newidea.com.au


Re: Local scope ?

2006-10-03 Thread Hari Krishna Dara

On Wed, 4 Oct 2006 at 5:09am, Meino Christian Cramer wrote:

 Hi,

  when writing a function in vim script sometimes it makes sense to
  change options of vim.

  Are these changes local to the function ?
  And if not: Can I simply assign the current value of the option to a
  variable, change the option and restore the option value from the
  value stored in that variable ?

  Or is this way just another kind of shooting into my own feet ? :)

  Keep hacking!
  mcc

Yegappan already answered your question. However, in case you want to do
the whole of it in the same function, I recommend the below pattern:

let _ic = ignorecase
set noic
try
 do something
finally
  let ignorecase = _ic
endtry

-- 
HTH,
Hari

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