Closed phil-blain closed 4 years ago
When called with the -A, -B or -C flags, grep and git grep show the line number for context lines enclosed with dashes, for example:
-A
-B
-C
grep
git grep
$ grep -r -A 2 -n spec . ./autoload/fetch.vim:9:" Position specs Dictionary: {{{ ./autoload/fetch.vim:10:let s:specs = {} ./autoload/fetch.vim-11- ./autoload/fetch.vim-12-" - trailing colon, i.e. ':lnum[:colnum[:]]'
Similarly, git grep, when called with the -p flag, shows the line number for the nearest function line enclosed with equal signs, for example:
-p
$ git grep -p show-function builtin/grep.c=796=int cmd_grep(int argc, const char **argv, const char *prefix) builtin/grep.c:894: OPT_BOOL('p', "show-function", &opt.funcname,
This PR adds specs for these two cases.
Hey @wsdjeg! Did you get a chance to look at these changes ?
When called with the
-A
,-B
or-C
flags,grep
andgit grep
show the line number for context lines enclosed with dashes, for example:Similarly,
git grep
, when called with the-p
flag, shows the line number for the nearest function line enclosed with equal signs, for example:This PR adds specs for these two cases.