# HG changeset patch # Parent 2e303a219fa4732ccdfd3ffe54120a6bd5087e21 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5186,6 +5186,8 @@ global Specifies the nroff macros that separate paragraphs. These are pairs of two letters (see |object-motions|). + If it starts with a slash, the rest of the option is taken as regular + expression to test against. *'paste'* *'nopaste'* 'paste' boolean (default off) @@ -5810,6 +5812,9 @@ two letters (See |object-motions|). The default makes a section start at the nroff macros ".SH", ".NH", ".H", ".HU", ".nh" and ".sh". + If it starts with a slash, the rest of the option is taken as regular + expression to test against. + *'secure'* *'nosecure'* *E523* 'secure' boolean (default off) global diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -2669,6 +2669,51 @@ curr = curwin->w_cursor.lnum; + if ((what == NUL && *p_para == '/') || + ((what == '{' || what == '}') && *p_sections == '/')) + { + char_u *pat = NULL; + int r = FALSE; /* return value */ + pos_T cpos = curwin->w_cursor; + + if (what == NUL && *p_para == '/') + pat = (p_para + 1); + else if (*p_sections == '/') + pat = (p_sections + 1); + + if (pat != NULL) + { + int old_wrapscan = p_ws; + pos_T cur = curwin->w_cursor; + int skip_lines = FALSE; + p_ws = FALSE; /* don't wrap around the end of the file */ + + do { + r = do_search(NULL, dir == FORWARD ? '/' : '?', pat, 1, + SEARCH_KEEP | SEARCH_MARK | SEARCH_START , NULL); + + /* skip consecutive lines */ + if (equalpos(cur, curwin->w_cursor)) + { + if (dir == FORWARD) + curwin->w_cursor.lnum++; + else + curwin->w_cursor.lnum--; + + skip_lines = TRUE; + cur = curwin->w_cursor; + } + else + skip_lines = FALSE; + + } while (r && (count-- > 1 || skip_lines)); + p_ws = old_wrapscan; + if (!r) + curwin->w_cursor = cpos; + return r; + } + } + while (count--) { did_skip = FALSE; @@ -2772,6 +2817,8 @@ if (*s == '.' && (inmacro(p_sections, s + 1) || (!para && inmacro(p_para, s + 1)))) return TRUE; + if (*p_sections == '/' || *p_para == '/') + return inmacro(p_sections, s) || (!para && inmacro(p_para, s)); return FALSE; }