Hi,

I've been a Vim user for many years... this is my first post to this dev list and my first contribution to Vim :-)

I love to use '{' and '}' to move between sections separated by blank lines... and, accordingly I make sure that all my blank lines are really *empty* (i.e., no whitespace), and if I need any help from Vim for that I must have configured it long ago.

However, I have lowbrow colleagues who would not even know the difference between an empty line and a blank line and for whom it would be (really) a lot of trouble to try to keep all their blank lines empty, so I can't really even try to make them do it. Sometimes I would edit a file they've worked on and do this (in annoyance!):

        :%s/^[  ^I]*$//

but that's a pain (and it introduces spurious diffs in our Subversion change logs).

So... I just checked out the Vim source code, and added this option:

        :set wspara

and now... happiness! I can now '{' and '}' through their non-empty blank lines just as though they were empty.

Here's the patch, I hope y'all will commit it:

-------------------------------------------------------------------------------------------------------------------------------------------------
Index: src/option.c
===================================================================
--- src/option.c    (revision 1114)
+++ src/option.c    (working copy)
@@ -2751,6 +2751,9 @@
                (char_u *)&p_wd, PV_NONE,
                {(char_u *)0L, (char_u *)0L}},

+    {"wspara",      "wsp",  P_BOOL,
+                            (char_u *)&p_wsp, PV_NONE,
+               {(char_u *)0L, (char_u *)0L}},
 /* terminal output codes */
#define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL| P_SECURE, \
                (char_u *)&vvv, PV_NONE, \
Index: src/option.h
===================================================================
--- src/option.h    (revision 1114)
+++ src/option.h    (working copy)
@@ -869,6 +869,7 @@
 EXTERN int p_wa;       /* 'writeany' */
 EXTERN int p_wb;       /* 'writebackup' */
 EXTERN long    p_wd;       /* 'writedelay' */
+EXTERN long    p_wsp;      /* 'wspara' */

 /*
  * "indir" values for buffer-local opions.
Index: src/search.c
===================================================================
--- src/search.c    (revision 1114)
+++ src/search.c    (working copy)
@@ -2742,6 +2742,13 @@
     if (*s == '.' && (inmacro(p_sections, s + 1) ||
                       (!para && inmacro(p_para, s + 1))))
    return TRUE;
+    if (p_wsp) {
+        while (
+                *s != NUL
+                && (*s == ' ' || *s == '\t')
+            ) ++s;
+        return *s == NUL;
+    }
     return FALSE;
 }

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Raspunde prin e-mail lui