diff options
author | James McCoy <jamessan@jamessan.com> | 2017-04-29 07:55:15 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-04-29 21:46:12 -0400 |
commit | 059c3fc2f952b42824ca37610c040c938a75de5c (patch) | |
tree | a54437dec6b35a011a76f6b2d442778aed596f40 /src/nvim/ex_cmds.c | |
parent | dbdc2d40bb7a950e294c6e50906f546707ccf390 (diff) | |
download | rneovim-059c3fc2f952b42824ca37610c040c938a75de5c.tar.gz rneovim-059c3fc2f952b42824ca37610c040c938a75de5c.tar.bz2 rneovim-059c3fc2f952b42824ca37610c040c938a75de5c.zip |
vim-patch:7.4.2239
Problem: Warning for missing declaration of skip_vimgrep_pat(). (John
Marriott)
Solution: Move it to another file.
https://github.com/vim/vim/commit/9baf297c99cc35adb921bee04369499d76438889
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index ab85bb766f..95cbcbbcb9 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -6159,6 +6159,50 @@ void ex_substitute(exarg_T *eap) unblock_autocmds(); } +/// Skip over the pattern argument of ":vimgrep /pat/[g][j]". +/// Put the start of the pattern in "*s", unless "s" is NULL. +/// If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. +/// If "s" is not NULL terminate the pattern with a NUL. +/// Return a pointer to the char just past the pattern plus flags. +char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags) +{ + int c; + + if (vim_isIDc(*p)) { + // ":vimgrep pattern fname" + if (s != NULL) + *s = p; + p = skiptowhite(p); + if (s != NULL && *p != NUL) + *p++ = NUL; + } else { + // ":vimgrep /pattern/[g][j] fname" + if (s != NULL) + *s = p + 1; + c = *p; + p = skip_regexp(p + 1, c, TRUE, NULL); + if (*p != c) + return NULL; + + // Truncate the pattern. + if (s != NULL) + *p = NUL; + ++p; + + // Find the flags + while (*p == 'g' || *p == 'j') { + if (flags != NULL) { + if (*p == 'g') + *flags |= VGR_GLOBAL; + else + *flags |= VGR_NOJUMP; + } + ++p; + } + } + return p; +} + /// List v:oldfiles in a nice way. void ex_oldfiles(exarg_T *eap) { |