c89 and c99 filetypes

2006-06-22 Thread Yakov Lerner

Bram,

Following the discussion in vim mailing list, and now that
more C compilers support c99 features, what do you think about
adding two explicit filetypes, c89 and c99, to allow vim scripts
to clearly distinguish between the two distinct flavors of C:

--- file syntax/c89.vim --
 Vim syntax file
 Language: C99 flavor of C (as opposed to C89)

let c_no_c99
runtime c.vim
 file syntax/c99.vim ---
 Vim syntax file
 Language: C89 flavour of C (as opposed to C99)

unlet c_no_c99
runtime c.vim


I am unsure about couple of points:

1) shall variable c_no_c99 be not global but buffer-local ?
   What c.vim checks is global var, is not it ?
2) is addition to filetypes.vim needed ?

Yakov


Re: c89 and c99 filetypes

2006-06-22 Thread Bram Moolenaar

Yakov Lerner wrote:

 Following the discussion in vim mailing list, and now that
 more C compilers support c99 features, what do you think about
 adding two explicit filetypes, c89 and c99, to allow vim scripts
 to clearly distinguish between the two distinct flavors of C:
 
 --- file syntax/c89.vim --
  Vim syntax file
  Language: C99 flavor of C (as opposed to C89)
 
 let c_no_c99
 runtime c.vim
  file syntax/c99.vim ---
  Vim syntax file
  Language: C89 flavour of C (as opposed to C99)
 
 unlet c_no_c99
 runtime c.vim
 
 
 I am unsure about couple of points:
 
 1) shall variable c_no_c99 be not global but buffer-local ?
 What c.vim checks is global var, is not it ?
 2) is addition to filetypes.vim needed ?

I think we should keep the filetype name at C.  Adding variables to
specify what kind of C is fine, but using c89 and c99 as a filetype
name will cause trouble (you would need to triple all plugins that are
related to C).

There might be a way in between: when 'filetype' is set to c89 or
c99 an autocommand or plugin sets the global variable and sets
'filetype' to c.  I haven't seen this used yet, there might very well
be some disadvantages.  At least it would be possible to set the
filetype in a modeline.

-- 
LAUNCELOT: Isn't there a St. Arrggghhh's in Cornwall?
ARTHUR:No, that's Saint Ives.
 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///


Re: c89 and c99 filetypes

2006-06-22 Thread Nikolai Weibull

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


There might be a way in between: when 'filetype' is set to c89 or
c99 an autocommand or plugin sets the global variable and sets
'filetype' to c.  I haven't seen this used yet, there might very well
be some disadvantages.  At least it would be possible to set the
filetype in a modeline.


I like that solution.  It's simple, forces minimal changes, and even
solves the problem!

 nikolai


Patch 7.0.023

2006-06-22 Thread Bram Moolenaar

Patch 7.0.023
Problem:Crash when doing spell completion in an empty line and pressing
CTRL-E.
Solution:   Check for a zero pointer. (James Vega)
Also handle a situation without a matching pattern better, report
No matches instead of remaining in undefined CTRL-X mode.  And
get out of CTRL-X mode when typing a letter.
Files:  src/edit.c


*** ../vim-7.0.022/src/edit.c   Sat May 13 15:27:57 2006
--- src/edit.c  Thu Jun 22 16:44:01 2006
***
*** 719,727 
  #ifdef FEAT_INS_EXPAND
/*
 * Special handling of keys while the popup menu is visible or wanted
!* and the cursor is still in the completed word.
 */
!   if (compl_started  pum_wanted()  curwin-w_cursor.col = compl_col)
{
/* BS: Delete one character from compl_leader. */
if ((c == K_BS || c == Ctrl_H)
--- 721,734 
  #ifdef FEAT_INS_EXPAND
/*
 * Special handling of keys while the popup menu is visible or wanted
!* and the cursor is still in the completed word.  Only when there is
!* a match, skip this when no matches were found.
 */
!   if (compl_started
!pum_wanted()
!curwin-w_cursor.col = compl_col
!(compl_shown_match == NULL
!   || compl_shown_match != compl_shown_match-cp_next))
{
/* BS: Delete one character from compl_leader. */
if ((c == K_BS || c == Ctrl_H)
***
*** 3393,3408 
ptr = compl_leader;
else
ptr = compl_orig_text;
!   p = compl_orig_text;
!   for (temp = 0; p[temp] != NUL  p[temp] == ptr[temp]; ++temp)
!   ;
  #ifdef FEAT_MBYTE
!   if (temp  0)
!   temp -= (*mb_head_off)(compl_orig_text, p + temp);
  #endif
!   for (p += temp; *p != NUL; mb_ptr_adv(p))
!   AppendCharToRedobuff(K_BS);
!   AppendToRedobuffLit(ptr + temp, -1);
}
  
  #ifdef FEAT_CINDENT
--- 3401,3421 
ptr = compl_leader;
else
ptr = compl_orig_text;
!   if (compl_orig_text != NULL)
!   {
!   p = compl_orig_text;
!   for (temp = 0; p[temp] != NUL  p[temp] == ptr[temp];
!  ++temp)
!   ;
  #ifdef FEAT_MBYTE
!   if (temp  0)
!   temp -= (*mb_head_off)(compl_orig_text, p + temp);
  #endif
!   for (p += temp; *p != NUL; mb_ptr_adv(p))
!   AppendCharToRedobuff(K_BS);
!   }
!   if (ptr != NULL)
!   AppendToRedobuffLit(ptr + temp, -1);
}
  
  #ifdef FEAT_CINDENT
***
*** 4650,4659 
 (int)STRLEN(compl_pattern), curs_col);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING)
!   return FAIL;
!   startcol = (int)(compl_xp.xp_pattern - compl_pattern);
!   compl_col = startcol;
!   compl_length = curs_col - startcol;
}
else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
{
--- 4663,4680 
 (int)STRLEN(compl_pattern), curs_col);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING)
