Karsten Hopp 414561
To: vim-dev@vim.org
Karsten Hopp 414561
Subject: patch 7.0.222
Karsten Hopp 414561
Fcc: outbox
Karsten Hopp 414561
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 414561
Mime-Version: 1.0
Karsten Hopp 414561
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 414561
Content-Transfer-Encoding: 8bit
Karsten Hopp 414561
------------
Karsten Hopp 414561
Karsten Hopp 414561
Patch 7.0.222
Karsten Hopp 414561
Problem:    Perl indenting using 'cindent' works almost right.
Karsten Hopp 414561
Solution:   Recognize '#' to start a comment. (Alex Manoussakis)  Added '#'
Karsten Hopp 414561
	    flag in 'cinoptions'.
Karsten Hopp 414561
Files:	    runtime/doc/indent.txt, src/misc1.c
Karsten Hopp 414561
Karsten Hopp 414561
Karsten Hopp 414561
*** ../vim-7.0.221/runtime/doc/indent.txt	Sun May  7 17:00:59 2006
Karsten Hopp 414561
--- runtime/doc/indent.txt	Sat Mar 17 16:27:57 2007
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 1,4 ****
Karsten Hopp 414561
! *indent.txt*    For Vim version 7.0.  Last change: 2006 Apr 30
Karsten Hopp 414561
  
Karsten Hopp 414561
  
Karsten Hopp 414561
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 414561
--- 1,4 ----
Karsten Hopp 414561
! *indent.txt*    For Vim version 7.0.  Last change: 2007 Mar 17
Karsten Hopp 414561
  
Karsten Hopp 414561
  
Karsten Hopp 414561
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 434,443 ****
Karsten Hopp 414561
  	      limits the time needed to search for the start of a comment.
Karsten Hopp 414561
  	      (default 30 lines).
Karsten Hopp 414561
  
Karsten Hopp 414561
  
Karsten Hopp 414561
  The defaults, spelled out in full, are:
Karsten Hopp 414561
  	cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0,
Karsten Hopp 414561
! 		   /0,(2s,us,U0,w0,W0,m0,j0,)20,*30
Karsten Hopp 414561
  
Karsten Hopp 414561
  Vim puts a line in column 1 if:
Karsten Hopp 414561
  - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
Karsten Hopp 414561
--- 434,448 ----
Karsten Hopp 414561
  	      limits the time needed to search for the start of a comment.
Karsten Hopp 414561
  	      (default 30 lines).
Karsten Hopp 414561
  
Karsten Hopp 414561
+ 	#N    When N is non-zero recognize shell/Perl comments, starting with
Karsten Hopp 414561
+ 	      '#'.  Default N is zero: don't recognizes '#' comments.  Note
Karsten Hopp 414561
+ 	      that lines starting with # will still be seen as preprocessor
Karsten Hopp 414561
+ 	      lines.
Karsten Hopp 414561
+ 
Karsten Hopp 414561
  
Karsten Hopp 414561
  The defaults, spelled out in full, are:
Karsten Hopp 414561
  	cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0,
Karsten Hopp 414561
! 		   /0,(2s,us,U0,w0,W0,m0,j0,)20,*30,#0
Karsten Hopp 414561
  
Karsten Hopp 414561
  Vim puts a line in column 1 if:
Karsten Hopp 414561
  - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
Karsten Hopp 414561
*** ../vim-7.0.221/src/misc1.c	Tue Oct 24 21:15:09 2006
Karsten Hopp 414561
--- src/misc1.c	Sat Mar 17 16:36:00 2007
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 4796,4803 ****
Karsten Hopp 414561
--- 4796,4806 ----
Karsten Hopp 414561
  static int	find_last_paren __ARGS((char_u *l, int start, int end));
Karsten Hopp 414561
  static int	find_match __ARGS((int lookfor, linenr_T ourscope, int ind_maxparen, int ind_maxcomment));
Karsten Hopp 414561
  
