'acd' + :file, 'acd' : +saveas

2006-09-05 Thread Yakov Lerner

Giving buffer new name in different directory does not change
to new directory, when 'acd' is set. This does not sound right,
taking into account that switching buffers to and back makes
current directory right.

To reproduce:
% vim -u NONE ~/xxx
:set acd
:he acdto have 2nd buffer
Ctrl-Wdown  back to ~/xxx
:file /tmp/1
:pwd wrong current dir, we expect /tmp
Ctrl-WupCtrl-Wdown  now pwd becomes right
 same happens with :saveas instead of :file
:saveas /var/tmp/2
:pwd wrong current dir, we expect /tmp
Ctrl-WupCtrl-Wdown  now pwd becomes right

Bug or feature ?

Yakov


Patch 7.0.084

2006-09-05 Thread Bram Moolenaar

Patch 7.0.084
Problem:The garbage collector may do its work while some Lists or
Dictionaries are used internally, e.g., by :echo that runs into
the more-prompt or :echo [garbagecollect()].
Solution:   Only do garbage collection when waiting for a character at the
toplevel.  Let garbagecollect() set a flag that is handled at the
toplevel before waiting for a character.
Files:  src/eval.c, src/getchar.c, src/globals.h, src/main.c


*** ../vim-7.0.083/src/eval.c   Sun Sep  3 15:38:02 2006
--- src/eval.c  Tue Sep  5 11:49:38 2006
***
*** 6074,6079 
--- 6074,6083 
  tabpage_T *tp;
  #endif
  
+ /* Only do this once. */
+ want_garbage_collect = FALSE;
+ may_garbage_collect = FALSE;
+ 
  /*
   * 1. Go through all accessible variables and mark all lists and dicts
   *with copyID.
***
*** 9636,9642 
  typval_T  *argvars;
  typval_T  *rettv;
  {
! garbage_collect();
  }
  
  /*
--- 9640,9648 
  typval_T  *argvars;
  typval_T  *rettv;
  {
! /* This is postponed until we are back at the toplevel, because we may be
!  * using Lists and Dicts internally.  E.g.: :echo [garbagecollect()]. */
! want_garbage_collect = TRUE;
  }
  
  /*
*** ../vim-7.0.083/src/getchar.cWed May  3 23:19:24 2006
--- src/getchar.c   Tue Sep  5 12:55:54 2006
***
*** 1451,1457 
  {
  updatescript(0);
  #ifdef FEAT_EVAL
! garbage_collect();
  #endif
  }
  
--- 1451,1458 
  {
  updatescript(0);
  #ifdef FEAT_EVAL
! if (may_garbage_collect)
!   garbage_collect();
  #endif
  }
  
***
*** 1502,1507 
--- 1503,1515 
  int   i;
  #endif
  
+ #ifdef FEAT_EVAL
+ /* Do garbage collection when garbagecollect() was called previously and
+  * we are now at the toplevel. */
+ if (may_garbage_collect  want_garbage_collect)
+   garbage_collect();
+ #endif
+ 
  /*
   * If a character was put back with vungetc, it was already processed.
   * Return it directly.
***
*** 1511,1523 
c = old_char;
old_char = -1;
mod_mask = old_mod_mask;
-   return c;
  }
! 
! mod_mask = 0x0;
! last_recorded_len = 0;
! for (;;)  /* this is done twice if there are modifiers */
  {
if (mod_mask)   /* no mapping after modifier has been read */
{
++no_mapping;
--- 1519,1531 
c = old_char;
old_char = -1;
mod_mask = old_mod_mask;
  }
! else
  {
+   mod_mask = 0x0;
+   last_recorded_len = 0;
+   for (;;)/* this is done twice if there are 
modifiers */
+   {
if (mod_mask)   /* no mapping after modifier has been read */
{
++no_mapping;
***
*** 1695,1702 
}
  #endif
  
!   return c;
  }
  }
  
  /*
--- 1703,1722 
}
  #endif
  
!   break;
!   }
  }
+ 
+ #ifdef FEAT_EVAL
+ /*
+  * In the main loop may_garbage_collect can be set to do garbage
+  * collection in the first next vgetc().  It's disabled after that to
+  * avoid internally used Lists and Dicts to be freed.
+  */
+ may_garbage_collect = FALSE;
+ #endif
+ 
+ return c;
  }
  
  /*
*** ../vim-7.0.083/src/globals.hSat Sep  2 14:52:41 2006
--- src/globals.h   Tue Sep  5 11:46:10 2006
***
*** 300,308 
  #endif
  
  #ifdef FEAT_EVAL
! EXTERN scid_T current_SID INIT(= 0);  /* ID of script being sourced or
!  was sourced to define the
!  current function. */
  #endif
  
  #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
--- 300,315 
  #endif
  
  #ifdef FEAT_EVAL
! /* Garbage collection can only take place when we are sure there are no Lists
!  * or Dictionaries being used internally.  This is flagged with
!  * may_garbage_collect when we are at the toplevel.
!  * want_garbage_collect is set by the garbagecollect() function, which means
!  * we do garbage collection before waiting for a char at the toplevel. */
! EXTERN intmay_garbage_collect INIT(= FALSE);
! EXTERN intwant_garbage_collect INIT(= FALSE);
! 
! /* ID of script being sourced or was sourced to define the current function. 
*/
! EXTERN scid_T current_SID INIT(= 0);
  #endif
  
  #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
*** ../vim-7.0.083/src/main.c   Tue Aug 29 17:28:56 2006
--- src/main.c  Tue Sep  5 12:33:47 2006
***
*** 1130,1135 
--- 1130,1145 
 */
update_curswant();
  
+ #ifdef FEAT_EVAL
+   /*
+* May perform garbage collection when waiting for a character, but
+* only at the very toplevel.  Otherwise we may be using a List or
+* Dict internally somewhere.
+* may_garbage_collect is reset in 

Bug in vim7? cursor postion col() vs. utf8-character for showbreak

2006-09-05 Thread Thomas
I set showbreak to ¦ (some extended character). This works fine for 
latin1 etc. but causes troubles when the encoding is utf8. Cursor 
position, col()  virtcol() values etc. are miscalculated for 
(soft)wrapped lines.


Regards,
Thomas.



Re: 'acd' + :file, 'acd' : +saveas

2006-09-05 Thread Bram Moolenaar

Yakov Lerner wrote:

 Giving buffer new name in different directory does not change
 to new directory, when 'acd' is set. This does not sound right,
 taking into account that switching buffers to and back makes
 current directory right.
 
 To reproduce:
 % vim -u NONE ~/xxx
 :set acd
 :he acdto have 2nd buffer
 Ctrl-Wdown  back to ~/xxx
 :file /tmp/1
 :pwd wrong current dir, we expect /tmp
 Ctrl-WupCtrl-Wdown  now pwd becomes right
  same happens with :saveas instead of :file
 :saveas /var/tmp/2
 :pwd wrong current dir, we expect /tmp
 Ctrl-WupCtrl-Wdown  now pwd becomes right
 
 Bug or feature ?

I suppose 'acd' should take effect here.

-- 
FATHER:Who are you?
PRINCE:I'm ... your son ...
FATHER:Not you.
LAUNCELOT: I'm ... er ... Sir Launcelot, sir.
 Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD

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

2006-09-05 Thread Bram Moolenaar

Patch 7.0.087
Problem:After :file fname and :saveas fname the 'autochdir' option
does not take effect. (Yakov Lerner)
Commands for handling 'autochdir' are repeated many times.
Solution:   Add the DO_AUTOCHDIR macro and do_autochdir().  Use it for
:file fname and :saveas fname.
Files:  src/proto/buffer.pro, src/buffer.c, src/ex_cmds.c, src/macros.h,
src/option.c, src/window.c


*** ../vim-7.0.086/src/proto/buffer.pro Sun Apr 30 20:25:32 2006
--- src/proto/buffer.proTue Sep  5 16:25:40 2006
***
*** 10,15 
--- 10,16 
  extern int do_buffer __ARGS((int action, int start, int dir, int count, int 
forceit));
  extern void set_curbuf __ARGS((buf_T *buf, int action));
  extern void enter_buffer __ARGS((buf_T *buf));
+ extern void do_autochdir __ARGS((void));
  extern buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T 
lnum, int flags));
  extern void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
  extern int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int 
forceit));
*** ../vim-7.0.086/src/buffer.c Tue Aug 29 16:52:01 2006
--- src/buffer.cTue Sep  5 15:18:19 2006
***
*** 434,445 
  if (usingNetbeans)
netbeans_file_closed(buf);
  #endif
! #ifdef FEAT_AUTOCHDIR
! /* Change directories when the acd option is set on. */
! if (p_acd  curbuf-b_ffname != NULL
! vim_chdirfile(curbuf-b_ffname) == OK)
!   shorten_fnames(TRUE);
! #endif
  
  /*
   * Remove the buffer from the list.
--- 434,441 
  if (usingNetbeans)
netbeans_file_closed(buf);
  #endif
! /* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
  
  /*
   * Remove the buffer from the list.
***
*** 1422,1433 
netbeans_file_activated(curbuf);
  #endif
  
! #ifdef FEAT_AUTOCHDIR
! /* Change directories when the acd option is set on. */
! if (p_acd  curbuf-b_ffname != NULL
! vim_chdirfile(curbuf-b_ffname) == OK)
!   shorten_fnames(TRUE);
! #endif
  
  #ifdef FEAT_KEYMAP
  if (curbuf-b_kmap_state  KEYMAP_INIT)
--- 1418,1425 
netbeans_file_activated(curbuf);
  #endif
  
! /* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
  
  #ifdef FEAT_KEYMAP
  if (curbuf-b_kmap_state  KEYMAP_INIT)
***
*** 1435,1440 
--- 1427,1444 
  #endif
  redraw_later(NOT_VALID);
  }
+ 
+ #if defined(FEAT_AUTOCHDIR) || defined(PROTO)
+ /*
+  * Change to the directory of the current buffer.
+  */
+ void
+ do_autochdir()
+ {
+ if (curbuf-b_ffname != NULL  vim_chdirfile(curbuf-b_ffname) == OK)
+   shorten_fnames(TRUE);
+ }
+ #endif
  
  /*
   * functions for dealing with the buffer list
*** ../vim-7.0.086/src/ex_cmds.cTue Aug 29 17:28:56 2006
--- src/ex_cmds.c   Tue Sep  5 15:24:58 2006
***
*** 2458,2463 
--- 2458,2465 
  #ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
  #endif
+   /* Change directories when the 'acd' option is set. */
+   DO_AUTOCHDIR
  }
  /* print full file name if :cd used */
  fileinfo(FALSE, FALSE, eap-forceit);
***
*** 2675,2682 
 eap, eap-append, eap-forceit, TRUE, FALSE);
  
/* After :saveas fname reset 'readonly'. */
!   if (eap-cmdidx == CMD_saveas  retval == OK)
!   curbuf-b_p_ro = FALSE;
  }
  
  theend:
--- 2677,2689 
 eap, eap-append, eap-forceit, TRUE, FALSE);
  
/* After :saveas fname reset 'readonly'. */
!   if (eap-cmdidx == CMD_saveas)
!   {
!   if (retval == OK)
!   curbuf-b_p_ro = FALSE;
!   /* Change directories when the 'acd' option is set. */
!   DO_AUTOCHDIR
!   }
  }
  
  theend:
***
*** 3547,3557 
foldUpdateAll(curwin);
  #endif
  
! #ifdef FEAT_AUTOCHDIR
!   if (p_acd  curbuf-b_ffname != NULL
! vim_chdirfile(curbuf-b_ffname) == OK)
!   shorten_fnames(TRUE);
! #endif
/*
 * Careful: open_buffer() and apply_autocmds() may change the current
 * buffer and window.
--- 3554,3562 
foldUpdateAll(curwin);
  #endif
  
!   /* Change directories when the 'acd' option is set. */
!   DO_AUTOCHDIR
! 
/*
 * Careful: open_buffer() and apply_autocmds() may change the current
 * buffer and window.
***
*** 3718,3729 
  if (p_im)
need_start_insertmode = TRUE;
  
! #ifdef FEAT_AUTOCHDIR
! /* Change directories when the acd option is set on. */
! if (p_acd  curbuf-b_ffname != NULL
! vim_chdirfile(curbuf-b_ffname) == OK)
!   shorten_fnames(TRUE);
! #endif
  
  #if defined(FEAT_SUN_WORKSHOP) || 

Patch 7.0.088

2006-09-05 Thread Bram Moolenaar

Patch 7.0.088
Problem:When compiled with Perl the generated prototypes have extern
unnecessarily added.
Solution:   Remove the -pipe argument from PERL_CFLAGS.
Files:  src/auto/configure, src/configure.in


*** ../vim-7.0.087/src/auto/configure   Thu May  4 23:52:03 2006
--- src/auto/configure  Tue Sep  5 17:09:55 2006
***
*** 4014,4020 
LDFLAGS=$ldflags_save
if test $perl_ok = yes; then
if test X$perlcppflags != X; then
! PERL_CFLAGS=$perlcppflags
fi
if test X$perlldflags != X; then
  LDFLAGS=$perlldflags $LDFLAGS
--- 4014,4020 
LDFLAGS=$ldflags_save
if test $perl_ok = yes; then
if test X$perlcppflags != X; then
! PERL_CFLAGS=`echo $perlcppflags | sed 's/-pipe //'`
fi
if test X$perlldflags != X; then
  LDFLAGS=$perlldflags $LDFLAGS
*** ../vim-7.0.087/src/configure.in Thu May  4 23:52:32 2006
--- src/configure.inTue Sep  5 17:09:50 2006
***
*** 508,514 
LDFLAGS=$ldflags_save
if test $perl_ok = yes; then
if test X$perlcppflags != X; then
! PERL_CFLAGS=$perlcppflags
fi
if test X$perlldflags != X; then
  LDFLAGS=$perlldflags $LDFLAGS
--- 508,515 
LDFLAGS=$ldflags_save
if test $perl_ok = yes; then
if test X$perlcppflags != X; then
! dnl remove -pipe, it confuses cproto
! PERL_CFLAGS=`echo $perlcppflags | sed 's/-pipe //'`
fi
if test X$perlldflags != X; then
  LDFLAGS=$perlldflags $LDFLAGS
*** ../vim-7.0.087/src/version.cTue Sep  5 16:29:38 2006
--- src/version.c   Tue Sep  5 17:27:33 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 88,
  /**/

-- 
**  Hello and Welcome to the Psychiatric Hotline **
If you are obsessive-compulsive, please press 1 repeatedly.
If you are co-dependent, please ask someone to press 2.
If you have multiple personalities, please press 3, 4, 5 and 6.
If you are paranoid-delusional, we know who you are and what you want
   - just stay on the line so we can trace the call.
If you are schizophrenic, listen carefully and a little voice will
   tell you which number to press next.
If you are manic-depressive, it doesn't matter which number you press
   - no one will answer.
If you suffer from panic attacks, push every button you can find.
If you are sane, please hold on - we have the rest of humanity on the
other line and they desparately want to ask you a few questions.

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

2006-09-05 Thread Bram Moolenaar

Patch 7.0.089
Problem:ga does not work properly for a non-Unicode multi-byte encoding.
Solution:   Only check for composing chars for utf-8. (Taro Muraoka)
Files:  src/ex_cmds.c


*** ../vim-7.0.088/src/ex_cmds.cTue Sep  5 16:29:38 2006
--- src/ex_cmds.c   Tue Sep  5 18:12:41 2006
***
*** 95,101 
_(%s%s%s  %d,  Hex %02x,  Octal %03o),
   transchar(c), buf1, buf2, c, c, c);
  #ifdef FEAT_MBYTE
!   c = cc[ci++];
  #endif
  }
  
--- 95,104 
_(%s%s%s  %d,  Hex %02x,  Octal %03o),
   transchar(c), buf1, buf2, c, c, c);
  #ifdef FEAT_MBYTE
!   if (enc_utf8)
!   c = cc[ci++];
!   else
!   c = 0;
  #endif
  }
  
***
*** 108,114 
if (len  0)
IObuff[len++] = ' ';
IObuff[len++] = '';
!   if (utf_iscomposing(c)
  # ifdef USE_GUI
 !gui.in_use
  # endif
--- 111,117 
if (len  0)
IObuff[len++] = ' ';
IObuff[len++] = '';
!   if (enc_utf8  utf_iscomposing(c)
  # ifdef USE_GUI
 !gui.in_use
  # endif
***
*** 120,126 
: _( %d, Hex %08x, Octal %o), c, c, c);
if (ci == MAX_MCO)
break;
!   c = cc[ci++];
  }
  #endif
  
--- 123,132 
: _( %d, Hex %08x, Octal %o), c, c, c);
if (ci == MAX_MCO)
break;
!   if (enc_utf8)
!   c = cc[ci++];
!   else
!   c = 0;
  }
  #endif
  
*** ../vim-7.0.088/src/version.cTue Sep  5 17:30:25 2006
--- src/version.c   Tue Sep  5 18:19:42 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 89,
  /**/

-- 
[clop clop]
GUARD #1:  Halt!  Who goes there?
ARTHUR:It is I, Arthur, son of Uther Pendragon, from the castle of
   Camelot.  King of the Britons, defeator of the Saxons, sovereign of
   all England!
GUARD #1:  Pull the other one!
  The Quest for the Holy Grail (Monty Python)

 /// 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: Patch 7.0.089

2006-09-05 Thread A.J.Mechelynck

Bram Moolenaar wrote:

Patch 7.0.089
Problem:ga does not work properly for a non-Unicode multi-byte encoding.
Solution:   Only check for composing chars for utf-8. (Taro Muraoka)
Files:  src/ex_cmds.c



Will this still work for non-Unicode charsets with composing chars, such 
as Arabic and Hebrew? And maybe Devanagari, but I'm less sure about that 
(I don't even know if Vim supports it)?


BTW, even in CJK a few composing chars are defined (e.g. 
hiragana/katakana voiced and semivoiced modifiers, or ideographic tone 
marks); I don't know which non-Unicode charsets support them though.



Best regards,
Tony.


Re: Bug in vim7? cursor postion col() vs. utf8-character for showbreak

2006-09-05 Thread A.J.Mechelynck

Thomas wrote:
I set showbreak to ¦ (some extended character). This works fine for 
latin1 etc. but causes troubles when the encoding is utf8. Cursor 
position, col()  virtcol() values etc. are miscalculated for 
(soft)wrapped lines.


Regards,
Thomas.




If you aren't working in a Unicode locale, you might try to switch the 
order of your :set showbreak and :set encoding statements.



Best regards,
Tony.


winrestview() + 'showcmd'

2006-09-05 Thread Yakov Lerner

I see erratic screen redraw (namely, curshor shown
past last line of file, or on wrong line (which is not line('.'))).
This vim 7.0.86 taken from svn today, including recent
fix to winrestcmd().

It happens after certain winrestview() when 'showcmd' is set.
This code works ok with 'noshowcmd'. (It took me a while to
track this down to 'showcmd' option specifically. The
context of this code is, I want to make scrollfix plugin which
locks cursor at Nth visual line, Nth line from top of screen).

To reproduce:

1. First, let's see how it works ok
 vim -u NONE -c 'so x.vim' x.vim
 press Down to end of file to see how it works ok.
 G gg G gg   works ok

2. With 'showcmd', same code works very differently:

 vim -u NONE -c 'so x.vim' x.vim
 :set showcmd  this turns on the problem
 :set nu ruler statusline= laststatus=2 this to watch the
  line number mismatch
  press Down repeatedly till eof
  BUG1: notice cursor draw past eof
  Up
  BUG2:  now notice the cursor is in line 25 but
  ':echo line(.)' shows line 26
  ggG
  BUG3: Now cursor is totally off-limits

Note that ':echo g:last' allows to see the dict
used in last winrestview() thanks to 'let g:last = dict'
line in x.vim.

Yakov
- x.vim --
:let g:scroll_fix=5  fix cursor fixed at fixed Nth visual line
:let so=0

aug scrollfix
   au!
   au CursorMoved * :call ScrollFix()
aug END

function! ScrollFix()
   if g:scroll_fix==0 | return | endif

keep cursor on fixed visual line of the window

   let dict = winsaveview()
   if dict['lnum'] = g:scroll_fix | return | endif
   if dict['lnum'] - dict['topline'] + 1 == g:scroll_fix | return | endif
   let dict['topline'] = dict['lnum'] - g:scroll_fix + 1
   let g:last = dict  for debugging
   call winrestview(dict)
endfunction


Patch 7.0.090

2006-09-05 Thread Bram Moolenaar

Patch 7.0.090
Problem:Cancelling the conform() dialog on the console with Esc requires
typing it twice. (Benji Fisher)
Solution:   When the start of an escape sequence is found use 'timeoutlen' or
'ttimeoutlen'.
Files:  src/misc1.c


*** ../vim-7.0.089/src/misc1.c  Sun Sep  3 16:39:51 2006
--- src/misc1.c Tue Sep  5 20:31:43 2006
***
*** 3016,3021 
--- 3016,3022 
  int   len = 0;
  int   n;
  int   save_mapped_ctrl_c = mapped_ctrl_c;
+ int   waited = 0;
  
  mapped_ctrl_c = FALSE;/* mappings are not used here */
  for (;;)
***
*** 3034,3044 
/* Replace zero and CSI by a special key code. */
n = fix_input_buffer(buf + len, n, FALSE);
len += n;
}
  
