# 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;
}
Hi zappathustra!
On Fr, 12 Apr 2013, zappathustra@free.Fr wrote:
> Marco <netuse@lavabit.com> a écrit:
> > On 2013–04–12 Ben Fritz wrote:
> >
> > > It's not configurable.
> > >
> > > { and } strictly use paragraph boundaries, defined as empty lines
> > > or lines using nroff macros specified in the 'paragraphs' option.
> > >
> > > ip uses these but also has an exception for lines containing
> > > nothing but whitespace.
> > >
> > > See :help paragraph and :help ip
> >
> > I did read those sections. The 'paragraphs' option with the default
> > setting "IPLPPPQPP TPHPLIPpLpItpplpipbp" is one of the weirdest vim
> > options I encountered in a while. Why is it restricted to nroff
> > macros? It could better take a regex or anything more general than
> > nroff macros.
> >
> > > This behavior annoys me too but it is what it is.
> >
> > Good to hear that it's not just me. If there is interest, maybe a
> > second variable, e.g. 'paragraphsregex' could be implemented and set
> > to an arbitrary regex as paragraph delimiter. If it's undefined, the
> > old behaviour takes precedence to remain backwards compatible.
>
> That behavior annoys a lot of people; it's even #46 in the wish list:
> http://www.vim.org/sponsor/vote_results.php
Some time ago¹, I made a patch. Please test. Here is the updated patch
again (which I seemed to have forgotten to attach in a later message).
¹) https://groups.google.com/d/msg/vim_dev/6r6qX8W6I_Y/pQPexgLWI6UJ
regards,
Christian
--
Es gibt keine Lauer auf der ich nicht liege.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Friday, April 12, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment