Open eksperimental opened 9 years ago
I needed this feature so badly that I implemented a shell version myself. install the script here: https://git.io/ag-l1
and run it like:
ag-l1 "\s+def[^\n]+\\\\ *fn[^\(]"
lib/iex/test/iex/server_test.exs:51
lib/elixir/lib/stream.ex:410
combine it with your text-editor, to open the files at the right line:
ag-l1 "\s+def[^\n]+\\\\ *fn[^\(]" | xargs subl
One feature that I think it will be worth adding is listing the file with matches suchs as in "--files-with-matches" but appending the line number of the first match, separated by a colon, useful in combination with
xargs
and a text-editor that supports passing the line number when opening files.I would like to have an option that lists just the files as in
but including line number of the first match
so it could be piped into
xargs
and then into your favorite text-editor that supports opening files at a line number, such as "sublime text" and you could doag "\s+def[^\n]+\\\\ *fn[^\(]" --files-with-matches-line-number | xargs subl
and the files will be opened and the cursor with be at the right line that you need to edit.