Closed mbunkus closed 1 year ago
Oh, missed this issue for some reason. Yeah, I kind of have the same problem myself but fixed it in the early days of this package so have totally forgot it.
The workaround I am using is to define my own filter for C++, containing some additional non standard extension IIRC. In any case your own custom type aliases in rg-custom-type-aliases
will be selected first. Not sure if you can use the same identifier as builtins though.
Not sure what solution would be good here though. Just removing aliases may not fit all if you for instance want c-mode in pure c files. Personally I use my own c++ alias but sometimes use the h
alias to only search in header files. Maybe some kind of reordering or prioritization of aliases may solve most of these problems. Or do you see some case that would not work for your use cases?
Added an implementation of prioritized type aliases. Let me know if it solves your problems.
This is a wish for a feature enhancement. I have several files I often work with whose file name patterns belong to more than one of ripgrep's built-in types. For example,
*.rb
is used both bypuppet
and byruby
,*.h
is used byc
andcpp
andobjc
and so on.Unfortunately the type aliases are sorted alphabetically. For me this means that
rg.el
's default-selected type is always wrong for these types of files:….rb
& execute therg
function,rg.el
suggestspuppet
as the default type as it sorts earlier alphabetically, and I have to always change the selection toruby
— which I often forget, wondering why hits that I know are in myRakefile
aren't shown (Rakefile
is only defined forruby
, not forpuppet
).h
—rg.el
's default file type suggestion is thereforec
It would be nice to have a customizable list of build-in file types that
rg.el
simply ignores (filters out from the list obtained by runningrg --type-list
).At the moment I'm using something like the following to achieve this:
If anyone wants to copy this: it requires
use-package
,dash
&s
.For C++ I then have a custom type called
call
(as in "C/C++ all") that contains all the extensions I usually use with C++.Yeah, this works, but I guess other users might also have use for such a negative filter, and therefore it'd be nice to have one, especially as the snippet above relies on knowledge about how file types cached internally by
rg.el
and is therefore not trivial to obtain.Really not urgent, obviously. But as I've stumbled across this issue several times now I've finally decided to whip up this feature request.
Thanks for your consideration, and generally for your work on
rg.el
!