Closed kidd closed 5 years ago
Good idea. I never thought of that usage but seems pretty handy.
The :files
option handles custom forms as well. If the evaluated result of the form doesn't match an existing alias this is added as a custom alias with --type-add custom:non_macthing_pattern.el --type: custom
. So we create a temp alias with the name custom which is then selected.
I think the problem is that (buffer-file-name)
will return the absolute path and the default-directory
will be set to watever the :directory
options specifies. So, I think something like this should work:
(rg-define-search rg-dwim-current-file
:query point
:format literal
:files (file-name-nondirectory (buffer-file-name))
:dir current)
aha, nice!
Yes, adding :files (buffer-file-name)
but didn't work and I just chickened away and asked here :).
Would you accept a PR for that?
Closed by pr #55
I love the way
rg-dwim
works, the fact that I can narrow down the search to the current directory withc-u
is awesome.Trying to go a step further, I wanted to implement something like:
but the "files" option in rg-define-search is thought for aliases only. Would there be an easy way to search only (buffer-file-name)?