!   /* incomplete termcode: get more characters */
!   if ((n = check_termcode(1, buf, len))  0)
continue;
/* found a termcode: adjust length */
if (n  0)
len = n;
--- 3035,3050 
/* Replace zero and CSI by a special key code. */
n = fix_input_buffer(buf + len, n, FALSE);
len += n;
+   waited = 0;
}
+   else if (len  0)
+   ++waited;   /* keep track of the waiting time */
  
!   /* Incomplete termcode and not timed out yet: get more characters */
!   if ((n = check_termcode(1, buf, len))  0
!   (!p_ttimeout || waited * 100L  (p_ttm  0 ? p_tm : p_ttm)))
continue;
+ 
/* found a termcode: adjust length */
if (n  0)
len = n;
*** ../vim-7.0.089/src/version.cTue Sep  5 18:28:45 2006
--- src/version.c   Tue Sep  5 20:49:01 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 90,
  /**/

-- 
GUARD #1:  Where'd you get the coconut?
ARTHUR:We found them.
GUARD #1:  Found them?  In Mercea?  The coconut's tropical!
ARTHUR:What do you mean?
GUARD #1:  Well, this is a temperate zone.
  The Quest for the Holy Grail (Monty Python)

 /// 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: winrestview() + 'showcmd'

2006-09-05 Thread Bram Moolenaar

Yakov Lerner wrote:

 I see erratic screen redraw (namely, curshor shown
 past last line of file, or on wrong line (which is not line('.'))).
 This vim 7.0.86 taken from svn today, including recent
 fix to winrestcmd().
 
 It happens after certain winrestview() when 'showcmd' is set.
 This code works ok with 'noshowcmd'. (It took me a while to
 track this down to 'showcmd' option specifically. The
 context of this code is, I want to make scrollfix plugin which
 locks cursor at Nth visual line, Nth line from top of screen).
 
 To reproduce:
 
 1. First, let's see how it works ok
   vim -u NONE -c 'so x.vim' x.vim
   press Down to end of file to see how it works ok.
   G gg G gg   works ok
 
 2. With 'showcmd', same code works very differently:
 
   vim -u NONE -c 'so x.vim' x.vim
   :set showcmd  this turns on the problem
   :set nu ruler statusline= laststatus=2 this to watch the
line number mismatch
press Down repeatedly till eof
BUG1: notice cursor draw past eof
Up
BUG2:  now notice the cursor is in line 25 but
':echo line(.)' shows line 26
ggG
BUG3: Now cursor is totally off-limits
 
 Note that ':echo g:last' allows to see the dict
 used in last winrestview() thanks to 'let g:last = dict'
 line in x.vim.

Thanks for the clear explanation.  It seems this patch fixes the
problem:

*** ../vim-7.0.090/src/eval.c   Tue Sep  5 12:57:14 2006
--- src/eval.c  Tue Sep  5 21:21:37 2006
***
*** 16225,16231 
curwin-w_curswant = get_dict_number(dict, (char_u *)curswant);
curwin-w_set_curswant = FALSE;
  
!   curwin-w_topline = get_dict_number(dict, (char_u *)topline);
  #ifdef FEAT_DIFF
curwin-w_topfill = get_dict_number(dict, (char_u *)topfill);
  #endif
--- 16225,16231 
curwin-w_curswant = get_dict_number(dict, (char_u *)curswant);
curwin-w_set_curswant = FALSE;
  
!   set_topline(curwin, get_dict_number(dict, (char_u *)topline));
  #ifdef FEAT_DIFF
curwin-w_topfill = get_dict_number(dict, (char_u *)topfill);
  #endif

-- 
A mouse can be just as dangerous as a bullet or a bomb.
 (US Representative Lamar Smith, R-Texas)

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


simple netrw feature sugestion

2006-09-05 Thread Rodolfo Borges

When I use the :Explore or :Sexplore command,
the cursor could be positioned on the file I was just editing.


PS: why are the .h's positioned after the .o's by default?
I do know how to change it (removed the .h$ from g:netrw_sort_sequence),
I'm just questioning what seems to me a non-sensible default,
since one don't edit the .o's, but do edit the .h's a lot.

--
Rodolfo Borges


Re: simple netrw feature sugestion

2006-09-05 Thread A.J.Mechelynck

Rodolfo Borges wrote:

When I use the :Explore or :Sexplore command,
the cursor could be positioned on the file I was just editing.


PS: why are the .h's positioned after the .o's by default?
I do know how to change it (removed the .h$ from g:netrw_sort_sequence),
I'm just questioning what seems to me a non-sensible default,
since one don't edit the .o's, but do edit the .h's a lot.



*.h are header files, they contain no code but only protocols, 
defines, and such. They shouldn't change much over time, or at least 
much less than *.c or *.cpp source code files. I agree that it doesn't 
make much sense to list them after *.bak and *.o but before *.info, 
*.swp and *.obj. It might make sense to list them either immediately 
before or immediately after * (i.e., anything not mentioned in 
netrw_sortsequence), or else, as you do, interspersed with them.



Best regards,
Tony.


Re: matchparen tweak

2006-09-05 Thread A.J.Mechelynck

Benji Fisher wrote:

On Wed, Sep 06, 2006 at 01:20:13AM +0200, A.J.Mechelynck wrote:
It's supposed to treat ? and : on the one hand, and = and ; on the other 
hand, as paired brackets. However, the matchparen plugin uses a rather 
elementary algorithm to split 'matchpairs' into individual items: any 
colons and commas are regarded as delimiters, and then odd parts are 
treated as left brackets, even ones as right brackets.


 Good catch.  I think the line you are referring to is

  let plist = split(matchpairs, ':\|,')

in $VIMRUNTIME/plugin/matchparen.vim .


I see the following possible cures, use only one of them:
(a) disable matchparen matching

:set loaded_matchparen = 1

(b) remove the questionable pair ?:: from the 'matchpairs' options

(c) patch plugin/matchparen.vim to refine the splitting algorithm, so 
that a colon should be treated as either a separator or a bracket 
depending on position within the option.


 Now that the problem has been pointed out, I think the patch should
be made in the official distribution.  How about (simple but oh, so
clever)

  let plist = split(matchpairs, '.\zs.')

which removes every second character?  Will that have trouble with
multibyte characters?  Are these even allowed in 'matchpairs'?


The help for 'matchparen' mentions only single characters which must 
be different. You might try it with Arabic ornate parentheses, U+FD3E 
(left i.e. closing) and U+FD3F (right i.e.opening), which are obviously 
meant to pair with each other.


IIUC, a dot in a pattern matches one character, which may be one or more 
bytes, and which may occupy one screen cell, two for a wide CJK 
character, one to eight for a tab, etc.




HTH --Benji Fisher

P.S.  cc'ed to vim-dev for further discussion




Best regards,
Tony.


Re: Patch 7.0.082

2006-09-05 Thread Hari Krishna Dara

On Mon, 4 Sep 2006 at 9:50pm, Bram Moolenaar wrote:


 Hari Krishna Dara wrote:

   I wrote:
  
Patch 7.0.082
Problem:Calling a function that waits for input may cause List and
Dictionary arguments to be freed by the garbage collector.
Solution:   Keep a list of all arguments to internal functions.
Files:  src/eval.c
  
   I vaguely recall that some people were having unreproducible crashes
   when using input() or inputlist().  This patch should solve that.
  
   What happened was that the garbage collector didn't see the arguments to
   internal functions, thus would free List and Dict arguments that are
   still in use.  That leads to a double free later.  The garbage collector
   only does it's work when the user doesn't type for a little while, that
   made it unpredictable when it would happen.
 
  Can this happen during the debug session also? Like, when you do echo
  on lists? I am seeing that while debugging scripts that use Lists for
  sometime, Vim almost always crashes. Sometimes, I also start seeing
  internal errors related to List access (sorry, I didn't notedown the
  numbers) before it crashes.

 Yes, this could also happen in debug mode.  If you don't type something
 for 'updatetime' seconds the garbage collector is invoked.

 But the fix is only for when you pass a List or Dictionary to an
 internal function.  User functions were already OK.

 Hmm, now that I think of it you could get problems with a command like
 this:

   :echo [1, 2, 3, ..., 2000]

 If you get the more prompt the garbage collector might delete the list
 before it's completely echoed.  I'll look into that.


This is probably what I was doing during the debugging. I will try to
notice if an :echo on a list in a long running debug session is what is
causing the crash.

-- 
Thanks,
Hari

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


matchparen tweak (was: vim 7 errors)

2006-09-05 Thread Benji Fisher
On Wed, Sep 06, 2006 at 01:20:13AM +0200, A.J.Mechelynck wrote:
 
 It's supposed to treat ? and : on the one hand, and = and ; on the other 
 hand, as paired brackets. However, the matchparen plugin uses a rather 
 elementary algorithm to split 'matchpairs' into individual items: any 
 colons and commas are regarded as delimiters, and then odd parts are 
 treated as left brackets, even ones as right brackets.

 Good catch.  I think the line you are referring to is

  let plist = split(matchpairs, ':\|,')

in $VIMRUNTIME/plugin/matchparen.vim .

 I see the following possible cures, use only one of them:
 (a) disable matchparen matching
 
   :set loaded_matchparen = 1
 
 (b) remove the questionable pair ?:: from the 'matchpairs' options
 
 (c) patch plugin/matchparen.vim to refine the splitting algorithm, so 
 that a colon should be treated as either a separator or a bracket 
 depending on position within the option.

 Now that the problem has been pointed out, I think the patch should
be made in the official distribution.  How about (simple but oh, so
clever)

  let plist = split(matchpairs, '.\zs.')

which removes every second character?  Will that have trouble with
multibyte characters?  Are these even allowed in 'matchpairs'?

HTH --Benji Fisher

P.S.  cc'ed to vim-dev for further discussion


Re: syntax borked

2006-09-05 Thread Jorge Almeida
On Tue, 5 Sep 2006, A.J.Mechelynck wrote:

 
 The gentoo package managing system need not be aware of your own-compiled Vim,
 any more that my SuSE package managing system is aware of my Vim 7.0.83 (e.g.,
 it won't list it if I do rpm -qa |grep vim).
 
But I suppose I would need to recompile vim due to changes in the gentoo
system (e.g., after upgrading gcc/glibc)?
 [...]
  796 for ([EMAIL PROTECTED]){
  797 $heavy{$light[$_-1]}{$numbers[$_-1]}=$heavy[$_-1];
  798 }
 
 It doesn't. After pasting into an empty buffer via the clipboard,
 block-deleting the column of numbers (from the left margin up to, but not
 including, the s in sub at top and the last } at bottom) and setting
 'filetype' to perl, I see all reserved words in brown, identifiers starting @
 or $ in green including a preceding backslash if present, the identifier D
 also in green, strings and numbers in pink with the exception of
 backslash-escaped single quotes which are in mauve, regular expressions in
 pink and mauve between brown slashes, and the rest in black, all of it on a
 white background (this is gvim) from top to bottom of the text. The only thing
 doubtful (to me) is that, inside the double-quoted strings, ${logdir} is in
 pink but $! is in green.
In version 6.4, ${logdir} appears with the same colour as the rest of
the surrounding quoted string. I think this is normal. It would be
better to make it the same colour as other variables, like $!, but the
developer probably didn't think about it.
 
 My Vim distribution uses ftplugin/perl.vim by Dan Sharp (2005 Dec 16) and
 syntax/perl.vim by Nick Hibma (2006 Aug 9).
 
It appears there is a bug in the syntax file (see reply by Peter Hodge).
This brings  up the question: How to install a syntax file without
poluting the distribution system? In gentoo, the file is (for version
6.4):
/usr/share/vim/vim64/syntax/perl.vim
Replacing this is not a good idea, since it would be replaced next time
I updated vim in gentoo. So, is there a way to tell vim where to look
for [some] syntax files? (Something like /usr/local/share/...)?

And about the indenting problem? Could you check with your vim and the
above piece of code? If you place the cursor on line 796 and press 'o'
in normal mode, it should open a line with the cursor above the '$' of
$heavy. What happened to me is that the cursor would be below the 'f'
of for.

Thanks a lot.

Regards,

Jorge 


Re: syntax borked

2006-09-05 Thread Jorge Almeida
On Tue, 5 Sep 2006, Peter Hodge wrote:

 Hello Jorge,
 
 The problem is solved if you change this line:
 
   768 sub reloadlist{
 
 to this:
 
   768 sub reloadlist {
 
 It looks as though it is a bug in the perl syntax file.  You should send the
 maintainer an email with your perl code snippet, and he should be able to fix
 it.  It probably never even crossed his mind that someone might leave out the
 whitespace there.
 
Thanks. The syntax file worked with version 6.4, so probably he just
accidentaly deleted something...

Regards,

Jorge 


Re: syntax borked

2006-09-05 Thread Peter Hodge

--- Jorge Almeida [EMAIL PROTECTED] wrote:


 It appears there is a bug in the syntax file (see reply by Peter Hodge).
 This brings  up the question: How to install a syntax file without
 poluting the distribution system? In gentoo, the file is (for version
 6.4):
 /usr/share/vim/vim64/syntax/perl.vim
 Replacing this is not a good idea, since it would be replaced next time
 I updated vim in gentoo. So, is there a way to tell vim where to look
 for [some] syntax files? (Something like /usr/local/share/...)?
 

Well, there was a bug in the older syntax file I used (the one from 2005), but
the newer syntax file I downloaded is fine.  If you don't want to put the new
syntax file in your home directory (~/.vim/syntax/perl.vim), you can also put
it in /usr/share/vim/vimfiles/syntax/perl.vim.  That directory should already
be scanned by default ... check the value of 'runtimepath' to be sure.


 And about the indenting problem? Could you check with your vim and the
 above piece of code? If you place the cursor on line 796 and press 'o'
 in normal mode, it should open a line with the cursor above the '$' of
 $heavy. What happened to me is that the cursor would be below the 'f'
 of for.
 

The indenting works fine for me, without installing any new indent scripts. 
Have you enabled 'autoindent' and/or 'smartindent'?

regards,
Peter




 
On Yahoo!7 
Check out PS Trixi - The hot new online adventure 
http://www.trixi.com.au


Syntax question regarding \%[

2006-09-05 Thread Peter Hodge
Hello all,

Given the following text:

  inte
  integ
  intege
  integer
  inter
  interv
  interva
  interval

is there any easy way to make these two commands work?

  syntax match Error /int\%[eger]/
  syntax match Error /int\%[erval]/

The second match begins taking priority as soon as the word is 'inte', and
prevents 'integer' from being matched correctly.

regards,
Peter




 
Do you Yahoo!? 
The new TV home page features highlights, popular picks, and the best of 
homemade TV 
http://au.tv.yahoo.com/tv/


Execute something when I enter in a directory

2006-09-05 Thread Andrea Spadaccini
Hello vimmers,
I'd like to load some settings when I enter in a directory, like for
instance setting makeprg.

Is there a way to do it?
Thanks in advance from a lurker! :)

-- 
[ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
[ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.16 ]
[ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]


signature.asc
Description: PGP signature


Re: syntax borked

2006-09-05 Thread Jorge Almeida
On Tue, 5 Sep 2006, Peter Hodge wrote:

 
 Well, there was a bug in the older syntax file I used (the one from 2005), but
 the newer syntax file I downloaded is fine.  If you don't want to put the new
 syntax file in your home directory (~/.vim/syntax/perl.vim), you can also put
 it in /usr/share/vim/vimfiles/syntax/perl.vim.  That directory should already
 be scanned by default ... check the value of 'runtimepath' to be sure.
How to check?

Anyway, I think I'll settle to put it in ~/.vim/syntax.
I'm recompiling vim 7.0.17 now, and will install the current syntax
file.
 
 
 The indenting works fine for me, without installing any new indent scripts. 
 Have you enabled 'autoindent' and/or 'smartindent'?
 
Yes. And I didn't change my .vimrc, which works OK with 6.4.

Thanks.

Regards,

Jorge 


Re: Syntax question regarding \%[

2006-09-05 Thread Yakov Lerner

On 9/5/06, Peter Hodge [EMAIL PROTECTED] wrote:

Hello all,

Given the following text:

  inte
  integ
  intege
  integer
  inter
  interv
  interva
  interval

is there any easy way to make these two commands work?

  syntax match Error /int\%[eger]/
  syntax match Error /int\%[erval]/

The second match begins taking priority as soon as the word is 'inte', and
prevents 'integer' from being matched correctly.




Your problem is that both patterns match int and inte, resulting in ambiguity.
I think solution is to separate 'int' and 'inte' as separate matches,
whcih results in unambiguous matching:

  syntax match Error /integ\%[er]/
  syntax match Error /inter\%[val]/
  syntax match Error /\int\%[e]\/

(untested)

Even better would be use syn keyword:

   syn keyword Error int inte integ intege integer inter interv
interva interval

On the other hand, both of your 'syn match'es use same group, so
why 2nd match taking over would be a problem anyway ?

Yakov


Re: Execute something when I enter in a directory

2006-09-05 Thread Yakov Lerner

On 9/5/06, Andrea Spadaccini [EMAIL PROTECTED] wrote:

Hello vimmers,
I'd like to load some settings when I enter in a directory, like for
instance setting makeprg.

Is there a way to do it?
Thanks in advance from a lurker! :)


I have this in my .vimrc:

au BufRead,BufNewFile * let x=expand('%:p:h')./.lvimrc | if
filereadable(x) | exe source .x | endif
let x=expand('%:p:h')./.lvimrc | if filereadable(x) | exe source .x | endif

Then I put directory-specififc settings into file .lvimrc in that directory.

Yakov


Re: Execute something when I enter in a directory

2006-09-05 Thread Andrea Spadaccini
Ciao Yakov,

 I have this in my .vimrc:
 
 au BufRead,BufNewFile * let x=expand('%:p:h')./.lvimrc | if
 filereadable(x) | exe source .x | endif
 let x=expand('%:p:h')./.lvimrc | if filereadable(x) | exe source
 .x | endif

 Then I put directory-specififc settings into file .lvimrc in that
 directory.

Thanks, it almost worket off-the-shelf.
I simply had to escape spaces in filenames. Where you write
exe source . x
it should be
exe source . substitute(x, ' ', '\\ ', 'g')

Thanks a lot, it's exactly what I was looking for.
Regards,

-- 
[ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
[ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.16 ]
[ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]


signature.asc
Description: PGP signature


matching question...one is cancelling the other

2006-09-05 Thread Robert Hicks

I have an option match for my Tcl syntax script as follows:

syn match tclOptionMatcher \%(^\|\s\)\zs-[a-zA-Z]\+ 
contains=tclOptionStarter

syn match tclOptionStarter contained -

I also would like to get tclOperators going as well:

syntax match tclOperator [~\-_+*\[\]{}=|[EMAIL PROTECTED]\\/:\^\.,!?]

However, because the tclOperator match has a - in it, it nullifies the 
 first tclOptionMatcher.


Is there a way to have both? Can I group the first one like (-[a-zA-Z]) 
or something?


Robert



Re: Syntax question regarding \%[

2006-09-05 Thread Benji Fisher
On Tue, Sep 05, 2006 at 06:51:57PM +1000, Peter Hodge wrote:
 Hello all,
 
 Given the following text:
 
   inte
   integ
   intege
   integer
   inter
   interv
   interva
   interval
 
 is there any easy way to make these two commands work?
 
   syntax match Error /int\%[eger]/
   syntax match Error /int\%[erval]/
 
 The second match begins taking priority as soon as the word is 'inte', and
 prevents 'integer' from being matched correctly.
 
 regards,
 Peter

 How about adding end-of-word patterns:

syntax match Error /int\%[eger]\/
syntax match Error /int\%[erval]\/

HTH --Benji Fisher


Re: syntax borked

2006-09-05 Thread A.J.Mechelynck

Jorge Almeida wrote:

On Tue, 5 Sep 2006, A.J.Mechelynck wrote:


The gentoo package managing system need not be aware of your own-compiled Vim,
any more that my SuSE package managing system is aware of my Vim 7.0.83 (e.g.,
it won't list it if I do rpm -qa |grep vim).


But I suppose I would need to recompile vim due to changes in the gentoo
system (e.g., after upgrading gcc/glibc)?

[...]


If you upgrade the compiler, there should be no need to recompile 
everything immediately, unless it doesn't work with the new libraries. 
The next time there are _vim_ bugfixes, you ought to be able to use the 
new version of the compiler with no trouble. The only thing is, if you 
install or uninstall any packages that Vim uses (just as you would do if 
you change your configuration settings), you should run make reconfig 
in the src/ subdirectory to make sure that the configure cache is voided 
and that your configuration settings are checked against the new state 
of your software.



796 for ([EMAIL PROTECTED]){
797 $heavy{$light[$_-1]}{$numbers[$_-1]}=$heavy[$_-1];
798 }

It doesn't. After pasting into an empty buffer via the clipboard,
block-deleting the column of numbers (from the left margin up to, but not
including, the s in sub at top and the last } at bottom) and setting
'filetype' to perl, I see all reserved words in brown, identifiers starting @
or $ in green including a preceding backslash if present, the identifier D
also in green, strings and numbers in pink with the exception of
backslash-escaped single quotes which are in mauve, regular expressions in
pink and mauve between brown slashes, and the rest in black, all of it on a
white background (this is gvim) from top to bottom of the text. The only thing
doubtful (to me) is that, inside the double-quoted strings, ${logdir} is in
pink but $! is in green.

In version 6.4, ${logdir} appears with the same colour as the rest of
the surrounding quoted string. I think this is normal. It would be
better to make it the same colour as other variables, like $!, but the
developer probably didn't think about it.

My Vim distribution uses ftplugin/perl.vim by Dan Sharp (2005 Dec 16) and
syntax/perl.vim by Nick Hibma (2006 Aug 9).


It appears there is a bug in the syntax file (see reply by Peter Hodge).
This brings  up the question: How to install a syntax file without
poluting the distribution system? In gentoo, the file is (for version
6.4):
/usr/share/vim/vim64/syntax/perl.vim
Replacing this is not a good idea, since it would be replaced next time
I updated vim in gentoo. So, is there a way to tell vim where to look
for [some] syntax files? (Something like /usr/local/share/...)?


Drop it as $VIM/vimfiles/syntax/perl.vim (i.e., IIUC, 
/usr/share/vim/vimfiles/syntax/perl.vim), creating any needed 
directories in the process; it will then be loaded before 
$VIMRUNTIME/syntax/perl.vim, and the latter, seeing that a syntax script 
has already been loaded, should terminate early without doing anything. 
Of course, if someday you upgrade $VIMRUNTIME/syntax/perl.vim to 
something _more recent_ than $VIM/vimfiles/syntax/perl.vim, you should 
remove the latter manually.




And about the indenting problem? Could you check with your vim and the
above piece of code? If you place the cursor on line 796 and press 'o'
in normal mode, it should open a line with the cursor above the '$' of
$heavy. What happened to me is that the cursor would be below the 'f'
of for.


First, do :filetype with no arguments. If it says (among other things) 
indent:OFF then you're not using filetype-related indenting and you 
need :filetype indent on or :filetype plugin indent on somewhere in 
your vimrc (it can be done implicitly by sourcing 
$VIMRUNTIME/vimrc_example.vim).


My $VIMRUNTIME/indent/perl.vim is dated 2005 Sep 07 (by Rafael 
Garcia-Suarez). If yours is the same or later, IMHO you should contact 
the maintainer. If it is earlier, check the URI in the file's headings.




Thanks a lot.

Regards,

Jorge 



Best regards,
Tony.


Re: syntax borked

2006-09-05 Thread A.J.Mechelynck

Jorge Almeida wrote:

On Tue, 5 Sep 2006, Peter Hodge wrote:


Well, there was a bug in the older syntax file I used (the one from 2005), but
the newer syntax file I downloaded is fine.  If you don't want to put the new
syntax file in your home directory (~/.vim/syntax/perl.vim), you can also put
it in /usr/share/vim/vimfiles/syntax/perl.vim.  That directory should already
be scanned by default ... check the value of 'runtimepath' to be sure.

How to check?


:set runtimepath?

See the default for it at

:help 'runtimepath'



Anyway, I think I'll settle to put it in ~/.vim/syntax.
I'm recompiling vim 7.0.17 now, and will install the current syntax
file.
The indenting works fine for me, without installing any new indent scripts. 
Have you enabled 'autoindent' and/or 'smartindent'?



Yes. And I didn't change my .vimrc, which works OK with 6.4.

Thanks.

Regards,

Jorge 



Best regards,
Tony.


Re: Syntax question regarding \%[

2006-09-05 Thread A.J.Mechelynck

Peter Hodge wrote:

Hello all,

Given the following text:

  inte
  integ
  intege
  integer
  inter
  interv
  interva
  interval

is there any easy way to make these two commands work?

  syntax match Error /int\%[eger]/
  syntax match Error /int\%[erval]/

The second match begins taking priority as soon as the word is 'inte', and
prevents 'integer' from being matched correctly.

regards,
Peter


Well, make them exclusive: either

:sy match Error /int\%[eger]/
:sy match Error /inter\%[val]/
or
:sy match Error /int\%[erval]/
:sy match Error /integ\%[er]/

Or even with a single pattern:

:sy match Error /int\%(\%[eger]\|\%[erval]\)/


Best regards,
Tony.


[help?] ezmlm warning

2006-09-05 Thread Max Dyckhoff
Has anyone else had this problem? Looking at the bounce message at the bottom 
shows that 131.107.1.8 (Microsoft's mail server) doesn't like 160.45.45.151 (is 
this the mailing list server?) because it is listed on spamcop (although a 
quick check of spamcop shows that isn't true). Anything I should be doing?

Cheers,

Max

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 05, 2006 8:36 AM
 To: Max Dyckhoff
 Subject: ezmlm warning

 Hi! This is the ezmlm program. I'm managing the
 vim@vim.org mailing list.


 Messages to you from the vim mailing list seem to
 have been bouncing. I've attached a copy of the first bounce
 message I received.

 If this message bounces too, I will send you a probe. If the probe
 bounces,
 I will remove your address from the vim mailing list,
 without further notice.


 I've kept a list of which messages from the vim mailing list have
 bounced from your address.

 Copies of these messages may be in the archive.
 To retrieve a set of messages 123-145 (a maximum of 100 per request),
 send an empty message to:
[EMAIL PROTECTED]

 To receive a subject and author list for the last 100 or so messages,
 send an empty message to:
[EMAIL PROTECTED]

 Here are the message numbers:

68464
...
68686

 --- Enclosed is a copy of the bounce message I received.

 Return-Path: 
 Received: (qmail 658 invoked for bounce); 24 Aug 2006 21:56:46 -
 Date: 24 Aug 2006 21:56:46 -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: failure notice

 Hi. This is the qmail-send program at foobar.math.fu-berlin.de.
 I'm afraid I wasn't able to deliver your message to the following
 addresses.
 This is a permanent error; I've given up. Sorry it didn't work out.

 [EMAIL PROTECTED]:
 131.107.1.8 does not like recipient.
 Remote host said: 550 5.7.1 Email rejected because 160.45.45.151 is listed
 by bl.spamcop.net. Please see http://www.spamcop.net/bl.shtml for more
 information.  If you still need assistance contact [EMAIL PROTECTED]
 Giving up on 131.107.1.8.



Re: syntax borked

2006-09-05 Thread Jorge Almeida
On Tue, 5 Sep 2006, A.J.Mechelynck wrote:

 Jorge Almeida wrote:
  On Tue, 5 Sep 2006, Peter Hodge wrote:
 
 Best regards,
 Tony.
 
Thanks again for your help.

Regards,

Jorge 


Search and replace as per format

2006-09-05 Thread Srinivas Rao. M

Hi Vimmers,

I am tasked to replace the pattern

log(module_name, LOG_LEVEL_DEBUG, The Value of status=%d message,
status);

to

log(module_name, LOG_LEVEL_DEBUG, %s:The Value of status=%d
message,__FUNCTION__, status);


This pattern is appearing in hundreds of source files. Does anybody have
a quicker way/script to do this task ?.
I know it is possible through macro substitution by writing another
macro on top of this, But again it is not a cleaner way..

Any help Most welcome.
regards,
srini...




Re: [help?] ezmlm warning

2006-09-05 Thread A.J.Mechelynck

Max Dyckhoff wrote:

Has anyone else had this problem? Looking at the bounce message at the bottom 
shows that 131.107.1.8 (Microsoft's mail server) doesn't like 160.45.45.151 (is 
this the mailing list server?) because it is listed on spamcop (although a 
quick check of spamcop shows that isn't true). Anything I should be doing?

Cheers,

Max


160.45.45.151 is foobar.math.fu-berlin.de, the list server. According to 
Senderbase 
http://www.senderbase.org/?searchBy=ipaddresssb=1searchString=160.45.45.151 
it is not in any known blacklists at the moment.


The Spamcop blocking list has a quick reaction time: it blocks an IP 
address quickly when spam is reported to have been sent out of it, and 
it unblocks it quickly (and without human intervention) when no more 
reports are coming. The fewer the reports, or the lower the rate of 
reports compared to the overall mail from the same source, and the 
faster the unblocking. So it is conceivable that your mail server was 
blocked for a short time, just when you were sending. Bad luck, I'd say.



Best regards,
Tony.


RE: Execute something when I enter in a directory

2006-09-05 Thread Chuck Mason
While I'm still new here, I would like to share my version based on
Yakov's.  Below uses \\ directory separator so this will not work on
any *nix.  I could make it more os-independent by doing an `if' and `let
cmdsep=whatever', but I'm positive there's a better way to do it.  Or
maybe there's just a way to chop off the topmost directory name from a
string. In any case, the function below simply seeks to the root of the
filesystem searching for a _lvimrc and stops after finding one.

function! ExecuteLocalConfig()
let x = expand('%:p:h')
let fn = x . /_lvimrc

if filereadable(fn)
exe source  . substitute(fn, ' ', '\\ ', 'g')
else
while strridx(x, \\) != -1
let p = strridx(x, \\)
let x = strpart(x, 0, p)
let fn = x . /_lvimrc

echo fn
if filereadable(fn)
exe source  . substitute(fn, ' ', '\\
', 'g')
break
endif
endwhile
endif
endfunc

 handle local config au
if !exists(au_localconfig)
  let au_localconfig = 1

  au BufNewFIle,BufRead * call ExecuteLocalConfig()
endif


Chuck

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 05, 2006 3:20 AM
To: Andrea Spadaccini
Cc: vim@vim.org
Subject: Re: Execute something when I enter in a directory

On 9/5/06, Andrea Spadaccini [EMAIL PROTECTED] wrote:
 Hello vimmers,
 I'd like to load some settings when I enter in a directory, like for
 instance setting makeprg.

 Is there a way to do it?
 Thanks in advance from a lurker! :)

I have this in my .vimrc:

au BufRead,BufNewFile * let x=expand('%:p:h')./.lvimrc | if
filereadable(x) | exe source .x | endif
let x=expand('%:p:h')./.lvimrc | if filereadable(x) | exe source .x
| endif

Then I put directory-specififc settings into file .lvimrc in that
directory.

Yakov


Re: [help?] ezmlm warning

2006-09-05 Thread Russell Bateman
I get these all the time and, as far as I can tell, they are somewhat 
meaningless to me (maybe they mean something to vim list management) 
since, if I ignore them, I don't seem to be subject to any adverse 
consequences: I seem still to get the mail threads.


Russ

Max Dyckhoff wrote:

Has anyone else had this problem? Looking at the bounce message at the bottom 
shows that 131.107.1.8 (Microsoft's mail server) doesn't like 160.45.45.151 (is 
this the mailing list server?) because it is listed on spamcop (although a 
quick check of spamcop shows that isn't true). Anything I should be doing?

Cheers,

Max

  

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 05, 2006 8:36 AM
To: Max Dyckhoff
Subject: ezmlm warning

Hi! This is the ezmlm program. I'm managing the
vim@vim.org mailing list.


Messages to you from the vim mailing list seem to
have been bouncing. I've attached a copy of the first bounce
message I received.

If this message bounces too, I will send you a probe. If the probe
bounces,
I will remove your address from the vim mailing list,
without further notice.


I've kept a list of which messages from the vim mailing list have
bounced from your address.

Copies of these messages may be in the archive.
To retrieve a set of messages 123-145 (a maximum of 100 per request),
send an empty message to:
   [EMAIL PROTECTED]

To receive a subject and author list for the last 100 or so messages,
send an empty message to:
   [EMAIL PROTECTED]

Here are the message numbers:

   68464
   ...
   68686

--- Enclosed is a copy of the bounce message I received.

Return-Path: 
Received: (qmail 658 invoked for bounce); 24 Aug 2006 21:56:46 -
Date: 24 Aug 2006 21:56:46 -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: failure notice

Hi. This is the qmail-send program at foobar.math.fu-berlin.de.
I'm afraid I wasn't able to deliver your message to the following
addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

[EMAIL PROTECTED]:
131.107.1.8 does not like recipient.
Remote host said: 550 5.7.1 Email rejected because 160.45.45.151 is listed
by bl.spamcop.net. Please see http://www.spamcop.net/bl.shtml for more
information.  If you still need assistance contact [EMAIL PROTECTED]
Giving up on 131.107.1.8.





  




Re: Search and replace as per format

2006-09-05 Thread Charles E Campbell Jr

Srinivas Rao. M wrote:


Hi Vimmers,

I am tasked to replace the pattern

log(module_name, LOG_LEVEL_DEBUG, The Value of status=%d message,
status);

to

log(module_name, LOG_LEVEL_DEBUG, %s:The Value of status=%d
message,__FUNCTION__, status);


This pattern is appearing in hundreds of source files. Does anybody have
a quicker way/script to do this task ?.
I know it is possible through macro substitution by writing another
macro on top of this, But again it is not a cleaner way..
 



Are those linebreaks really in there?  I doubt it as one of them is in 
the middle of a string.
OK, assuming they're not there, that its just a mailer thinking its 
smarter than you...


:%g/log(module_name,/s/The Value of status=%d 
message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d 
message,__FUNCTION__,status);


That'll do the trick for one file; then, of course, you'll want to save it:
 :w

OK, now let's see how to automate this:
qa
:%g/log(module_name,/s/The Value of status=%d 
message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d 
message,__FUNCTION__,status);

:w
:n
q

That will store the command sequence into a register (I picked register 
a).  To use it:


vim PatternForHundredsOfSourceFiles
qa
:%g/log(module_name,/s/The Value of status=%d 
message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d 
message,__FUNCTION__,status);

:w
:n
[EMAIL PROTECTED]

Assuming you don't have 10,000 of these, eventually vim will report an 
error.  A PatternForHundredsOfSourceFiles

might be   *.c */*.c */*/*.c   (etc.)

Regards,
Chip Campbell



Re: Search and replace as per format

2006-09-05 Thread Tim Chase

I am tasked to replace the pattern

log(module_name, LOG_LEVEL_DEBUG, The Value of status=%d message,
status);

to

log(module_name, LOG_LEVEL_DEBUG, %s:The Value of status=%d
message,__FUNCTION__, status);


Well, with unknown line-breaks, and not knowing which pieces are 
subject to change, I'll take a stab at it.  The biggest offender 
would be if any of the contents of the statement has parens in 
it, such as


log(module_name, LOG_LEVEL_DEBUG, The value...%d, (4 + vbl))

which would cause problems.  Also, if an escaped doublequote is 
in your string, it would also cause it to choke, e.g.


The Value of \status\=%d message


The basic statement would be something like

:%s/log(\([^]*\)\_s*,\_s*\(LOG_LEVEL\w*\)\_s*,\_s*\([^]*\)\_s*,\_s*\([^)]\+\))/log(\1, 
\2, %s:\3,__FUNCTION__, \4)/g


It pulls out each piece so you can manipulate further if needed.


This pattern is appearing in hundreds of source files. Does anybody have
a quicker way/script to do this task ?.


Once you've got the above working on one file, you can use vim's 
argdo/bufdo functionality to do something like


vim *.c *.h
:set hidden
:argdo %s///g

after which you can check over them, before (if all's good) issuing

:wall


You can learn more about some of the nuances of this at

:help argdo
:help bufdo
:help 'hidden'
:help :wall

and the rest is just a big ugly regexp to match what I understand 
you're hunting. :)


-tim





Re: Execute something when I enter in a directory

2006-09-05 Thread A.J.Mechelynck

Andrea Spadaccini wrote:

Hello vimmers,
I'd like to load some settings when I enter in a directory, like for
instance setting makeprg.

Is there a way to do it?
Thanks in advance from a lurker! :)



'makeprg' is a global-local option. Maybe the other ones you want to set 
are also buffer-local or global-local. Then you can set them by means of 
:setlocal at the BufRead,BufNewFile events. You can also set up 
buffer-local mappings and abbreviations by means of :map buffer and 
:abbrev buffer. Set them at the same events. For window-local 
options I suppose you should use the BufWinEnter event (still with 
setlocal). Whether you do it by means of a script, a function, or 
straight on the :autocmd line, is IMHO purely a matter of taste.


I hope you won't feel the need to set global-only options like 'guifont' 
-- for these ones you would need the BufEnter event, meaning they would 
change whenever you switched buffers by switching windows through (e.g.) 
^Ww and the result could be ugly -- in that case you might want to 
reassess your priorities and possibly dedicate a separate instance of 
gvim to each distinct setting of such global-only options.



Best regards,
Tony.


Re: bug in confirm() and default option

2006-09-05 Thread Bram Moolenaar

Benji Fisher wrote:

   $ vim
   :echo confirm(Save changes?, Yes\nNo\nCancel, 0)
   user types CR
   0
   :gui
   :echo confirm(Save changes?, Yes\nNo\nCancel, 0)
   user types CR
   1
   
   I did it that way to make sure that I was actually using the same binary
   with and without the GUI running.  The second time I invoked confirm(),
   a dialogue box popped up with the Yes button highlighted.
  
  Many GUIs don't support a dialog without a button selected.  Disabling
  the use of Enter to select a button isn't a good idea either.  Thus for
  some GUIs it simply won't work to have a dialog without a default.
 
  I do not like the way it works now, since the GUI is not consistent
 with the terminal version.  Would it be possible to add a Cancel
 button to the GUI dialogue box, and select this button if confirm() is
 called with argument 0 as above?  I am not sure how terminal vim
 *should* respond to other out-of-range arguments (e.g., 4 instead of 0
 in the above example).

Adding a Cancel button completely goes against what the user specifies.
If you want a default to cancel you can specify it.

  I notice that the GUI confirm() returns 0 if I cancel the dialogue
 box with Esc.  Ditto for terminal vim, but then I have to type Esc
 twice, which is odd.  (Yes, I did wait more than 'timeoutlen' ms.)

I see this too.

-- 
Veni, Vidi, Video -- I came, I saw, I taped what I saw.

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


un-subscribe me from list please!

2006-09-05 Thread Xiaoshen Li
Hi,

Could anybody on the list help me un-subscribe from vim mailing list? Thank you 
very much.


Re: un-subscribe me from list please!

2006-09-05 Thread Tim Chase

Could anybody on the list help me un-subscribe from vim mailing list? Thank you 
very much.


Just send a message from the account with which you subscribed 
and are responding/posting ([EMAIL PROTECTED]) to [EMAIL PROTECTED]


-tim





keymapping problem

2006-09-05 Thread Bob Self
I'm running the current version of Ubuntu and can't get S-Insert or
C-Insert to work but F7 and F8
work fine. I have this in my .vimrc:


if has(xterm_clipboard)
vnoremap F7 +y
nmap F8 :set pasteCR+p:set nopasteCR`]
imap F8 ESC:set pasteCR+p:set nopasteCR`]i
 I seem to have a keyboard problem with shift-insert so I'm using the
above for now to copy and paste to the
clipboard
   nmap S-Insert :set pasteCR+p:set nopasteCR`]
   imap S-Insert ESC:set pasteCR+p:set nopasteCR`]i
endif


Can someone tell me how to get S-Insert and C-Insert working, since
this is what I use on win32?

thanks,
Bob Self



Re: keymapping problem

2006-09-05 Thread A.J.Mechelynck

Bob Self wrote:

I'm running the current version of Ubuntu and can't get S-Insert or
C-Insert to work but F7 and F8
work fine. I have this in my .vimrc:


if has(xterm_clipboard)
vnoremap F7 +y
nmap F8 :set pasteCR+p:set nopasteCR`]
imap F8 ESC:set pasteCR+p:set nopasteCR`]i
 I seem to have a keyboard problem with shift-insert so I'm using the
above for now to copy and paste to the
clipboard
   nmap S-Insert :set pasteCR+p:set nopasteCR`]
   imap S-Insert ESC:set pasteCR+p:set nopasteCR`]i
endif


Can someone tell me how to get S-Insert and C-Insert working, since
this is what I use on win32?

thanks,
Bob Self




Depending on your termcap and/or on your windowmanager, some special key 
may not reach Vim. To check if Vim perceives Shift-Insert and 
Ctrl-Insert, do the following:


1. Open an empty buffer, e.g. with :new
2. Hit Ctrl-V followed by Shift-Insert
3. (Optional) Hit Enter to move to the next line
4. Hit Ctrl-V followed by Ctrl-Insert

The above assumes that you don't use mswin.vim. If you do, then ctrl-V 
means paste from clipboard and you should use ctrl-Q instead at steps 
2 and 4 above.


Check what (if anything) is inserted into the buffer at steps 2 and 4. 
In gvim, you should see S-Insert and C-Insert respectively. In 
console Vim, it should look like a few characters of gibberish. However, 
if your window manager or terminal intercepts the key combo, then you 
may either get nothing, or more than just a few bytes. For instance, in 
konsole, when I hit Ctrl-V followed by Shift-Insert, it pastes the whole 
contents of the clipboard (without S-Insert being mapped), setting 
several undo points in the process (which seems to indicate that my 
mappings are active; and indeed I hadn't set 'paste'). In gvim OTOH I 
get the expected values.


There are several solutions, depending on what you see:
- Tweak your 'timeout', 'timeoutlen' and 'ttimeoutlen' settings, if it 
looks like Vim might confuse the special key with an actual Escape 
followed by something. 'ttimeoutlen' should be faster than the fastest 
rate at which you yourself hit the keyboard (not including auto-repeat), 
but slower than the rate at which your keyboard interface pushes the 
successive bytes of a single special key into the keyboard typeahead 
buffer; and 'timeoutlen' should be slower than the slowest rate at which 
you yourself expect to be hitting the successive keys of a multibyte 
mapping, |i_CTRL-V| or |i_CTRL-V_digit| key sequence, or digraph. For 
instance, :set timeout timeoutlen=5000 ttimeoutlen=333 will make 
special keys time out after one-third of a second and mappings after 
five seconds.
- Check your :set termcap settings, if it seems that console Vim might 
be misundertanding what you type. The few bytes of gibberish seen in 
console Vim at steps 2 and 4 above should be identical with the 
corresponding termcap entries.

- Use gvim rather than console Vim, if gvim does not exhibit the problem
- Use a different terminal emulator
- Change window managers, if both vim-in-xterm and gvim exhibit the 
problem. But if it's not the window manager but the X11 server this 
approach won't work; and since you want to access the X clipboard you 
can't use the /dev/tty (non-X pure-text) console.
- Map a different key, such as some Fn key or key combo. If you want 
uniformity with W32 you can map the same Fn key in W32 too.



Best regards,
Tony.


Re: vim 7 errors

2006-09-05 Thread Bram Moolenaar

Paul van Erk wrote:

 I have weird matching pairs erros. It seems vim tries to match ; at the end 
 of lines. The result is:
 
 Error detected while processing function SNR20_Highlight_Matching_Pair:
 line   38:
 E684: list index out of range: 11
 
 After that I have to ESC like mad to get out of the error.
 
 I tried searching for the location where it has a list of matchable 
 characters, but I couldn't find it. Does anyone know what's wrong?

What is the value of your 'matchpairs' option?

-- 
This is the polymorph virus!  Follow these instructions carefully:
1. Send this message to everybody you know.
2. Format your harddisk.
Thank you for your cooperation in spreading the most powerful virus ever!

 /// 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: vim 7 errors

2006-09-05 Thread A.J.Mechelynck

Paul van Erk wrote:

Hi,

I have weird matching pairs erros. It seems vim tries to match ; at the end 
of lines. The result is:


Error detected while processing function SNR20_Highlight_Matching_Pair:
line   38:
E684: list index out of range: 11

After that I have to ESC like mad to get out of the error.

I tried searching for the location where it has a list of matchable 
characters, but I couldn't find it. Does anyone know what's wrong?


Grts,
Paul van Erk


SNR20_ means a function defined with s: or SID in the 20th sourced 
script, as shown by :scriptnames. I guess it might be the matchparen 
plugin.


What is your 'matchpairs' option set to? It should contain 
comma-separated pairs of colon-separated single characters, by default 
(:),[:],{:}


I suspect you may have mistyped the example for matching equal signs to 
semicolons mentioned at :help 'matchpairs': in


:set matchpairs+==:;

there should be a plus sign, _two_ equal signs, a colon and a semicolon. 
Also, the example given (at line 4398 of options.txt for Vim 7.0 dated 
2006 Aug 09) ought to have setlocal rather than set, as follows:


:au FileType c,cpp,java setl mps+==:;
   ^

in order to avoid clobbering the global default value for non-C non-C++ 
non-Java files.



Best regards,
Tony.


Re: keymapping problem

2006-09-05 Thread A.J.Mechelynck

Bob Self wrote:

On Tue, Sep 05, 2006 at 10:51:07PM +0200, A.J.Mechelynck wrote:
Depending on your termcap and/or on your windowmanager, some special key 
may not reach Vim. To check if Vim perceives Shift-Insert and 
Ctrl-Insert, do the following:


1. Open an empty buffer, e.g. with :new
2. Hit Ctrl-V followed by Shift-Insert
3. (Optional) Hit Enter to move to the next line
4. Hit Ctrl-V followed by Ctrl-Insert

The above assumes that you don't use mswin.vim. If you do, then ctrl-V 
means paste from clipboard and you should use ctrl-Q instead at steps 
2 and 4 above.


Check what (if anything) is inserted into the buffer at steps 2 and 4. 
In gvim, you should see S-Insert and C-Insert respectively. In 
console Vim, it should look like a few characters of gibberish. However, 
if your window manager or terminal intercepts the key combo, then you 
may either get nothing, or more than just a few bytes. For instance, in 
konsole, when I hit Ctrl-V followed by Shift-Insert, it pastes the whole 
contents of the clipboard (without S-Insert being mapped), setting 
several undo points in the process (which seems to indicate that my 
mappings are active; and indeed I hadn't set 'paste'). In gvim OTOH I 
get the expected values.




In both vim and gvim I see nothing. Ctrl-V puts me in insert mode (is that 
right?).
I'm running Ubuntu / gnome / xterm.


Oops... I should have added: step 1 bis: hit i or a to get into Insert 
mode. Ctrl-V in Normal mode should put you into Block-visual.





There are several solutions, depending on what you see:
- Tweak your 'timeout', 'timeoutlen' and 'ttimeoutlen' settings, if it 
looks like Vim might confuse the special key with an actual Escape 
followed by something. 'ttimeoutlen' should be faster than the fastest 
rate at which you yourself hit the keyboard (not including auto-repeat), 
but slower than the rate at which your keyboard interface pushes the 
successive bytes of a single special key into the keyboard typeahead 
buffer; and 'timeoutlen' should be slower than the slowest rate at which 
you yourself expect to be hitting the successive keys of a multibyte 
mapping, |i_CTRL-V| or |i_CTRL-V_digit| key sequence, or digraph. For 
instance, :set timeout timeoutlen=5000 ttimeoutlen=333 will make 
special keys time out after one-third of a second and mappings after 
five seconds.



- Check your :set termcap settings, if it seems that console Vim might 
be misundertanding what you type. The few bytes of gibberish seen in 
console Vim at steps 2 and 4 above should be identical with the 
corresponding termcap entries.


I typed :set termcap but I did not see S-Insert there.


- Use gvim rather than console Vim, if gvim does not exhibit the problem
- Use a different terminal emulator
- Change window managers, if both vim-in-xterm and gvim exhibit the 
problem. But if it's not the window manager but the X11 server this 
approach won't work; and since you want to access the X clipboard you 
can't use the /dev/tty (non-X pure-text) console.
- Map a different key, such as some Fn key or key combo. If you want 
uniformity with W32 you can map the same Fn key in W32 too.



Best regards,
Tony.



I guess the conclusion is that S-Insert is not getting to vim. I don't want to 
change from linux / Ubuntu / gnome / xterm, so am I stuck? F7 and F8 work, so I

could switch to those keys on win32 if there is no solution.

thanks,
Bob




In my experience, F1 to F12 (except F1 for Help and maybe F10 for 
Menu) and S-F1 to S-F12 are the most portable keys to map; AFAIK, 
they are seen by all flavours of vim and gvim, and aren't already in use 
for built-in commands.



Best regards,
Tony.


Re: PHP omni-completion, PHP objects

2006-09-05 Thread Mikolaj Machowski
Had to got message from Yahoo Groups, original post was lost somewhere:

 with vim7's omni-completion how do you call/get functions/variables
 relating to a specific class?
 
 $object = new HTML_QuickForm();
 $object-
 
 And then after you type - how do i call for completions only relating
 to the HTML_QuickForm class? I've tried the patch for ctags for PHP5
 but my results are the same, are there specific parameters to build
 the tags file for vim so i can call for suggestions relating to a
 specific class/object? I've been going into my pear/lib dir and
 typing:
 ctags -R
 I've also tried
 ctags -R --fields=+S
 But every time after i type - i will always just get everything in
 the tags file including new class names. Is there a specific key combo
 i must press to get suggestions relating to the class/object?

This one was solved on priv. Implemented new feature, with positive
feedback new version will be sent to Bram to place on ftp.

 Also how can i build a tags file where functions will have parameters
 in the preview window? It already does this for php functions but for
 some reason pear libs and my code will always just be
 function_name()
 instead of
 function_name($param1,$param2,$etc)

Ctags for PHP is very simple and line based. If in PEAR functions are
defined in one line::

function fname($param2, $param1)

It should be extracted by ctags, will be shown in tags file and
omnicompletion plugin should show it in preview window.

Check if generated tags file has similar line::

write_cache cache.php   /^  function write_cache($var, 
$filename) {$/;f

If answer is positive there is probably something wrong with plugin, if
negative check PEAR code or play with ctags options.

m.




Re: vim 7 errors

2006-09-05 Thread Paul van Erk
More info; I found this in my .(g)vimrc :

set matchpairs+=?::,=:;

so that's: PLUS EQUALS QUESTION_MARK COLON COLON COMMA EQUALS COLON SEMICOLON

It's been in there for ages (checked some backups and I've had my rc file for 
2 years or so, I think) and never gave me any problems. Does anyone know what 
it's supposed to do and what the syntax should be? For now I'll comment it 
out, so the errors are gone.

Grts,
Paul

On Tuesday 05 September 2006 23:33, A.J.Mechelynck wrote:
 Paul van Erk wrote:
  Hi,
 
  I have weird matching pairs erros. It seems vim tries to match ; at the
  end of lines. The result is:
 
  Error detected while processing function SNR20_Highlight_Matching_Pair:
  line   38:
  E684: list index out of range: 11
 
  After that I have to ESC like mad to get out of the error.
 
  I tried searching for the location where it has a list of matchable
  characters, but I couldn't find it. Does anyone know what's wrong?
 
  Grts,
  Paul van Erk

 SNR20_ means a function defined with s: or SID in the 20th sourced
 script, as shown by :scriptnames. I guess it might be the matchparen
 plugin.

 What is your 'matchpairs' option set to? It should contain
 comma-separated pairs of colon-separated single characters, by default
 (:),[:],{:}

 I suspect you may have mistyped the example for matching equal signs to
 semicolons mentioned at :help 'matchpairs': in

   :set matchpairs+==:;

 there should be a plus sign, _two_ equal signs, a colon and a semicolon.
 Also, the example given (at line 4398 of options.txt for Vim 7.0 dated

 2006 Aug 09) ought to have setlocal rather than set, as follows:
   :au FileType c,cpp,java setl mps+==:;

  ^

 in order to avoid clobbering the global default value for non-C non-C++
 non-Java files.


 Best regards,
 Tony.

-- 
Website: http://www.parena.net
dbKalendar http://www.parena.net/dbKalendar


Re: vim 7 errors

2006-09-05 Thread Benji Fisher
On Wed, Sep 06, 2006 at 01:03:04AM +0200, Paul van Erk wrote:
 More info; I found this in my .(g)vimrc :
 
 set matchpairs+=?::,=:;
 
 so that's: PLUS EQUALS QUESTION_MARK COLON COLON COMMA EQUALS COLON SEMICOLON
 
 It's been in there for ages (checked some backups and I've had my rc file for 
 2 years or so, I think) and never gave me any problems. Does anyone know what 
 it's supposed to do and what the syntax should be? For now I'll comment it 
 out, so the errors are gone.
 
 Grts,
 Paul

 The 'matchpairs' option controls how % finds matching characters.
Just as ( and ) are paired, your setting pairs ? with : and = with ; .
The matchparen plugin uses the 'matchpairs' option as well.  For more
details,

:help 'matchpairs'

HTH --Benji Fisher


Re: Smarter Indent (an odd problem)

2006-09-05 Thread François Pinard

[Benji Fisher]


Let me take this opportunity to try once again to drum up support
for an idea that I have proposed before.  IMO it is too restrictive to
make options (such as syntax highlighting, 'textwidth', and
indent-related options) apply to a whole file.  There should be a
convenient, consistent way to tell vim to treat different sections of a
file as having different file types.  Examples:



* code snippets in an e-mail
* PHP in an HTML file (or vice-versa)
* perl/python/ruby inside a vim script
* comments, text, and math inside LaTeX/plain TeX/conTeXt


I quite agree it would be an interesting possibility.  For example, it 
would be nice having reST support in Python doc-strings (for those 
projects where it makes sense), programming language support within 
parser generators having their own separate syntax, and such things.


But I have realistically no time to offer (being usually rather short on 
free time), so I'm not sure how I / we could help.


--
François Pinard   http://pinard.progiciels-bpi.ca


Re: bug in confirm() and default option

2006-09-05 Thread Hari Krishna Dara

On Tue, 5 Sep 2006 at 3:38pm, Bram Moolenaar wrote:


 Benji Fisher wrote:

  On Sun, Sep 03, 2006 at 11:54:11AM -0700, Hari Krishna Dara wrote:
  
   On Sun, 3 Sep 2006 at 8:21pm, Bram Moolenaar wrote:
  
I have tried the win32 console version and it works properly there.  Do
you mean the GUI version?  Please be specific, trying all kinds of
things to find out what you mean is a waste of time.
  
   I reported that the console version works fine in a separate email, so
   yes, it is the GUI version. Sorry for not being clear.
 
   In the original post, Hari did say gvim.  On Linux (FC2, GTK-2) I
  find that it works as expected in vim (with the GUI not running) but
  shows the same problem in gvim (with the GUI running).
 
  $ vim
  :echo confirm(Save changes?, Yes\nNo\nCancel, 0)
  user types CR
  0
  :gui
  :echo confirm(Save changes?, Yes\nNo\nCancel, 0)
  user types CR
  1
 
  I did it that way to make sure that I was actually using the same binary
  with and without the GUI running.  The second time I invoked confirm(),
  a dialogue box popped up with the Yes button highlighted.

 Many GUIs don't support a dialog without a button selected.  Disabling
 the use of Enter to select a button isn't a good idea either.  Thus for
 some GUIs it simply won't work to have a dialog without a default.

I know for sure Windows native UI supports dialogs without a default
button, and Motif also should support this as well. I will in fact be
surprised if GUIs always force the programmer to specify a default
button, as there should be a choice not to have one (especially when
there is a complex interface).

In my case, I was trying to set no default button when I know there is
some important information to read, but the user might routinely press
Space or Enter to get rid off it.  If the dialog doesn't get hidden,
the user will more likely read it.  Right now I resorted to doing an
echohl with WarningMsg followed by an input(), but this introduces a
drastic difference from the routine case where the user still sees a
dialog.

-- 
Thanks,
Hari

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


Re: Execute something when I enter in a directory

2006-09-05 Thread Luc Hermitte
* On Tue, Sep 05, 2006 at 09:51:31AM -0700, Chuck Mason [EMAIL PROTECTED] 
wrote:
 While I'm still new here, I would like to share my version based on
 Yakov's.  Below uses \\ directory separator so this will not work on
 any *nix.

Use instead match on '[/\\]', or fnamemodify()

 I could make it more os-independent by doing an `if' and `let
 cmdsep=whatever', but I'm positive there's a better way to do it.  Or
 maybe there's just a way to chop off the topmost directory name from a
 string. In any case, the function below simply seeks to the root of
 the filesystem searching for a _lvimrc and stops after finding one.

Check for instance
http://hermitte.free.fr/vim/ressources/vimfiles/plugin/local_vimrc.vim.
Several unusual cases are taken into account.

BTW, I do not need to backslash spaces with win32-vim on XP.
(:h escape() to backslash characters)


-- 
Luc Hermitte
http://hermitte.free.fr/vim/


Question about directory browse

2006-09-05 Thread meilin
hi everyone

When I browse directory with vim 7.0 (with out gui),I want to edit a file
while vsplit the window.so I just move curse to the file I want then
press v,but there is a little probem,the new windows always split to
the left.even I set the option spr.

I want it split to the right. anyone please help?

thx

  

-- 


 meilin
 mailto:[EMAIL PROTECTED]



Yanking multi-line pattern matches

2006-09-05 Thread Druce, Richard
I'm trying to select all the text matching a (multi-line) pattern so I
can put it into a separate document. I thought the global command would
work but it only copies the first matching line, does anyone know a
command to do this?
 
Cheers,
Richard.


Re: Question about directory browse

2006-09-05 Thread A.J.Mechelynck

meilin wrote:

hi everyone

When I browse directory with vim 7.0 (with out gui),I want to edit a file
while vsplit the window.so I just move curse to the file I want then
press v,but there is a little probem,the new windows always split to
the left.even I set the option spr.

I want it split to the right. anyone please help?

thx

  



:let netrw_altv = 1

see :help netrw-browse-var


Best regards,
Tony.


matchparen tweak (was: vim 7 errors)

2006-09-05 Thread Benji Fisher
On Wed, Sep 06, 2006 at 01:20:13AM +0200, A.J.Mechelynck wrote:
 
 It's supposed to treat ? and : on the one hand, and = and ; on the other 
 hand, as paired brackets. However, the matchparen plugin uses a rather 
 elementary algorithm to split 'matchpairs' into individual items: any 
 colons and commas are regarded as delimiters, and then odd parts are 
 treated as left brackets, even ones as right brackets.

 Good catch.  I think the line you are referring to is

  let plist = split(matchpairs, ':\|,')

in $VIMRUNTIME/plugin/matchparen.vim .

 I see the following possible cures, use only one of them:
 (a) disable matchparen matching
 
   :set loaded_matchparen = 1
 
 (b) remove the questionable pair ?:: from the 'matchpairs' options
 
 (c) patch plugin/matchparen.vim to refine the splitting algorithm, so 
 that a colon should be treated as either a separator or a bracket 
 depending on position within the option.

 Now that the problem has been pointed out, I think the patch should
be made in the official distribution.  How about (simple but oh, so
clever)

  let plist = split(matchpairs, '.\zs.')

which removes every second character?  Will that have trouble with
multibyte characters?  Are these even allowed in 'matchpairs'?

HTH --Benji Fisher

P.S.  cc'ed to vim-dev for further discussion


Re: Subversion Access

2006-09-05 Thread Devin Weaver
I still can't figure out what it was I even tried to upgrade my  
router's firmware. Anyway I worked around it like Bill suggested to  
repeat to procedure (I think it was 2 or three times) and it finished.


Thanks.


quick and dirty compile

2006-09-05 Thread Sibin P. Thomas
Hi,

Could someone let me know how to quickly compile my current buffer? I want a
key map like 
nmap F5 x to do -- gcc -o current_file.o current_file.c
also another map to make an executable, like
nmap F5 x to do -- gcc -o current_file current_file.c

Also it would be convenient if this command could give a list of errors like
:make.

Regards,
Sibin
-
Disclaimer
-

This message(including attachment if any)is confidential and may be 
privileged.Before opening attachments please check them
for viruses and defects.MindTree Consulting Private Limited (MindTree)will not 
be responsible for any viruses or defects or
any forwarded attachments emanating either from within MindTree or outside.If 
you have received this message by mistake please notify the sender by return  
e-mail and delete this message from your system. Any unauthorized use or 
dissemination of this message in whole or in part is strictly prohibited.  
Please note that e-mails are susceptible to change and MindTree shall not be 
liable for any improper, untimely or incomplete transmission.

-

Re: quick and dirty compile

2006-09-05 Thread Yegappan Lakshmanan

Hi,

On 9/5/06, Sibin P. Thomas [EMAIL PROTECTED] wrote:

Hi,

Could someone let me know how to quickly compile my current buffer? I want a
key map like
nmap F5 x to do -- gcc -o current_file.o current_file.c



Try using the following command:

 nnoremap F5 :!gcc -o %:p:r.o %CR



also another map to make an executable, like
nmap F5 x to do -- gcc -o current_file current_file.c



Try using the following command:

  nnoremap F5 :!gcc -o %:p:r %CR



Also it would be convenient if this command could give a list of errors like
:make.



To use make and jump to compile-time errors, try the following command:

   set makeprg=gcc\ -o\ %\ %

- Yegappan


Re: Yanking multi-line pattern matches

2006-09-05 Thread Hari Krishna Dara

On Wed, 6 Sep 2006 at 12:18pm, Druce, Richard wrote:

 I'm trying to select all the text matching a (multi-line) pattern so I
 can put it into a separate document. I thought the global command would
 work but it only copies the first matching line, does anyone know a
 command to do this?

 Cheers,
 Richard.

I don't see any Vim primitives to work with multi-line matches. I think
the searchpos() function should be extended to return the [line, col] of
the end of the match as well. May be I am missing something, but in the
absence of primitives, you can probably write a function which will
try to guess what the matching lines are, something like this (only
partly tested):

function! FindMatchingRange()
function! FindMatchingLines()
  let start = line('.')
  let text = ''
  for end in range(start, line('$'))
let text = text.\n.getline(end)
if text =~ @/
  return start.','.end
  return text
endif
  endfor
  return ''
endfunction

You can use this either use it with :g command, or another function

:let matches=[]
:g/pattern/call add(matches, FindMatchingLines())

you can paste the matches in a new buffer as:

:call append('$', matches)

Read the help on |string-match| for limitations.

-- 
HTH,
Hari

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


RE: Execute something when I enter in a directory

2006-09-05 Thread Sibin P. Thomas
Use 
:se exrc in ur _vimrc file
And then create a _vimrc file local to the directory in question.
Check help for more details.

Regards,
Sibin

-Original Message-
From: Andrea Spadaccini [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 05, 2006 3:17 PM
To: vim@vim.org
Subject: Execute something when I enter in a directory

Hello vimmers,
I'd like to load some settings when I enter in a directory, like for
instance setting makeprg.

Is there a way to do it?
Thanks in advance from a lurker! :)

-- 
[ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
[ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.16 ]
[ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]
-
Disclaimer
-

This message(including attachment if any)is confidential and may be 
privileged.Before opening attachments please check them
for viruses and defects.MindTree Consulting Private Limited (MindTree)will not 
be responsible for any viruses or defects or
any forwarded attachments emanating either from within MindTree or outside.If 
you have received this message by mistake please notify the sender by return  
e-mail and delete this message from your system. Any unauthorized use or 
dissemination of this message in whole or in part is strictly prohibited.  
Please note that e-mails are susceptible to change and MindTree shall not be 
liable for any improper, untimely or incomplete transmission.

-