Karsten Hopp 414561
+ static int	ind_hash_comment = 0;   /* # starts a comment */
Karsten Hopp 414561
+ 
Karsten Hopp 414561
  /*
Karsten Hopp 414561
   * Skip over white space and C comments within the line.
Karsten Hopp 414561
+  * Also skip over Perl/shell comments if desired.
Karsten Hopp 414561
   */
Karsten Hopp 414561
      static char_u *
Karsten Hopp 414561
  cin_skipcomment(s)
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 4805,4811 ****
Karsten Hopp 414561
--- 4808,4824 ----
Karsten Hopp 414561
  {
Karsten Hopp 414561
      while (*s)
Karsten Hopp 414561
      {
Karsten Hopp 414561
+ 	char_u *prev_s = s;
Karsten Hopp 414561
+ 
Karsten Hopp 414561
  	s = skipwhite(s);
Karsten Hopp 414561
+ 
Karsten Hopp 414561
+ 	/* Perl/shell # comment comment continues until eol.  Require a space
Karsten Hopp 414561
+ 	 * before # to avoid recognizing $#array. */
Karsten Hopp 414561
+ 	if (ind_hash_comment != 0 && s != prev_s && *s == '#')
Karsten Hopp 414561
+ 	{
Karsten Hopp 414561
+ 	    s += STRLEN(s);
Karsten Hopp 414561
+ 	    break;
Karsten Hopp 414561
+ 	}
Karsten Hopp 414561
  	if (*s != '/')
Karsten Hopp 414561
  	    break;
Karsten Hopp 414561
  	++s;
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 6133,6139 ****
Karsten Hopp 414561
  	if (l[1] == '-')
Karsten Hopp 414561
  	    n = -n;
Karsten Hopp 414561
  	/* When adding an entry here, also update the default 'cinoptions' in
Karsten Hopp 414561
! 	 * change.txt, and add explanation for it! */
Karsten Hopp 414561
  	switch (*l)
Karsten Hopp 414561
  	{
Karsten Hopp 414561
  	    case '>': ind_level = n; break;
Karsten Hopp 414561
--- 6146,6152 ----
Karsten Hopp 414561
  	if (l[1] == '-')
Karsten Hopp 414561
  	    n = -n;
Karsten Hopp 414561
  	/* When adding an entry here, also update the default 'cinoptions' in
Karsten Hopp 414561
! 	 * doc/indent.txt, and add explanation for it! */
Karsten Hopp 414561
  	switch (*l)
Karsten Hopp 414561
  	{
Karsten Hopp 414561
  	    case '>': ind_level = n; break;
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 6166,6171 ****
Karsten Hopp 414561
--- 6179,6185 ----
Karsten Hopp 414561
  	    case 'h': ind_scopedecl_code = n; break;
Karsten Hopp 414561
  	    case 'j': ind_java = n; break;
Karsten Hopp 414561
  	    case 'l': ind_keep_case_label = n; break;
Karsten Hopp 414561
+ 	    case '#': ind_hash_comment = n; break;
Karsten Hopp 414561
  	}
Karsten Hopp 414561
      }
Karsten Hopp 414561
  
Karsten Hopp 414561
*** ../vim-7.0.221/src/version.c	Tue Mar 27 10:20:59 2007
Karsten Hopp 414561
--- src/version.c	Tue Mar 27 10:56:50 2007
Karsten Hopp 414561
***************
Karsten Hopp 414561
*** 668,669 ****
Karsten Hopp 414561
--- 668,671 ----
Karsten Hopp 414561
  {   /* Add new patch number below this line */
Karsten Hopp 414561
+ /**/
Karsten Hopp 414561
+     222,
Karsten Hopp 414561
  /**/
Karsten Hopp 414561
Karsten Hopp 414561
-- 
Karsten Hopp 414561
My Go , this  amn keyboar   oesn't have a  .
Karsten Hopp 414561
Karsten Hopp 414561
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 414561
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 414561
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 414561
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///