!   {
!   compl_col = curs_col;
!   compl_length = 0;
!   vim_free(compl_pattern);
!   compl_pattern = NULL;
!   }
!   else
!   {
!   startcol = (int)(compl_xp.xp_pattern - compl_pattern);
!   compl_col = startcol;
!   compl_length = curs_col - startcol;
!   }
}
else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
{
***
*** 4707,4717 
else
compl_col = spell_word_start(startcol);
if (compl_col = (colnr_T)startcol)
!   return FAIL;
!   spell_expand_check_cap(compl_col);
/* Need to obtain line again, it may have become invalid. */
line = ml_get(curwin-w_cursor.lnum);
-   compl_length = (int)curs_col - compl_col;
compl_pattern = vim_strnsave(line + compl_col, compl_length);
if (compl_pattern == NULL)
  #endif
--- 4728,4744 
else
compl_col = spell_word_start(startcol);
if (compl_col = (colnr_T)startcol)
!   {
!   compl_length = 0;
!   compl_col = curs_col;
!   }
!   else
!   {
!   spell_expand_check_cap(compl_col);
!   

Patch 7.0.024

2006-06-22 Thread Bram Moolenaar

Patch 7.0.024
Problem:It is possible to set arbitrary v: variables.
Solution:   Disallow setting v: variables that are not predefined.
Files:  src/eval.c


*** ../vim-7.0.023/src/eval.c   Sat May 13 13:36:47 2006
--- src/eval.c  Thu Jun 22 17:27:51 2006
***
*** 17759,17764 
--- 17763,17775 
  }
  else  /* add a new variable */
  {
+   /* Can't add v: variable. */
+   if (ht == vimvarht)
+   {
+   EMSG2(_(e_illvar), name);
+   return;
+   }
+ 
/* Make sure the variable name is valid. */
for (p = varname; *p != NUL; ++p)
if (!eval_isnamec1(*p)  (p == varname || !VIM_ISDIGIT(*p))
*** ../vim-7.0.023/src/version.cThu Jun 22 16:48:43 2006
--- src/version.c   Thu Jun 22 17:30:59 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 24,
  /**/

-- 
ARTHUR:  No, hang on!  Just answer the five questions ...
GALAHAD: Three questions ...
ARTHUR:  Three questions ...  And we shall watch ... and pray.
 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.025

2006-06-22 Thread Bram Moolenaar

Patch 7.0.025
Problem:Crash when removing an element of a:000.  (Nikolai Weibull)
Solution:   Mark the a:000 list with VAR_FIXED.
Files:  src/eval.c


*** ../vim-7.0.024/src/eval.c   Thu Jun 22 17:33:49 2006
--- src/eval.c  Thu Jun 22 17:56:50 2006
***
*** 13250,13256 
if (argvars[2].v_type != VAR_UNKNOWN)
EMSG2(_(e_toomanyarg), remove());
else if ((d = argvars[0].vval.v_dict) != NULL
!!tv_check_lock(d-dv_lock, (char_u *)remove()))
{
key = get_tv_string_chk(argvars[1]);
if (key != NULL)
--- 13254,13260 
if (argvars[2].v_type != VAR_UNKNOWN)
EMSG2(_(e_toomanyarg), remove());
else if ((d = argvars[0].vval.v_dict) != NULL
!!tv_check_lock(d-dv_lock, (char_u *)remove() argument))
{
key = get_tv_string_chk(argvars[1]);
if (key != NULL)
***
*** 13270,13276 
  else if (argvars[0].v_type != VAR_LIST)
EMSG2(_(e_listdictarg), remove());
  else if ((l = argvars[0].vval.v_list) != NULL
!!tv_check_lock(l-lv_lock, (char_u *)remove()))
  {
int error = FALSE;
  
--- 13274,13280 
  else if (argvars[0].v_type != VAR_LIST)
EMSG2(_(e_listdictarg), remove());
  else if ((l = argvars[0].vval.v_list) != NULL
!!tv_check_lock(l-lv_lock, (char_u *)remove() argument))
  {
int error = FALSE;
  
***
*** 19693,19698 
--- 19697,19703 
  v-di_tv.vval.v_list = fc.l_varlist;
  vim_memset(fc.l_varlist, 0, sizeof(list_T));
  fc.l_varlist.lv_refcount = 9;
+ fc.l_varlist.lv_lock = VAR_FIXED;
  
  /*
   * Set a:firstline to firstline and a:lastline to lastline.
*** ../vim-7.0.024/src/version.cThu Jun 22 17:33:49 2006
--- src/version.c   Thu Jun 22 17:59:17 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 25,
  /**/

-- 
BRIDGEKEEPER: What is your favorite colour?
GAWAIN:   Blue ...  No yelloww!
 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.028 (extra)

2006-06-22 Thread Bram Moolenaar

Patch 7.0.028 (extra)
Problem:OS/2: Vim doesn't compile with gcc 3.2.1.
Solution:   Add argument to after_pathsep(), don't define vim_handle_signal(),
define HAVE_STDARG_H. (David Sanders)
Files:  src/os_unix.c, src/vim.h, src/os_os2_cfg.h


*** ../vim-7.0.027/src/os_unix.cThu Jun 22 18:06:48 2006
--- src/os_unix.c   Sat Jun 17 21:00:14 2006
***
*** 4971,4977 
if (((*file)[*num_file] = alloc(len + 2)) != NULL)
{
STRCPY((*file)[*num_file], p);
!   if (!after_pathsep((*file)[*num_file] + len))
{
(*file)[*num_file][len] = psepc;
(*file)[*num_file][len + 1] = NUL;
--- 4971,4978 
if (((*file)[*num_file] = alloc(len + 2)) != NULL)
{
STRCPY((*file)[*num_file], p);
!   if (!after_pathsep((*file)[*num_file],
!   (*file)[*num_file] + len))
{
(*file)[*num_file][len] = psepc;
(*file)[*num_file][len + 1] = NUL;
*** ../vim-7.0.027/src/vim.hSun Apr 30 20:27:22 2006
--- src/vim.h   Sat Jun 17 20:59:31 2006
***
*** 1983,1989 
  /* values for vim_handle_signal() that are not a signal */
  #define SIGNAL_BLOCK  -1
  #define SIGNAL_UNBLOCK  -2
! #if !defined(UNIX)  !defined(VMS)
  # define vim_handle_signal(x) 0
  #endif
  
--- 1983,1989 
  /* values for vim_handle_signal() that are not a signal */
  #define SIGNAL_BLOCK  -1
  #define SIGNAL_UNBLOCK  -2
! #if !defined(UNIX)  !defined(VMS)  !defined(OS2)
  # define vim_handle_signal(x) 0
  #endif
  
*** ../vim-7.0.027/src/os_os2_cfg.h Sun Jun 13 18:47:02 2004
--- src/os_os2_cfg.hSat Jun 17 20:58:56 2006
***
*** 183,188 
--- 183,191 
  /* Define if you have the ANSI C header files. */
  /* #undef STDC_HEADERS */
  
+ /* added by David Sanders */
+ #define HAVE_STDARG_H 1
+ 
  /* instead, we check a few STDC things ourselves */
  #define HAVE_STDLIB_H 1
  #undef HAVE_STRING_H  /* On EMX it is better to use strings.h */
*** ../vim-7.0.027/src/version.cThu Jun 22 19:34:23 2006
--- src/version.c   Thu Jun 22 19:41:06 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 28,
  /**/

-- 
BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow?
ARTHUR:   What do you mean?  An African or European swallow?
BRIDGEKEEPER: Er ...  I don't know that ... Arrggghhh!
   BRIDGEKEEPER is cast into the gorge.
 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.030

2006-06-22 Thread Bram Moolenaar

Patch 7.0.030
Problem:The :compiler command can't be used in a FileChangedRO event.
(Hari Krishna Dara)
Solution:   Add the CMDWIN flag to the :compiler command.
Files:  src/ex_cmds.h


*** ../vim-7.0.029/src/ex_cmds.hFri Apr  7 23:40:07 2006
--- src/ex_cmds.h   Sun Jun 18 22:44:01 2006
***
*** 262,268 
  EX(CMD_comclear,  comclear, ex_comclear,
TRLBAR|CMDWIN),
  EX(CMD_compiler,  compiler, ex_compiler,
!   BANG|TRLBAR|WORD1),
  EX(CMD_continue,  continue, ex_continue,
TRLBAR|SBOXOK|CMDWIN),
  EX(CMD_confirm,   confirm,  ex_wrongmodifier,
--- 262,268 
  EX(CMD_comclear,  comclear, ex_comclear,
TRLBAR|CMDWIN),
  EX(CMD_compiler,  compiler, ex_compiler,
!   BANG|TRLBAR|WORD1|CMDWIN),
  EX(CMD_continue,  continue, ex_continue,
TRLBAR|SBOXOK|CMDWIN),
  EX(CMD_confirm,   confirm,  ex_wrongmodifier,
*** ../vim-7.0.029/src/version.cThu Jun 22 21:01:19 2006
--- src/version.c   Thu Jun 22 21:08:12 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 30,
  /**/

-- 
Every person is responsible for the choices he makes.

 /// 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 to try out for Perl interface

2006-06-22 Thread Bram Moolenaar

Just like Ruby the Perl interface has some code that changes another
buffer and doesn't do this properly.  I made a patch for this, but since
the if_perl.xs file is magically transformed into if_perl.c I ran into
the problem that the #ifdef's don't work normally.  I solved this by
putting a tab before the #.  I'm not sure if this works everywhere where
Perl is supported.

Please try this out and let me know if this works or not.  You need to
enable the Perl interface for this.  I suppose that if Vim compiles it
will work, but you might try out a few Vim-Perl commands to be sure.


*** ../vim-7.0.030/src/if_perl.xs   Tue Mar  7 00:18:16 2006
--- src/if_perl.xs  Thu Jun 22 21:22:18 2006
***
*** 1056,1062 
  int i;
  long lnum;
  char *line;
- buf_T *savebuf;
  PPCODE:
  if (buf_valid(vimbuf))
  {
--- 1056,1061 
***
*** 1069,1082 
line = SvPV(ST(i),PL_na);
if (lnum  0  lnum = vimbuf-b_ml.ml_line_count  line != NULL)
{
!   savebuf = curbuf;
curbuf = vimbuf;
if (u_savesub(lnum) == OK)
{
ml_replace(lnum, (char_u *)line, TRUE);
changed_bytes(lnum, 0);
}
!   curbuf = savebuf;
}
}
  }
--- 1068,1098 
line = SvPV(ST(i),PL_na);
if (lnum  0  lnum = vimbuf-b_ml.ml_line_count  line != NULL)
{
! #ifdef FEAT_AUTOCMD
!   aco_save_T  aco;
! 
!   /* set curwin/curbuf for vimbuf and save some things */
!   aucmd_prepbuf(aco, vimbuf);
! #else
!   buf_T   *save_curbuf = curbuf;
! 
curbuf = vimbuf;
+   curwin-w_buffer = vimbuf;
+ #endif
if (u_savesub(lnum) == OK)
{
ml_replace(lnum, (char_u *)line, TRUE);
changed_bytes(lnum, 0);
}
! 
! #ifdef FEAT_AUTOCMD
!   /* restore curwin/curbuf and a few other things */
!   aucmd_restbuf(aco);
!   /* Careful: autocommands may have made vimbuf invalid! */
! #else
!   curwin-w_buffer = save_curbuf;
!   curbuf = save_curbuf;
! #endif
}
}
  }
***
*** 1087,1093 
  
  PREINIT:
  long i, lnum = 0, count = 0;
- buf_T *savebuf;
  PPCODE:
  if (buf_valid(vimbuf))
  {
--- 1103,1108 
***
*** 1114,1129 
{
if (lnum  0  lnum = vimbuf-b_ml.ml_line_count)
{
!   savebuf = curbuf;
curbuf = vimbuf;
if (u_savedel(lnum, 1) == OK)
{
ml_delete(lnum, 0);
deleted_lines_mark(lnum, 1L);
!   if (savebuf == curbuf)
check_cursor();
}
!   curbuf = savebuf;
update_curbuf(VALID);
}
}
--- 1129,1159 
{
if (lnum  0  lnum = vimbuf-b_ml.ml_line_count)
{
!   buf_T   *save_curbuf = curbuf;
! #ifdef FEAT_AUTOCMD
!   aco_save_T  aco;
! 
!   /* set curwin/curbuf for vimbuf and save some things */
!   aucmd_prepbuf(aco, vimbuf);
! #else
curbuf = vimbuf;
+   curwin-w_buffer = vimbuf;
+ #endif
if (u_savedel(lnum, 1) == OK)
{
ml_delete(lnum, 0);
deleted_lines_mark(lnum, 1L);
!   if (save_curbuf == curbuf)
check_cursor();
}
! #ifdef FEAT_AUTOCMD
!   /* restore curwin/curbuf and a few other things */
!   aucmd_restbuf(aco);
!   /* Careful: autocommands may have made vimbuf invalid! */
! #else
!   curwin-w_buffer = save_curbuf;
!   curbuf = save_curbuf;
! #endif
update_curbuf(VALID);
}
}
***
*** 1138,1144 
  int   i;
  long  lnum;
  char  *line;
- buf_T *savebuf;
  PPCODE:
  if (buf_valid(vimbuf))
  {
--- 1168,1173 
***
*** 1151,1164 
line = SvPV(ST(i),PL_na);
if (lnum = 0  lnum = vimbuf-b_ml.ml_line_count  line != NULL)
{
!   savebuf = curbuf;
curbuf = vimbuf;
if (u_inssub(lnum + 1) == OK)
{
ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
appended_lines_mark(lnum, 1L);
}
!   curbuf = savebuf;

Re: broken runtimes in ftp

2006-06-22 Thread A.J.Mechelynck

Steve Hall wrote:

I just noticed four broken runtime files in ftp.vim.org:

  runtime/filetype.vim
  runtime/autoload/paste.vim
  runtime/plugin/netrwPlugin.vim
  runtime/plugin/vimballPlugin.vim

Each has a few stray partial duplicate lines at the end.




I don't notice any stray duplicate lines there. How do they look to you?


Best regards,
Tony.


Re: broken runtimes in ftp

2006-06-22 Thread Steve Hall
On Fri, 2006-06-23 at 00:27 +0200, A.J.Mechelynck wrote:
 Steve Hall wrote:
  I just noticed four broken runtime files in ftp.vim.org:
  
runtime/filetype.vim
runtime/autoload/paste.vim
runtime/plugin/netrwPlugin.vim
runtime/plugin/vimballPlugin.vim
  
  Each has a few stray partial duplicate lines at the end.
 
 I don't notice any stray duplicate lines there. How do they look
 to you?

Very odd, I don't see it now. The current files are dated prior to
today, but I double-checked the error with both wget and web browser.
That was a Windows box, but now I don't see it here on Linux.


-- 
Steve Hall  [ digitect mindspring com ]



Network access from vim

2006-06-22 Thread Stewart Johnson

Hey all --

I looked through the vim FAQ/help but wasn't able to find any
information about network access from within vim, so I thought I'd ask
about it here.

I want to initiate commands from within vim to access a specific
server for information -- a TCP/IP connection, probably a HTTP query
on top of that. Is this possible from within vim, or do I need to use
the system function to call some helper app on the host operating
system?

If I have to use a helper app, what's the best way to detect and act
on the operating system environment.

Thanks,
Stewart


Re: Network access from vim

2006-06-22 Thread A.J.Mechelynck

Stewart Johnson wrote:

Hey all --

I looked through the vim FAQ/help but wasn't able to find any
information about network access from within vim, so I thought I'd ask
about it here.

I want to initiate commands from within vim to access a specific
server for information -- a TCP/IP connection, probably a HTTP query
on top of that. Is this possible from within vim, or do I need to use
the system function to call some helper app on the host operating
system?

If I have to use a helper app, what's the best way to detect and act
on the operating system environment.

Thanks,
Stewart




From within Vim, use

:help pi_netrw.txt


HTH,
Tony.


Re: Network access from vim

2006-06-22 Thread Stewart Johnson

Thanks Tony. I looked at that, but it doesn't support generic TCP
sockets, nor does it support HTTP writing. I need to be able send and
receive information with a remote service, and netrw only does half
the job.

Does the client-server stuff in vim use TCP sockets? Is that API
available to scripts?

Thanks,
Stewart


On 6/22/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Stewart Johnson wrote:
 Hey all --

 I looked through the vim FAQ/help but wasn't able to find any
 information about network access from within vim, so I thought I'd ask
 about it here.

 I want to initiate commands from within vim to access a specific
 server for information -- a TCP/IP connection, probably a HTTP query
 on top of that. Is this possible from within vim, or do I need to use
 the system function to call some helper app on the host operating
 system?

 If I have to use a helper app, what's the best way to detect and act
 on the operating system environment.

 Thanks,
 Stewart



 From within Vim, use

:help pi_netrw.txt


HTH,
Tony.



Re: clipboard + unnamed register under X11

2006-06-22 Thread Neil Bird

Around about 22/06/06 06:09, George V. Reilly typed ...
On Windows, I've long been used to having clipboard=unnamed, which 
ensures that all deletes, yanks, and puts go to or come from the 
clipboard by default.
Is it possible to achieve this effect under X? I keep forgetting to 
prefix commands with +, which is awkward to type. I'd prefer not to 
remap a ton of commands.


  It doesn't look like it, although I'd swear it had made it in at some 
point.  Doesn't look like there's an appropriate autocmd you could use to 
monitor the registers changing, either (to do 'let @[EMAIL PROTECTED]').



  Does this warrant a new option, Bram?  Possibly a new 'clipboard' option, 
which would have to be X11-only.


--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit


Lisp indent help and copy/paste problem?

2006-06-22 Thread Pero Brbora

I wan ma lisp code to be indented like this

(defun ()
)

but vim gives me

(defun ()
  )

How do I change this?

About copy/paste problem...
Vim pastes text in before current text like this

current textcursorctrl-v
---
pasted textcursor
current text

OS: Windows 2000
Vim: 6.4

Thanks, bye.

_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




after :vert sba hide all windows again except the active on

2006-06-22 Thread Johannes Schwarz
I just realized the :sba   or even better the  :vert sba   command.

Is it possible to hide all windows again except the active one, which
the cursor is in?

And another question:
When I set the all windows to scrollbind and make jump to a special
line, I want each window to show that line and not the offset to the
original line.
One solution is to do  :windo normal gg  and then  :windo set
scrollbind   but is there an easier way?




Re: how to detect c99 vs c89 (//-comments vs /*-comments)

2006-06-22 Thread Marc Weber
 Then you can use plugins like project.vim or local_vimrc.vim
 With local_vimrc.vim (I know 2 very similar plugins with this name, I'm
 maintaining one of them), add a _vimrc_local.vim (the filename expected

I couldn't find them.. I've implemented something similar which loads a
current working directory vimrc but saves it in .vim/vimrcs/ .. using a
simple hash function which just removes the / \\ characters ;)

Another option would be to use autocommands.. instead of modlines

au pathtoproject *.c set ft=c89
Which is used by project plugins anyway.. This way you can't forget to
add the modline..

Marc


Re: after :vert sba hide all windows again except the active on

2006-06-22 Thread A.J.Mechelynck

Johannes Schwarz wrote:

I just realized the :sba   or even better the  :vert sba   command.

Is it possible to hide all windows again except the active one, which
the cursor is in?


Method 1: To close all windows except the current one:

:only

Method 2: To squash all non-current windows to their status line and 
nothing else:


:set noequalalways winminheight=0 winheight=



And another question:
When I set the all windows to scrollbind and make jump to a special
line, I want each window to show that line and not the offset to the
original line.


'scrollbind' is to have several windows, which may or may not show the 
same file, to move up and down by the same amount. You would normally 
set 'scrollbind' once the windows are synchronised to corresponding 
lines, which may or may not be at the same position in their respective 
files.



One solution is to do  :windo normal gg  and then  :windo set
scrollbind   but is there an easier way?






If there is some particular data for which you can search all files to 
synchronise them, you can do


:silent windo normal /pattern/
:windo normal z.
:windo setlocal scrollbind

or on a single line

	:exe silent windo normal /pattern/ | exe windo normal z. | windo 
setlocal scrollbind


(in this last example, disregard any line breaks added by my mailer or 
by yours.)




Best regards,
Tony.


Visual in block mode under windows

2006-06-22 Thread Chris Cooke
Hi,

Long time lurker first time poster :)

Under windows when I try and use blockwise selection Ctl-v it just pastes
whatever is in the windows clipboard. Is there a way around this?

Thanks in advance,

-- 
Christopher Cooke


Re: how to detect c99 vs c89 (//-comments vs /*-comments)

2006-06-22 Thread hermitte
Hello,

Marc Weber [EMAIL PROTECTED] wrote:

  Then you can use plugins like project.vim or local_vimrc.vim
  With local_vimrc.vim (I know 2 very similar plugins with this name, I'm
  maintaining one of them), add a _vimrc_local.vim (the filename expected

 I couldn't find them.. I've implemented something similar which loads a
 current working directory vimrc but saves it in .vim/vimrcs/ .. using a
 simple hash function which just removes the / \\ characters ;)

Both should be on sourceforge. Mine can be downloaded
from http://www.vim.org/scripts/script.php?script_id=727
and http://hermitte.free.fr/vim/ressources/vimfiles/plugin/local_vimrc.vim

(Once again, it seems I forgot to upload the lastest stable version :-( )


 Another option would be to use autocommands.. instead of modlines

 au pathtoproject *.c set ft=c89

I'm not very fond of that kind of artificial filetypes. Mainly because it has
side effects with plugins that hardcode their behaviours according to the
current filetype. I remember a plugins that do such things ; even if we can
tune those 2-3 plugins to tell that we want to use the same behaviour as the
one binded to another filetype. It's no big deal. But it is something we must
not forget. It can be done with the forwarding ftplugin (the one that sets the
comment characters, and that sources c ftplugins).


--
Luc Hermitte


Re: Visual in block mode under windows

2006-06-22 Thread A.J.Mechelynck

Chris Cooke wrote:

Hi,

Long time lurker first time poster :)

Under windows when I try and use blockwise selection Ctl-v it just pastes
whatever is in the windows clipboard. Is there a way around this?

Thanks in advance,



Whenever Ctrl-V does a paste, the classical functionality of Ctrl-V is 
taken over by Ctrl-Q


See :help CTRL-V-alternative


Best regards,
Tony.


RE: after :vert sba hide all windows again except the active on

2006-06-22 Thread Jansen of Lorkeers, Richard
Hello,

I am a beginning user of vim and I just tried to create a .vimrc file. It is
oke when I use 1 command but if I use two commands I get a error. Any one
knows what the problem is. I can't find it in the documentation and neither
in the example.

Richard


Re: after :vert sba hide all windows again except the active on

2006-06-22 Thread Johannes Schwarz


 Jürgen Krämer [EMAIL PROTECTED] 22.06.2006 10:22 


Hi,

Johannes Schwarz wrote:

 I just realized the :sba   or even better the  :vert sba   command.
 
 Is it possible to hide all windows again except the active one, which
 the cursor is in?

have a look at

  :help :only

This is exactly what I was looking for.

 And another question:
 When I set the all windows to scrollbind and make jump to a special
 line, I want each window to show that line and not the offset to the
 original line.
 One solution is to do  :windo normal gg  and then  :windo set
 scrollbind   but is there an easier way?

Does

  :set scrollopt+=jump

help?

No, it still jumps only to the offset of the original line, but I can live with 
:window normal gg

Thanx a lot for your help

Ciao

Johannes




Re: vim7: redir not working inside -complete=custom function

2006-06-22 Thread Bram Moolenaar

Hari Krishna Dara wrote:

 On Tue, 20 Jun 2006 at 8:49pm, Bram Moolenaar wrote:
 
  Please dig into this a bit more.  GetVimCmdOutput() is a long function,
  what part of it doesn't work?The :redir command is allowed in the
  sandbox.Again, set 'verbose' to possibly see an error message.  And/or
  add some echomsg commands to find out what is happening.

Sorry, I was wrong.  The :redir command is NOT allowed in the sandbox.
But the sandbox isn't involved here.

I did a bit of debugging, and the :redir command appears to work fine.
This is taking too much of my time, I'll add a remark to the todo list.

-- 
User:   I'm having problems with my text editor.
Help desk:  Which editor are you using?
User:   I don't know, but it's version VI (pronounced: 6).
Help desk:  Oh, then you should upgrade to version VIM (pronounced: 994).

 /// 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: Network access from vim

2006-06-22 Thread Marc Weber
 Upon closer inspection, netrw delegates network activity to
 wget/fetch/rsync and friends anyway, so I guess I'll do the same. It's
 given me some direction on how to handle different operatings systems
 -- 'if has(win32)' etc. It's not a robust solution, but we work
 within our confines, right? :-)

I didn't get exactly what you are trying to do .. but you have the
option to use python, ruby  
from python you can call any C function.. So it should no problem to
create a TCP connection.. ;-)

Marc


Re: using vimrc

2006-06-22 Thread Yakov Lerner

On 6/22/06, Jansen of Lorkeers, Richard
[EMAIL PROTECTED] wrote:

Hello,

I am a beginning user of vim and I just tried to create a .vimrc file. It is
oke when I use 1 command but if I use two commands I get a error. Any one
knows what the problem is. I can't find it in the documentation and neither
in the example.


You need to include those 2 commands that cause error.

Yakov


Re: Network access from vim

2006-06-22 Thread Stewart Johnson

On 6/22/06, Marc Weber [EMAIL PROTECTED] wrote:

 Upon closer inspection, netrw delegates network activity to
 wget/fetch/rsync and friends anyway, so I guess I'll do the same. It's
 given me some direction on how to handle different operatings systems
 -- 'if has(win32)' etc. It's not a robust solution, but we work
 within our confines, right? :-)

I didn't get exactly what you are trying to do .. but you have the
option to use python, ruby 
from python you can call any C function.. So it should no problem to
create a TCP connection.. ;-)


Wait, what? I can access python and ruby from within a vim script?

What I'm trying to do is to write a vim script that will take some
information from the current open buffer, send it to a web service,
receive information back from the webservice, and display it in the
vim buffer (and another buffer). Everything I need is available in vim
scripting, apart from being able make HTTP POSTs to webservices.

It looks like I can't make an arbitrary TCP connection from within vim
(please correct me if I'm wrong!) so I'll need to use the system()
function in my vim script to do that (like netrw does). And since I
want it to be cross-platform, I'll need to do a bunch of operating
system snooping to figure out what I can use to make the network
access.

Stewart


Re: What might cause .vimrc not to be read

2006-06-22 Thread Yakov Lerner

On 6/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:

 What on earth is that all about.  It doesn't appear to ever look for
 ~/.vimrc.

 I suggest that you build vim from sources.

Ok, I tried that and I must say the new vim download pages are nice
and the new aap tool does the work.

However once I've run `aap install' and get a new vim in /usr/local/bin
then start it up I get exactly the same behavior as before.


1. Check your env. var. $VIMINIT.
If VIMINIT is set, vim will skip ~/.vimrc

2.
Now that you have vim source, you can do this check:

a. cd vim7/src. Add the printf-getchar line as in patch below, to main.c
b. make (don';t do make install)
c. run ./vim
d. Do you get this message that I get when you run './vim' ?
 before sourcing .vimrc($HOME/.vimrc). Press Enter.

Yakov

patch to src/main.c

--- main.c.000
+++ main.c
@@ -2624,6 +2624,7 @@
*/
   if (process_env((char_u *)VIMINIT, TRUE) != OK)
   {
+printf(before sourcing .vimrc(%s). Press Enter.\n, USR_VIMRC_FILE);
getchar();
   if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC) == FAIL
#ifdef USR_VIMRC_FILE2
do_source((char_u *)USR_VIMRC_FILE2, TRUE,


Yakov


Re: What might cause .vimrc not to be read

2006-06-22 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 Marc Weber [EMAIL PROTECTED] writes:
 
 No idea what might cause this but you might try
  * adding alias gvim=gvim -c source ~/.vimrc 
 
 I'm not using gvim.  I work in X at home machine but even then I use
 vim.   But a lot of what I do is from a bash cmdline on remote
 machines. 
 
 
 This: alias vim=vim -c source ~/.vimrc
 
  doesn't work here... fails like this when I start vim after sourcing
  .bashrc
 
  Error detected while processing command line:
  E471: Argument required

try

  alias vim=vim -c 'source ~/.vimrc'

instead.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: No-echo for shell command from vim.

2006-06-22 Thread Gerald Lai

On Thu, 22 Jun 2006, Ajay Gupta wrote:


(Re-sending because it didnt appear the first time)

Hello all.

I have included the following function in my .vimrc:

function! CScope_Refresh()
 set nocsverb
 cs kill 0
   Following find searches for .c and .h files
 !find $PWD -name \*.[ch]  files  cscope -b -i files
   This one searches for cpp files as well.
   !find $PWD| grep [\\.p][chp]$  files  cscope -b -i files
 cs add .
 set csverb
endfunction

The problem is that when I execute this function (thru some shortcut
key), after 'find' the shell waits for me to press 'Enter' to
continue. I just want to return to vim to where I was (Lets assume
that the command always succeeds).

Is there anything I can do to effect this?


Append silent in front of ! as in

  silent !find $PWD -name \*.[ch]  files  cscope -b -i files

See

  :help :silent

HTH.
--
Gerald


Re: after :vert sba hide all windows again except the active on

2006-06-22 Thread Gerald Lai

On Thu, 22 Jun 2006, Johannes Schwarz wrote:





J?rgen Kr?mer [EMAIL PROTECTED] 22.06.2006 10:22 




Hi,



Johannes Schwarz wrote:



I just realized the :sba   or even better the  :vert sba   command.

Is it possible to hide all windows again except the active one, which
the cursor is in?



have a look at



 :help :only


This is exactly what I was looking for.

[snip]

I believe ZoomWin would also do what you want:

  http://www.vim.org/scripts/script.php?script_id=508

HTH.
--
Gerald

Re: Bug in chaining dictionary function calls

2006-06-22 Thread Richard Emberson

I reported this as bug number 1492165,
https://sourceforge.net/tracker/?atid=391887group_id=27891func=browse

Hari Krishna Dara wrote:

I found a problem with chaining function calls through the new
dictionary functions. Here is some code demonstrate the problem, if you
execute this code, the last line generates an E488 error, where as the
previous lines combines (they are equivalent) works fine.

let tt = {}
function! tt.TT()
  echomsg 'This is TT'
endfunction

let t = {'tt': tt}
function t.T()
  return self.tt
endfunction

let tmptt = t.T()
call tmptt.TT()
call t.T().TT()




--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Re: No-echo for shell command from vim.

2006-06-22 Thread Ajay Gupta

Thanks Gerald. It worked.

However, after the command returns the complete screen gets erased. It
gets repainted either using Ctrl+L or pgUp+pgDown several times. Can I
automate this?

thanks and regards
Ajay

On 6/22/06, Gerald Lai [EMAIL PROTECTED] wrote:

On Thu, 22 Jun 2006, Ajay Gupta wrote:

 (Re-sending because it didnt appear the first time)

 Hello all.

 I have included the following function in my .vimrc:

 function! CScope_Refresh()
  set nocsverb
  cs kill 0
Following find searches for .c and .h files
  !find $PWD -name \*.[ch]  files  cscope -b -i files
This one searches for cpp files as well.
!find $PWD| grep [\\.p][chp]$  files  cscope -b -i files
  cs add .
  set csverb
 endfunction

 The problem is that when I execute this function (thru some shortcut
 key), after 'find' the shell waits for me to press 'Enter' to
 continue. I just want to return to vim to where I was (Lets assume
 that the command always succeeds).

 Is there anything I can do to effect this?

Append silent in front of ! as in

   silent !find $PWD -name \*.[ch]  files  cscope -b -i files

See

   :help :silent

HTH.
--
Gerald



Re: Bug in chaining dictionary function calls

2006-06-22 Thread Richard Emberson

Bram Moolenaar wrote:

Hari Krishna Dara wrote:


I found a problem with chaining function calls through the new
dictionary functions. Here is some code demonstrate the problem, if you
execute this code, the last line generates an E488 error, where as the
previous lines combines (they are equivalent) works fine.

let tt = {}
function! tt.TT()
  echomsg 'This is TT'
endfunction

let t = {'tt': tt}
function t.T()
  return self.tt
endfunction

let tmptt = t.T()
call tmptt.TT()
call t.T().TT()


You cannot call a function in the LHS of an assignment.



Forgive me, but which statement is not legal?
Thanks.

Richard

--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


RE: Printing with linebreak

2006-06-22 Thread Java Bob
Thanks Jürgen, but your reply does not help.

Your solution
  :set printoptions+=wrap:y

is equivalent to
  :set wrap


I am still looking for something like
 :set linebreak

The problem is th
at my words are b
eing wrapped in t
heir middle!!!


Hi,

Java Bob wrote:

 I am new to Vim but I am already fairly comfortable with navigation within
 VIm.  I am mainly using XP and need a general purpose editor and an IDE
for
 C++, Java and web pages.  I have two main issues.

 When printing, my words are being cut-up on line-wraps.  Is there
something
 like :set linebreak which applies to hardcopies?

  :set printoptions+=wrap:y

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)





unsuscribe

2006-06-22 Thread marcelo
Excuse this OT. But I can't unsubscribe to this list. When I try the ezmlm
response says that i'm not in the mailing list. I tried the
[EMAIL PROTECTED] and got no response. I need to unsubscribe for a
while in this list. Thanks.
 Marcelo




Re: Printing with linebreak

2006-06-22 Thread Mike Williams

Java Bob did utter on 22/06/2006 15:00:

Thanks Jürgen, but your reply does not help.

Your solution
  :set printoptions+=wrap:y

is equivalent to
  :set wrap


I am still looking for something like
 :set linebreak

The problem is th
at my words are b
eing wrapped in t
heir middle!!!


hardcopy does not do linebreak.  It is on the todo list I believe.

Mike
--
Ghosts love music - especially haunting melodies!



Re: unsuscribe

2006-06-22 Thread Charles E Campbell Jr

marcelo wrote:


Excuse this OT. But I can't unsubscribe to this list. When I try the ezmlm
response says that i'm not in the mailing list. I tried the
[EMAIL PROTECTED] and got no response. I need to unsubscribe for a
while in this list. Thanks.
 

This problem has come up before!  Vim's mailing list resembles Hotel 
California (well, that's an allusion to the song by the Eagles) -- you 
can join but you can never leave!  :O


More seriously, as I understand it, the list is operating under 
no-human-maintenance (its been called little human maintenance, but 
that usually translates to no...).  Also, I believe I've heard rumors 
that there's a (lukewarm?) search for a new mailing list home underway.  
Anyway, all I'm doing is compending the rumors.  Does anyone have the 
real status on the search?


Regards,
Chip Campbell




RE: Printing with linebreak

2006-06-22 Thread Java Bob
Thanks Mike.  Just been to 
  :help todo

and I can see it scored at 8 which means due for next release.

Thanks again.






hardcopy does not do linebreak.  It is on the todo list I believe.

Mike
-- 
Ghosts love music - especially haunting melodies!





Re: Network access from vim

2006-06-22 Thread A.J.Mechelynck

Stewart Johnson wrote:

On 6/22/06, Marc Weber [EMAIL PROTECTED] wrote:

 Upon closer inspection, netrw delegates network activity to
 wget/fetch/rsync and friends anyway, so I guess I'll do the same. It's
 given me some direction on how to handle different operatings systems
 -- 'if has(win32)' etc. It's not a robust solution, but we work
 within our confines, right? :-)

I didn't get exactly what you are trying to do .. but you have the
option to use python, ruby 
from python you can call any C function.. So it should no problem to
create a TCP connection.. ;-)


Wait, what? I can access python and ruby from within a vim script?


Yes, if your version of Vim has been compiled for it. Until Vim version 
6, four interpreted languages were supported, and a fifth one has been 
added at version 7. Check the ouput of the :version command for:


+mzscheme or -mzscheme (version 7 only)
+perl or -perl
+python or -python
+ruby or -ruby
+tcl or -tcl

You can also access these individually through the has() function. For 
instance, in a Vim version compiled with perl support,


:echo has(perl)

answers 1. (A zero value means no.)



What I'm trying to do is to write a vim script that will take some
information from the current open buffer, send it to a web service,
receive information back from the webservice, and display it in the
vim buffer (and another buffer). Everything I need is available in vim
scripting, apart from being able make HTTP POSTs to webservices.

It looks like I can't make an arbitrary TCP connection from within vim
(please correct me if I'm wrong!) so I'll need to use the system()
function in my vim script to do that (like netrw does). And since I
want it to be cross-platform, I'll need to do a bunch of operating
system snooping to figure out what I can use to make the network
access.

Stewart




Best regards,
Tony.


Re: unsuscribe

2006-06-22 Thread Russell Bateman

Well, if I can't get off the list, at least, please bring me my wine!

;-)



Charles E Campbell Jr wrote:

marcelo wrote:

Excuse this OT. But I can't unsubscribe to this list. When I try the 
ezmlm

response says that i'm not in the mailing list. I tried the
[EMAIL PROTECTED] and got no response. I need to unsubscribe 
for a

while in this list. Thanks.
 

This problem has come up before!  Vim's mailing list resembles Hotel 
California (well, that's an allusion to the song by the Eagles) -- 
you can join but you can never leave!  :O


More seriously, as I understand it, the list is operating under 
no-human-maintenance (its been called little human maintenance, but 
that usually translates to no...).  Also, I believe I've heard 
rumors that there's a (lukewarm?) search for a new mailing list home 
underway.  Anyway, all I'm doing is compending the rumors.  Does 
anyone have the real status on the search?


Regards,
Chip Campbell








Re: No-echo for shell command from vim.

2006-06-22 Thread Yakov Lerner

On 6/22/06, Ajay Gupta [EMAIL PROTECTED] wrote:

Thanks Gerald. It worked.

However, after the command returns the complete screen gets erased. It
gets repainted either using Ctrl+L or pgUp+pgDown several times. Can I
automate this?


You need to add :redraw after the 'silent !cmd'. The need for :redraw
(or manual Ctrl-L) after ':silent !cmd' is documented.

Yakov


Re: line wrap

2006-06-22 Thread Yakov Lerner

On 6/22/06, Jean-Luc Menut [EMAIL PROTECTED] wrote:

With Vim, when the line wrap is on (set wrap), is it possible to have
something showing that the next line is the continuation of the previous
one (as done by emacs) and not an another line ?


What Jürgen said, and also
   :set nu
also makes it clear which line is continuation line and which is not.

Yakov


Extra spaces after reformatting.

2006-06-22 Thread ChengHsin Hsu

Hi Experts,

I recently start using vim for writing tex files. I found that an  
extra space is always added between lines after reformatting (e.g.,  
gq}).


For example:
Original text:
a...b
c...d
d...e

Reformatted text:
a...b c...d d...e

Is there an option that I can override this behavior?
Thanks!

Regards,
Cheng


Re: after :vert sba hide all windows again except the active on

2006-06-22 Thread A.J.Mechelynck

Jansen of Lorkeers, Richard wrote:

Hello,

I am a beginning user of vim and I just tried to create a .vimrc file. It is
oke when I use 1 command but if I use two commands I get a error. Any one
knows what the problem is. I can't find it in the documentation and neither
in the example.

Richard




For :set and friends, omit the verb:

:set nobackup writebackup

For most commands, separate them with a | bar:

:if tenc ==  | let tenc = enc | endif | set enc=utf-8

Some commands see the bar as part of their arguments, see :help :bar. 
If you still want to use another command on the same line, wrap the 
first one in an :exe[cute] command (see :help :exe).


In most cases though, one command per line is the way to go:

-8 ~/.vimrc -
set nocompatible
if has(multi_lang)
  if has(unix)
language messages C
  else
language messages en
  endif
endif
runtime vimrc_example.vim
filetype indent off
set autowriteall nobackup writebackup
if has(wildmenu)
  set wildmenu
endif
if has(gui_running)
  if has(gui_gtk2)
set guifont=BH\ LucidaTypewriter\ 12
  elseif has(gui_kde)
set guifont=BH\ LucidaTypewriter/12
  elseif has(x11)
set guifont=*-lucidatypewriter-medium-r-normal-*-*-160-*-*-m-*-*
  else
set guifont=Lucida_Console:h12:cDEFAULT
  endif
  winpos 0 0
  set lines= columns=
endif
if has(multi_byte)
  if termencoding == 
let termencoding = encoding
  endif
  set encoding=utf-8
endif
-8-
etc.


Best regards,
Tony.


Re: Extra spaces after reformatting.

2006-06-22 Thread Jürgen Krämer

Hi,

ChengHsin Hsu wrote:
 
 I recently start using vim for writing tex files. I found that an  
 extra space is always added between lines after reformatting (e.g.,  
 gq}).
 
 For example:
 Original text:
 a...b
 c...d
 d...e
 
 Reformatted text:
 a...b c...d d...e
 
 Is there an option that I can override this behavior?

I don't think so, but you might want to give

  v}gJgqip

a try. The v}gJ first joins the text from the cursor position up to
the end of the current paragraph into one line without inserting spaces.
Then gqip reformats the whole paragraph.

But guessing from your e-mail address: do you need this behaviour for
writing chinese texts? If so then you should have a look at the flags
'B' and 'M' of the formatoptions option (see :help formatoptions and
:help fo-table). Perhaps they are more appropriate.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Visual in block mode under windows

2006-06-22 Thread A.J.Mechelynck

Chris Cooke wrote:

On Thu, Jun 22, 2006 at 11:24:12AM +0200, A.J.Mechelynck wrote:

Chris Cooke wrote:

Hi,

Long time lurker first time poster :)

Under windows when I try and use blockwise selection Ctl-v it just pastes
whatever is in the windows clipboard. Is there a way around this?

Thanks in advance,

Whenever Ctrl-V does a paste, the classical functionality of Ctrl-V is 
taken over by Ctrl-Q


See :help CTRL-V-alternative


Thats fantastic thanks!



My pleasure.

Another possibility is to check your vimrc for a line containing one of

source $VIMRUNTIME/mswin.vim
runtime mswin.vim

and to remove it. The mswin.vim script boasts that it makes Vim easier 
for Windows users. IMHO, what it really does is cripple Vim functionality.


See
:help mswin.vim
:help :behave
:view $VIMRUNTIME/mswin.vim


Best regards,
Tony.


Re: Extra spaces after reformatting.

2006-06-22 Thread Marc Weber
 For example:
 Original text:
 a...b
 c...d
 d...e
 
 Reformatted text:
 a...b c...d d...e
 
 Is there an option that I can override this behavior?
I don't know.. There are M and B options (see :h fo-table but they
didn't have the desired effect..)

Perhaps you can also use :','s/\n// ?
What do you want vim to do exactly?
Another option: write a program and set formatprg..

Marc


Re: Extra spaces after reformatting.

2006-06-22 Thread Tim Chase
I recently start using vim for writing tex files. I found that an  
extra space is always added between lines after reformatting (e.g.,  
gq}).


For example:
Original text:
a...b
c...d
d...e

Reformatted text:
a...b c...d d...e

Is there an option that I can override this behavior?


The short answer is no, there is no such option.  A space is 
semantically a place that can be squished or broken when 
reformatting.  It sounds like you want a non-breaking-space for 
some reason.  As this is tex code, according to a quick google on 
the matter, it looks like tex uses a tilde (~) as its 
non-breaking space character.  If the spaces are significant, you 
may want to change them to


a~~~b
c~~~d
d~~~e

(This is a shot-from-the-hip, as I know nothing about tex other 
than what I saw in the google results)


Alternatively, you can use some character that you're not 
otherwise using and do a decorate/operate/undecorate sequence, 
such as


:','s/ /_/g

then do your reformatting:

gq}

then reselect the text and remove those changes:

:','s/_/ /g

You would have to choose some character that wasn't already in 
use within that range...and perhaps might need to add that 
character to the 'iskeyword' collection so that it doesn't get 
treated as a breakable character.


If you're just joining the lines, rather than reflowing the 
lines, you can highlight the range and use J to join them, or 
you can (if you've previously selected the lines in question) use


:','j

Just a few ideas to try and help you along...

-tim





Re: No-echo for shell command from vim.

2006-06-22 Thread Ajay Gupta

But it does not what its supposed to do! Even after putting 'redraw'
after shell command, the screen is not redrawn. Does it have something
to do with the type of term I am using?

thanks and regards
Ajay



On 6/22/06, Yakov Lerner [EMAIL PROTECTED] wrote:

On 6/22/06, Ajay Gupta [EMAIL PROTECTED] wrote:
 Thanks Gerald. It worked.

 However, after the command returns the complete screen gets erased. It
 gets repainted either using Ctrl+L or pgUp+pgDown several times. Can I
 automate this?

You need to add :redraw after the 'silent !cmd'. The need for :redraw
(or manual Ctrl-L) after ':silent !cmd' is documented.

Yakov



Re: Network access from vim

2006-06-22 Thread Stewart Johnson

On 6/22/06, Tom Purl [EMAIL PROTECTED] wrote:

 On 6/22/06, Marc Weber [EMAIL PROTECTED] wrote:
  Upon closer inspection, netrw delegates network activity to
  wget/fetch/rsync and friends anyway, so I guess I'll do the same. It's
  given me some direction on how to handle different operatings systems
  -- 'if has(win32)' etc. It's not a robust solution, but we work
  within our confines, right? :-)

 I didn't get exactly what you are trying to do .. but you have the
 option to use python, ruby 
 from python you can call any C function.. So it should no problem to
 create a TCP connection.. ;-)

 Wait, what? I can access python and ruby from within a vim script?

Here's another resource for you that may be helpful:

* http://not.upbylunch.com/2006/05/16/wordpress-posting-vim-script/

This person wrote an script in python that does some rpc stuff (using
the MetaWebLog API) and it can be invoked from within Vim.  This should
help you get started if you want to create something for yourself.

Hope that helps!

Tom Purl


Thanks for the info guys, that's very helpful. I've never used a
version of vim with python/perl/ruby compiled into it, so that's a
whole new world for me.

Thanks!


Re: No-echo for shell command from vim.

2006-06-22 Thread Yakov Lerner

On 6/22/06, Ajay Gupta [EMAIL PROTECTED] wrote:

But it does not what its supposed to do! Even after putting 'redraw'
after shell command, the screen is not redrawn.


try 'set nolazyredraw' + :redraw


Does it have something
to do with the type of term I am using?

no, unlikely

Yakov


Re: Bug in chaining dictionary function calls

2006-06-22 Thread Hari Krishna Dara

On Thu, 22 Jun 2006 at 6:17am, Richard Emberson wrote:

 Bram Moolenaar wrote:
  Hari Krishna Dara wrote:
 
  I found a problem with chaining function calls through the new
  dictionary functions. Here is some code demonstrate the problem, if you
  execute this code, the last line generates an E488 error, where as the
  previous lines combines (they are equivalent) works fine.
 
  let tt = {}
  function! tt.TT()
echomsg 'This is TT'
  endfunction
 
  let t = {'tt': tt}
  function t.T()
return self.tt
  endfunction
 
  let tmptt = t.T()
  call tmptt.TT()
  call t.T().TT()
 
  You cannot call a function in the LHS of an assignment.
 

 Forgive me, but which statement is not legal?
 Thanks.

 Richard

I think he is talking about my second email with another statement that
fails:

let t.T()['abc'] = 'xyz'

-- 
Thanks,
Hari

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


Re: Bug in chaining dictionary function calls

2006-06-22 Thread Hari Krishna Dara

On Wed, 21 Jun 2006 at 7:29pm, Eric Arnold wrote:

 On 6/21/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:
 
  Just wanted to add to the below that the problem is not just chaining
  functions, but using the return value of the function itself. If the
  function returns a dictionary (and probably a list), you can't use it to
  access its members, so something like this will also fail:
 
  let t.T()['abc'] = 'xyz'
 
  However, using it in an expression works fine, e.g.,:
 
  return t.T()['abc']
 
  --
  Thanks,
  Hari
 
  On Wed, 21 Jun 2006 at 3:38pm, Hari Krishna Dara wrote:
 
  
   I found a problem with chaining function calls through the new
   dictionary functions. Here is some code demonstrate the problem, if you
   execute this code, the last line generates an E488 error, where as the
   previous lines combines (they are equivalent) works fine.
  
   let tt = {}
   function! tt.TT()
 echomsg 'This is TT'
   endfunction
  
   let t = {'tt': tt}
   function t.T()
 return self.tt
   endfunction
  
   let tmptt = t.T()
   call tmptt.TT()
   call t.T().TT()
  
  





 From: Richard Emberson [EMAIL PROTECTED]
 To: vim-dev@vim.org
 Date: May 18, 2006 4:42 PM
 Subject: vim patch: fixing resetting dictionary function

 Try this without the fix and you get:
 ADD
 n=9
 Error detected while processing /home/emberson/vim/foo.vim:
 line   14:
 E475: Invalid argument: 1
 ADD
 n=9

 Note that 1 is the index of the function in the dictionary.

 Try it with the fix you get:
 ADD
 n=9
 MULTIPLY
 n=20

 script:

 let x = {}

 function x.foo(a,b) dict
 echo ADD
 return a:a + a:b
 endfunction

 let n = x.foo(4,5)
 echo n= . n

 function! x.foo(a,b) dict
 echo MULTIPLY
 return a:a * a:b
 endfunction

 let n = x.foo(4,5)
 echo n= . n

Doesn't this seem like a different problem? Or did you already verify
that the same patch fixes this issue as well?

-- 
Thanks,
Hari



 *** eval.c  2006-06-15 11:05:16.0 -0700
 --- eval.c.original 2006-06-15 11:02:59.0 -0700
 ***
 *** 18407,18435 
j = 3;
else
j = 0;
 - /* The name can be an index into a dictionary. */
 - /* There maybe a better way, this demonstrates a fix. */
 - while (arg[j] != NUL  VIM_ISDIGIT(arg[j]))
 - ++j;
 - if (arg[j] != NUL)
 - {
 - if (*arg == K_SPECIAL)
 - j = 3;
 - else
 - j = 0;
 - while (arg[j] != NUL  (j == 0 ? eval_isnamec1(arg[j])
 -   :
eval_isnamec(arg[j])))
 - ++j;
 - if (arg[j] != NUL)
 - emsg_funcname(_(e_invarg2), arg);
 - }
 - /*
while (arg[j] != NUL  (j == 0 ? eval_isnamec1(arg[j])
  : eval_isnamec(arg[j])))
++j;
if (arg[j] != NUL)
emsg_funcname(_(e_invarg2), arg);
 - */
}
  }

 --- 18407,18417 



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


Re: What might cause .vimrc not to be read

2006-06-22 Thread reader
Jürgen Krämer [EMAIL PROTECTED] writes:

  Error detected while processing command line:
  E471: Argument required

 try

   alias vim=vim -c 'source ~/.vimrc'

 instead.

Gack yeah I missed the single quotes.   But it still doesn't help.
The alias doesn't error but after . .bashrc (Where I put the alias)

Then vim .bashrc and still I get the purple mode line and my settings
are not loaded until I manual `:so ~/.vimrc'.  This seems too silly
really.  It has to be something in what is getting sourced that is
overpowering my .vimrc  eh?

Put one poster showed how to start vim with no sourcing of all that
guff.  vim --noplugins .bashrc

Still get the purple modeline and not my settings.

And just for the record:  alias |grep vim 
   alias vim='vim -c '\''source ~/.vimrc'\'''

And inside vim :echo $MYVIMRC
/home/reader/.vimrc

=

What the heck...




A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
Hi,

I started using vim a couple of weeks ago, and although I find it an
amazing editor, I'm still struggling with things that seem to be common
practice in the vim world but are not so obvious for people like me who
have always worked with IDEs.

Therefore my questions:

a) I'm working on a project where the C source files are in ./src and
the headers in ./inc. I have created a tags file under every one of the
two folders. I normally work in ./src, and my tags entry in .vimrc is
set to ./tags ../inc/tags. However, when I open a *.h file for editing
in ./inc and I :cd to the ./inc folder, whenever I try to jump to a tag
in the *.h file, vim does not recognise the tag. What would be the best
way to solve this? I know I can create a tags file at the top directory,
but then I cannot use the Build tags in the current directory tree
menu entry, since it only works for the current directory (which is
normally ./src in my case)

What I really mean is, what is the standard way of working with tags,
where are the tag files normally placed?

b) Is there a way I can tell vimgrep to always look for the given
pattern at some standard location? I usually invoke vimgrep as
'vimgrep /pattern/ *.c ../inc/*.h', and I'd like to know if there is a
way to specify '*.c ../inc/*.h' to be the default files in which to look
for the pattern, so I only have to type 'vimgrep /pattern/'.

Many thanks in advance.




Re: What might cause .vimrc not to be read

2006-06-22 Thread reader
Yakov Lerner [EMAIL PROTECTED] writes:

 1. Check your env. var. $VIMINIT.
 If VIMINIT is set, vim will skip ~/.vimrc


It shows blank so not set, and I've posted the output of 
 : echo $MYVIMRC
   /home/reader/.vimrc  
So it is appartently being sourced.

I'm starting to think its something inside of .vimrc.  And that
appears to be the case.   Maybe something new in versoin 7 has a
problem with my old sloppy vimrc.

I've created this .vimrc:

  set nocompatible   Use Vim defaults (much better!)
  set bs=2   allow backspacing over everything in insert mode
  set backup keep a backup file
  set viminfo='20,\100  read/write a .viminfo file, don't store more
  set history=50 keep 50 lines of command line history
  set ruler  show the cursor position all the time

And sure enough it starts as expected with that stuff loaded.  I see
my curor position and line numbers.  So looks like I just need to find
what section is causing the problem and either change or remove it.

 2.
 Now that you have vim source, you can do this check:

 a. cd vim7/src. Add the printf-getchar line as in patch below, to main.c
 b. make (don';t do make install)
 c. run ./vim
 d. Do you get this message that I get when you run './vim' ?
  before sourcing .vimrc($HOME/.vimrc). Press Enter.
 Yakov

OK:

Your patch won't fly as a patch maybe something got wrapped or
whatever.  

 patch main.c main.c.patch
  patching file main.c
  patch:  malformed patch at line 8: getchar();

But after applying it by hand:

(in src/)
  ./vim
before sourcing .vimrc($HOME/.vimrc). Press Enter.

After pressing enter vim starts.. 

What were we looking for here?



Re: What might cause .vimrc not to be read

2006-06-22 Thread Yakov Lerner

On 6/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:

 1. Check your env. var. $VIMINIT.
 If VIMINIT is set, vim will skip ~/.vimrc


It shows blank so not set, and I've posted the output of
 : echo $MYVIMRC
   /home/reader/.vimrc
So it is appartently being sourced.

I'm starting to think its something inside of .vimrc.  And that
appears to be the case.   Maybe something new in versoin 7 has a
problem with my old sloppy vimrc.

I've created this .vimrc:

  set nocompatible   Use Vim defaults (much better!)
  set bs=2   allow backspacing over everything in insert mode
  set backup keep a backup file
  set viminfo='20,\100  read/write a .viminfo file, don't store more
  set history=50 keep 50 lines of command line history
  set ruler  show the cursor position all the time

And sure enough it starts as expected with that stuff loaded.  I see
my curor position and line numbers.  So looks like I just need to find
what section is causing the problem and either change or remove it.

 2.
 Now that you have vim source, you can do this check:

 a. cd vim7/src. Add the printf-getchar line as in patch below, to main.c
 b. make (don';t do make install)
 c. run ./vim
 d. Do you get this message that I get when you run './vim' ?
  before sourcing .vimrc($HOME/.vimrc). Press Enter.
 Yakov

OK:

Your patch won't fly as a patch maybe something got wrapped or
whatever.

 patch main.c main.c.patch
  patching file main.c
  patch:  malformed patch at line 8: getchar();

But after applying it by hand:

(in src/)
  ./vim
before sourcing .vimrc($HOME/.vimrc). Press Enter.

After pressing enter vim starts..

What were we looking for here?


Aha. It *is* trying to load .vimrc.
Does ~/.vimrc appear in the output of :scriptnames command ?
   vim
   :scriptnames

Yakov


Re: Bug in chaining dictionary function calls

2006-06-22 Thread Hari Krishna Dara

On Thu, 22 Jun 2006 at 5:46am, Richard Emberson wrote:

 I reported this as bug number 1492165,
 https://sourceforge.net/tracker/?atid=391887group_id=27891func=browse

Didn't know that bugs can now be reported at sourceforge. I added my
comment.

Is reporting bugs on sf better for Bram? Normally, while reporting bugs
on vim mailing list, sometimes they turn out to be not so (unless it is
a crash, of course) and you might be able to get an immediate workaround
as well.

-- 
Thanks,
Hari


 Hari Krishna Dara wrote:
  I found a problem with chaining function calls through the new
  dictionary functions. Here is some code demonstrate the problem, if you
  execute this code, the last line generates an E488 error, where as the
  previous lines combines (they are equivalent) works fine.
 
  let tt = {}
  function! tt.TT()
echomsg 'This is TT'
  endfunction
 
  let t = {'tt': tt}
  function t.T()
return self.tt
  endfunction
 
  let tmptt = t.T()
  call tmptt.TT()
  call t.T().TT()
 




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


Re: What might cause .vimrc not to be read

2006-06-22 Thread Yakov Lerner

On 6/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:

 Aha. It *is* trying to load .vimrc.
 Does ~/.vimrc appear in the output of :scriptnames command ?
vim
:scriptnames

The first line:
  1: /home/reader/.vimrc


Case closed. It does read ~/.vimrc.

Yakov


Re: What might cause .vimrc not to be read

2006-06-22 Thread Yakov Lerner

On 6/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:

   1: /home/reader/.vimrc

 Case closed. It does read ~/.vimrc.

Somewhere back down the thread `the case' became.. ok it reads
.vimrc.


Then, is it time to change the thread subject then ?


So why do those settings not appear in the running vim.


The following command:
  :verbose tabstop?
will show which script last time changed the value of the option.

Yakov


Re: What might cause .vimrc not to be read

2006-06-22 Thread reader
Yakov Lerner [EMAIL PROTECTED] writes:

 Somewhere back down the thread `the case' became.. ok it reads
 .vimrc.

 Then, is it time to change the thread subject then ?

 So why do those settings not appear in the running vim.

 The following command:
   :verbose tabstop?
 will show which script last time changed the value of the option.

When following along and the solution becomes someting not described
by the subject of thead I think the custom is to keep the thread where
all the discussion is present.

   :verbose tabstop?

Is not understood as a command here.

E492: Not an editor command: verbose tabstop?



Re: File browsing in Vim

2006-06-22 Thread Aaron Griffin

On 6/21/06, Nick Lo [EMAIL PROTECTED] wrote:

Textmate, that I mentioned, also works on a Project basis and my only
qualms about that approach is that I'm often jumping between
projects ...eg I may open a file from one project to use in another
and so on.


That's what tabs are for!


Re: What might cause .vimrc not to be read

2006-06-22 Thread Yakov Lerner

On 6/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:

 Somewhere back down the thread `the case' became.. ok it reads
 .vimrc.

 Then, is it time to change the thread subject then ?

 So why do those settings not appear in the running vim.

 The following command:
   :verbose tabstop?
 will show which script last time changed the value of the option.

When following along and the solution becomes someting not described
by the subject of thead I think the custom is to keep the thread where
all the discussion is present.

   :verbose tabstop?

Is not understood as a command here.

E492: Not an editor command: verbose tabstop?



Oops, my fault
  :verb set tabstop?

Yakov


Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread A.J.Mechelynck

Bernat Tallaferro wrote:

Hi,

I started using vim a couple of weeks ago, and although I find it an
amazing editor, I'm still struggling with things that seem to be common
practice in the vim world but are not so obvious for people like me who
have always worked with IDEs.

Therefore my questions:

a) I'm working on a project where the C source files are in ./src and
the headers in ./inc. I have created a tags file under every one of the
two folders. I normally work in ./src, and my tags entry in .vimrc is
set to ./tags ../inc/tags. However, when I open a *.h file for editing
in ./inc and I :cd to the ./inc folder, whenever I try to jump to a tag
in the *.h file, vim does not recognise the tag. What would be the best
way to solve this? I know I can create a tags file at the top directory,
but then I cannot use the Build tags in the current directory tree
menu entry, since it only works for the current directory (which is
normally ./src in my case)

What I really mean is, what is the standard way of working with tags,
where are the tag files normally placed?

b) Is there a way I can tell vimgrep to always look for the given
pattern at some standard location? I usually invoke vimgrep as
'vimgrep /pattern/ *.c ../inc/*.h', and I'd like to know if there is a
way to specify '*.c ../inc/*.h' to be the default files in which to look
for the pattern, so I only have to type 'vimgrep /pattern/'.

Many thanks in advance.






1. Either give Vim the absolute locations of your tags files, or use

set tags=./tags,tags,../inc/tags,../src/tags

2.
command VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../src/*.c,../inc/*.h



Best regards,
Tony.


Re: What might cause .vimrc not to be read

2006-06-22 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

Yakov Lerner [EMAIL PROTECTED] writes:


1. Check your env. var. $VIMINIT.
If VIMINIT is set, vim will skip ~/.vimrc



It shows blank so not set, and I've posted the output of 
 : echo $MYVIMRC
   /home/reader/.vimrc  
So it is appartently being sourced.


I'm starting to think its something inside of .vimrc.  And that
appears to be the case.   Maybe something new in versoin 7 has a
problem with my old sloppy vimrc.

I've created this .vimrc:

  set nocompatible   Use Vim defaults (much better!)
  set bs=2   allow backspacing over everything in insert mode
  set backup keep a backup file
  set viminfo='20,\100 read/write a .viminfo file, don't store more
  set history=50 keep 50 lines of command line history
  set ruler  show the cursor position all the time

And sure enough it starts as expected with that stuff loaded.  I see
my curor position and line numbers.  So looks like I just need to find
what section is causing the problem and either change or remove it.

[...]

Try running Vim as vim -D with your usual vimrc. Then when you see the 
 prompt, you may optionally run :echo commands to see what happens, 
then hit s (Step into) or n (Next line) until you see what goes wrong. 
(s steps into functions and scripts, n lets them run and stops only when 
they come back. See :help debug-mode and :help cont for details.)


Note: The line displayed before the  prompt is the one which is _about_ 
to be executed, not the one which _has just_ been executed.



Best regards,
Tony.



Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread A.J.Mechelynck

Bernat Tallaferro wrote:

Tony,

thanks for your reply. I'm sorry if I'm asking something obvious, but
adding this to my .vimrc file:

On Thu, 2006-06-22 at 22:23 +0200, A.J.Mechelynck wrote:


2.
command VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../src/*.c,../inc/*.h



gives me an E488: Trailing characters error whenever I try to
execute :VimGrep /my-pattern/

I've had a look at :h E488, but I did not quite get what could be
causing this.

Thanks.






Oops. Replace the comma at the end by a space. And BTW maybe it's more 
logical to put the header files first:

command! VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../inc/*.h ../src/*.c


Best regards,
Tony.


Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
Hi Tony,

I'm still getting the E488: Trailing characters error with this:

On Thu, 2006-06-22 at 23:32 +0200, A.J.Mechelynck wrote:

   command! VimGrep -nargs=1 -bar -bang
   \   vimgrepbang args ../inc/*.h ../src/*.c

Any ideas?





Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread A.J.Mechelynck

Bernat Tallaferro wrote:

Hi Tony,

I'm still getting the E488: Trailing characters error with this:

On Thu, 2006-06-22 at 23:32 +0200, A.J.Mechelynck wrote:


command! VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../inc/*.h ../src/*.c


Any ideas?







Hm. With which pattern are you invoking this command? And what is the 
current directory? (use the :pwd command if you arren't sure.)



Best regards,
Tony.


Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
On Fri, 2006-06-23 at 00:03 +0200, A.J.Mechelynck wrote:

 Hm. With which pattern are you invoking this command? And what is the 
 current directory? (use the :pwd command if you arren't sure.)

I'm on /home/dpm/project/src, editing myfile.c. 

I don't know whether this is relevant, but I usually start editing files
with gvim by right-clicking on them on the file manager and choosing
Edit with GVim (I'm using Nautilus on GNOME). The only side-effect of
this, is that the pwd is always set to /home/dpm, so I usually have to
do an :lcd %:h if I need to do any file-related stuff.

So, to recap:

* My .vimrc contains this:
command! VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../inc/*.h ../src/*.c

(I guess that ../src/*.c should simply be *.c, but changing that does
not solve the issue)

* pwd returns /home/dpm/project/src

* It doesn't matter which pattern I use, I always get the E488:
Trailing characters whenever I execute:

:VimGrep pattern

as an example, the last pattern I used was:

:VimGrep static

Thanks for your help (and your patience).




Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread A.J.Mechelynck

Bernat Tallaferro wrote:

On Fri, 2006-06-23 at 00:03 +0200, A.J.Mechelynck wrote:

Hm. With which pattern are you invoking this command? And what is the 
current directory? (use the :pwd command if you arren't sure.)


I'm on /home/dpm/project/src, editing myfile.c. 


I don't know whether this is relevant, but I usually start editing files
with gvim by right-clicking on them on the file manager and choosing
Edit with GVim (I'm using Nautilus on GNOME). The only side-effect of
this, is that the pwd is always set to /home/dpm, so I usually have to
do an :lcd %:h if I need to do any file-related stuff.

So, to recap:

* My .vimrc contains this:
command! VimGrep -nargs=1 -bar -bang
\   vimgrepbang args ../inc/*.h ../src/*.c

(I guess that ../src/*.c should simply be *.c, but changing that does
not solve the issue)


I put it that way so as to get to the right directory even after :cd 
../inc.




* pwd returns /home/dpm/project/src

* It doesn't matter which pattern I use, I always get the E488:
Trailing characters whenever I execute:

:VimGrep pattern

as an example, the last pattern I used was:

:VimGrep static

Thanks for your help (and your patience).







Oh, and I got back to :help :command for a double-check. The new 
command name must go after the options:


 command! -nargs=1 -bar -bang VimGrep
 \   vimgrepbang args ../inc/*.h ../src/*.c


Best regards,
Tony


Script to create automatic case statements

2006-06-22 Thread Max Dyckhoff
I did a quick search of the interwebs for this, but came up blank. I was
wondering, before I go off and do it myself, if anyone has already made
or heard of a script to fill out C case statements for you.

The number of times that I write something like this in a day is
ridiculous:

switch (some_variable)
{
case _some_root_wibble:
case _some_root_wobble:
case _some_root_jelly:
case _some_root_on_a_stick:
}

Typically I will write the first case line and then copy it X times, and
do a cw on the tail of the enum value followed by ^N and then a
selection from the resultant menu.

What I would really like is to just do the ^N on the initial
_some_root, see that the popup menu shows the correct four values, and
press some key combo to insert them all on consecutive lines like above.
I'm not even fussy if it inserts the case and the :, I can very
easily do them myself with a couple of key presses.

Has anyone seen something to do this before, or does anyone have any
ideas about how to implement this?

Cheers!

Max


Re: search '/' command

2006-06-22 Thread Hari Krishna Dara

On Thu, 22 Jun 2006 at 5:36pm, Jason Frerich wrote:

 How can I tell the search '/' command to perform a task after typing
 each letter on the pattern line.

 For Example:
 /g0ee
 I would like the above to execute as the following:
 /g - sendcommand(g)
  0 - sendcommand(g0)
  e - sendcommand(g0e)
  e - sendcommand(g0ee)

 After each letter is typed, I would like to send that letter(s) to a
 function call sendcommand.

 Jason

I can't think of a simple way to capture all keys without mapping all
possible keys, something like:

for ch in range(32, 126)
  exec 'nnoremap expr' nr2char(ch) 'sendcommand('.nr2char(ch).')'
endfor

Inside sendcommand() you should check the mode, something like:

function sendcommand(ch)
  if getcmdtype() == '/'
 do something
  endif
  return a:ch
endfunction

If this is not acceptable to you, you can map / to trigger your function
which will read the keys using getchar(). You will have to implement at
least a sub set of editing mode keys. Take a look at my execmap.vim
plugin that does this.

-- 
HTH,
Hari

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


Re: File browsing in Vim

2006-06-22 Thread Nick Lo
Ha yeah thanks Aaron, of course but I was kind of referring to the  
Textmate and jEdit approaches as I've not tried the project plugin.


True enough Vim has tabs now, unfortunately as I mentioned in  
previous posts I've been having a few small bugs with split windows  
in different tabs. Of course this may be a netrw issue that wouldn't  
apply to the the project plugin. Anyhow I'm having a go with the  
simpler :Ex when needed approach which I quite like.


Thanks,

Nick


On 6/21/06, Nick Lo [EMAIL PROTECTED] wrote:

Textmate, that I mentioned, also works on a Project basis and my only
qualms about that approach is that I'm often jumping between
projects ...eg I may open a file from one project to use in another
and so on.


That's what tabs are for!






Re: Script to create automatic case statements

2006-06-22 Thread Tim Chase
What I would really like is to just do the ^N on the initial 
_some_root, see that the popup menu shows the correct four

values, and press some key combo to insert them all on
consecutive lines like above. I'm not even fussy if it inserts
the case and the :, I can very easily do them myself with
a couple of key presses.


I'm not sure how to go about pulling in the list of
auto-completion possibilities (such as one gets with ^N and ^P as
you describe). I *usually* have all such items I want in a switch
statement defined in an enum somewhere, so I just copy the
contents of that enum and then perform a :s across them, such as

typedef enum {
TAPIOCA,
SPATULA,
CATALOG,
MYOPIC
} RandomStuff;

I then copy those contents to my switch() statement:

switch (foo)
{
TAPIOCA,
SPATULA,
CATALOG,
MYOPIC
}

and then, selecting the lines with vi{, I can run

:','s/,/
:','s/.*/   case : break;

or if you prefer in a mappable one-liner

:','s/^\s*\(.\{-}\),\=$/case \1: break;

You'd then have to adjust indentation accordingly, but if you've
got scads of items in your enum, it's an easy way to go about it.

Alternatively, if they're not in an enum, and you have to gather
them from around the document, you can do something like

ma

on a blank line where you intend your results to go, and then do

:g/_some_root/t'a

which will bring all sorts of lines containing this item into
those braces.  You can then tidy them up a bit with something like

vi{
:','s/.*\(_some_root\w*\).*/case \1: break;
:','!sort -u

(assuming you have an external sort capible of eliminating
duplicate lines with the -unique parameter, such as GNU sort on
most *nix systems...as your email address is at Microsoft, you
might not have GNU tools quite so readily available ;)

I'm not sure if there are easier ways or more automated ways to
find a unique list of autocompletion-matches...especially if they
span open buffers (as ^N and ^P do)

Just a few ideas though as you cavort towards a solution,

-tim






formatting comments and indentation

2006-06-22 Thread Luis A. Florit
Pals,

When formatting an email via 'gq', a quoted text like

  bla bla bla...
 bla bla bla...
 bla bla bla...

is formatted by default as

  bla bla bla...
  bla bla bla...
  bla bla bla...

This is because vim understands ' ...' as a comment.

So, my question is: how (if there is a way) to use the
format option 'fo=2' (use the indentation of the second line)
when formatting comments? 

Thanks,

Luis.



Errors when editing via FTP (netrw -- ?)

2006-06-22 Thread Marv Boyes

Hello, all. I've combed the list for references to this problem and
found nothing, but please forgive a short-sighted newbie if I've
overlooked something pertinent.

I'm using Vim 7 in three different places:
Mandrake Linux 9.2 (built from aap, with all patches applied)
Windows XP SP2 (from the self-installing executable)
Ubuntu Linux 6.06 (built from source tarball; no patches)

When editing files via FTP under Mandrake and Windows, I'm getting
some strage behavior that I didn't see in the 6.x series. As soon as I
connect, I get this error:

***netrw*** This security scheme is not implemented

However, the file loads normally once I hit Enter. I can edit the
file; yet I get the same error when I try to save. Under Mandrake, the
file actually _does_ save despite the error (though Vim behaves as if
it hasn't saved; I get the No write since last change warning, but
when I look at the file via other means I see that my changes are
there). Under Windows, the file doesn't save at all.

The Vim 7 build in Ubuntu behaves normally when editing via FTP,
without errors of any kind. So at least I know it _can_ be done. :)
Any ideas where my troubles are coming from? Incidentally, I have
version 100 (the latest--?) of netrw installed. Any and all guidance
will be very much appreciated; thanks in advance.