@@ -4318,58 +4318,6 @@ ex_vimgrep(exarg_T *eap)
43184318 vim_regfree (regmatch .regprog );
43194319}
43204320
4321- /*
4322- * Skip over the pattern argument of ":vimgrep /pat/[g][j]".
4323- * Put the start of the pattern in "*s", unless "s" is NULL.
4324- * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP.
4325- * If "s" is not NULL terminate the pattern with a NUL.
4326- * Return a pointer to the char just past the pattern plus flags.
4327- */
4328- char_u *
4329- skip_vimgrep_pat (char_u * p , char_u * * s , int * flags )
4330- {
4331- int c ;
4332-
4333- if (vim_isIDc (* p ))
4334- {
4335- /* ":vimgrep pattern fname" */
4336- if (s != NULL )
4337- * s = p ;
4338- p = skiptowhite (p );
4339- if (s != NULL && * p != NUL )
4340- * p ++ = NUL ;
4341- }
4342- else
4343- {
4344- /* ":vimgrep /pattern/[g][j] fname" */
4345- if (s != NULL )
4346- * s = p + 1 ;
4347- c = * p ;
4348- p = skip_regexp (p + 1 , c , TRUE, NULL );
4349- if (* p != c )
4350- return NULL ;
4351-
4352- /* Truncate the pattern. */
4353- if (s != NULL )
4354- * p = NUL ;
4355- ++ p ;
4356-
4357- /* Find the flags */
4358- while (* p == 'g' || * p == 'j' )
4359- {
4360- if (flags != NULL )
4361- {
4362- if (* p == 'g' )
4363- * flags |= VGR_GLOBAL ;
4364- else
4365- * flags |= VGR_NOJUMP ;
4366- }
4367- ++ p ;
4368- }
4369- }
4370- return p ;
4371- }
4372-
43734321/*
43744322 * Restore current working directory to "dirname_start" if they differ, taking
43754323 * into account whether it is set locally or globally.
@@ -5207,3 +5155,57 @@ ex_helpgrep(exarg_T *eap)
52075155}
52085156
52095157#endif /* FEAT_QUICKFIX */
5158+
5159+ #if defined(FEAT_QUICKFIX ) || defined(FEAT_EVAL ) || defined(PROTO )
5160+ /*
5161+ * Skip over the pattern argument of ":vimgrep /pat/[g][j]".
5162+ * Put the start of the pattern in "*s", unless "s" is NULL.
5163+ * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP.
5164+ * If "s" is not NULL terminate the pattern with a NUL.
5165+ * Return a pointer to the char just past the pattern plus flags.
5166+ */
5167+ char_u *
5168+ skip_vimgrep_pat (char_u * p , char_u * * s , int * flags )
5169+ {
5170+ int c ;
5171+
5172+ if (vim_isIDc (* p ))
5173+ {
5174+ /* ":vimgrep pattern fname" */
5175+ if (s != NULL )
5176+ * s = p ;
5177+ p = skiptowhite (p );
5178+ if (s != NULL && * p != NUL )
5179+ * p ++ = NUL ;
5180+ }
5181+ else
5182+ {
5183+ /* ":vimgrep /pattern/[g][j] fname" */
5184+ if (s != NULL )
5185+ * s = p + 1 ;
5186+ c = * p ;
5187+ p = skip_regexp (p + 1 , c , TRUE, NULL );
5188+ if (* p != c )
5189+ return NULL ;
5190+
5191+ /* Truncate the pattern. */
5192+ if (s != NULL )
5193+ * p = NUL ;
5194+ ++ p ;
5195+
5196+ /* Find the flags */
5197+ while (* p == 'g' || * p == 'j' )
5198+ {
5199+ if (flags != NULL )
5200+ {
5201+ if (* p == 'g' )
5202+ * flags |= VGR_GLOBAL ;
5203+ else
5204+ * flags |= VGR_NOJUMP ;
5205+ }
5206+ ++ p ;
5207+ }
5208+ }
5209+ return p ;
5210+ }
5211+ #endif
0 commit comments