wincent/ferret

Provide ability to override default options passed to each executable

Syn3iotiC opened this issue · 9 comments

I have these 2 map in my init.vim:

nmap <leader>a <Plug>(FerretAck)
nmap <leader>z <Plug>(FerretAckWord)

I want the results exclude specific files such as tags. (I guess full command gonna look like :Ack . --ignore-file=is:tags
I have ~/.ackrc that can be perform this way in Ack command line.
But in neovim, it didn't work.

Any suggestions?

Hm, not sure. I'm not using Ack anymore myself, preferring either ag or rg. I would have thought that Ack would consult the config file if found.

There is a place in the plugin where you could hard-code your preferred options:

let s:executables={
\ 'rg': 'rg --vimgrep --no-heading',
\ 'ag': 'ag',
\ 'ack': 'ack --column --with-filename',
\ 'ack-grep': 'ack-grep --column --with-filename'
\ }

Obviously, this might be the kind of thing that would be useful to offer customizability via an option.

Could you please convince me with 2-3 reasons why most people've recently prefered rg and ag ?
and If it's that good, could you suggest me basic configurations for ripgrep ?

Thanks!

  • People choose ag because it is faster than ack.
  • People choose rg because it is faster than ag.

Basically all of them have similar feature sets. Some of the option names are different, but they all basically have the same options (discoverable through --help).

I've tried rg
here is my config.

let s:executables={
      \   'rg': 'rg --vimgrep --no-heading -g "\!tags"'
      \ }

I tried to exclude filename 'tags'
When I ran rg Customization -g "\!tags", the result is correct.
But using rg inside Ferret caused me error No results for search pattern Customization: press ENTER to continue

NOTE, I tried

let s:executables={
      \   'rg': 'rg --vimgrep --no-heading -g "!tags"'
      \ }

too

I think you want to drop the quotes around !tags. ie. just do:

let s:executables={
      \   'rg': 'rg --vimgrep --no-heading -g !tags'
      \ }

There is no shell involved, so no need to escape for the shell.

Thanks alot!

Hi! Great plugin, I really appreciate all the work you put in.

I was also hoping for an override of the default options as I have a .ripgreprc file which breaks ferret's use of rg:

--max-columns=160
--smart-case

Default Ack usage doesn't work now, e.g. :Ack map. But adding --no-config solves this: :Ack --no-config map.

I can image this option differs per search programming. Can you add --no-config to the ripgrep call or maybe allow people to override this option?

Many thx in advance!

@benvds:

I can image this option differs per search programming. Can you add --no-config to the ripgrep call or maybe allow people to override this option?

Both of those are probably good ideas.

I've done a couple of things now:

  • Add --no-config to the default args list for rg.
  • Add g:FerretExecutableArguments to allow people to set whatever default arguments they want to any or all of the executables that Ferret supports.
  • Add ferret#get_default_arguments() so that you can query the current defaults (useful if you just want to grab the current defaults and tack something additional on the end).