wsdjeg / vim-fetch

Make Vim handle line and column numbers in file names with a minimum of fuss
http://www.vim.org/scripts/script.php?script_id=5089
MIT License
312 stars 17 forks source link

Add specs for grep context and git grep function context lines #26

Closed phil-blain closed 4 years ago

phil-blain commented 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:

$ 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:

$ 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.

phil-blain commented 4 years ago

Hey @wsdjeg! Did you get a chance to look at these changes ?