]>
Commit | Line | Data |
---|---|---|
468bf62c AM |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.0.222 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.0.222 | |
11 | Problem: Perl indenting using 'cindent' works almost right. | |
12 | Solution: Recognize '#' to start a comment. (Alex Manoussakis) Added '#' | |
13 | flag in 'cinoptions'. | |
14 | Files: runtime/doc/indent.txt, src/misc1.c | |
15 | ||
16 | ||
17 | *** ../vim-7.0.221/runtime/doc/indent.txt Sun May 7 17:00:59 2006 | |
18 | --- runtime/doc/indent.txt Sat Mar 17 16:27:57 2007 | |
19 | *************** | |
20 | *** 1,4 **** | |
21 | ! *indent.txt* For Vim version 7.0. Last change: 2006 Apr 30 | |
22 | ||
23 | ||
24 | VIM REFERENCE MANUAL by Bram Moolenaar | |
25 | --- 1,4 ---- | |
26 | ! *indent.txt* For Vim version 7.0. Last change: 2007 Mar 17 | |
27 | ||
28 | ||
29 | VIM REFERENCE MANUAL by Bram Moolenaar | |
30 | *************** | |
31 | *** 434,443 **** | |
32 | limits the time needed to search for the start of a comment. | |
33 | (default 30 lines). | |
34 | ||
35 | ||
36 | The defaults, spelled out in full, are: | |
37 | cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0, | |
38 | ! /0,(2s,us,U0,w0,W0,m0,j0,)20,*30 | |
39 | ||
40 | Vim puts a line in column 1 if: | |
41 | - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'. | |
42 | --- 434,448 ---- | |
43 | limits the time needed to search for the start of a comment. | |
44 | (default 30 lines). | |
45 | ||
46 | + #N When N is non-zero recognize shell/Perl comments, starting with | |
47 | + '#'. Default N is zero: don't recognizes '#' comments. Note | |
48 | + that lines starting with # will still be seen as preprocessor | |
49 | + lines. | |
50 | + | |
51 | ||
52 | The defaults, spelled out in full, are: | |
53 | cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0, | |
54 | ! /0,(2s,us,U0,w0,W0,m0,j0,)20,*30,#0 | |
55 | ||
56 | Vim puts a line in column 1 if: | |
57 | - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'. | |
58 | *** ../vim-7.0.221/src/misc1.c Tue Oct 24 21:15:09 2006 | |
59 | --- src/misc1.c Sat Mar 17 16:36:00 2007 | |
60 | *************** | |
61 | *** 4796,4803 **** | |
62 | --- 4796,4806 ---- | |
63 | static int find_last_paren __ARGS((char_u *l, int start, int end)); | |
64 | static int find_match __ARGS((int lookfor, linenr_T ourscope, int ind_maxparen, int ind_maxcomment)); | |
65 | ||
66 | + static int ind_hash_comment = 0; /* # starts a comment */ | |
67 | + | |
68 | /* | |
69 | * Skip over white space and C comments within the line. | |
70 | + * Also skip over Perl/shell comments if desired. | |
71 | */ | |
72 | static char_u * | |
73 | cin_skipcomment(s) | |
74 | *************** | |
75 | *** 4805,4811 **** | |
76 | --- 4808,4824 ---- | |
77 | { | |
78 | while (*s) | |
79 | { | |
80 | + char_u *prev_s = s; | |
81 | + | |
82 | s = skipwhite(s); | |
83 | + | |
84 | + /* Perl/shell # comment comment continues until eol. Require a space | |
85 | + * before # to avoid recognizing $#array. */ | |
86 | + if (ind_hash_comment != 0 && s != prev_s && *s == '#') | |
87 | + { | |
88 | + s += STRLEN(s); | |
89 | + break; | |
90 | + } | |
91 | if (*s != '/') | |
92 | break; | |
93 | ++s; | |
94 | *************** | |
95 | *** 6133,6139 **** | |
96 | if (l[1] == '-') | |
97 | n = -n; | |
98 | /* When adding an entry here, also update the default 'cinoptions' in | |
99 | ! * change.txt, and add explanation for it! */ | |
100 | switch (*l) | |
101 | { | |
102 | case '>': ind_level = n; break; | |
103 | --- 6146,6152 ---- | |
104 | if (l[1] == '-') | |
105 | n = -n; | |
106 | /* When adding an entry here, also update the default 'cinoptions' in | |
107 | ! * doc/indent.txt, and add explanation for it! */ | |
108 | switch (*l) | |
109 | { | |
110 | case '>': ind_level = n; break; | |
111 | *************** | |
112 | *** 6166,6171 **** | |
113 | --- 6179,6185 ---- | |
114 | case 'h': ind_scopedecl_code = n; break; | |
115 | case 'j': ind_java = n; break; | |
116 | case 'l': ind_keep_case_label = n; break; | |
117 | + case '#': ind_hash_comment = n; break; | |
118 | } | |
119 | } | |
120 | ||
121 | *** ../vim-7.0.221/src/version.c Tue Mar 27 10:20:59 2007 | |
122 | --- src/version.c Tue Mar 27 10:56:50 2007 | |
123 | *************** | |
124 | *** 668,669 **** | |
125 | --- 668,671 ---- | |
126 | { /* Add new patch number below this line */ | |
127 | + /**/ | |
128 | + 222, | |
129 | /**/ | |
130 | ||
131 | -- | |
132 | My Go , this amn keyboar oesn't have a . | |
133 | ||
134 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
135 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
136 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
137 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |