Ripgrep: about the file type support.

Created on 21 Mar 2017  路  5Comments  路  Source: BurntSushi/ripgrep

Hi, maybe I misunderstand the option , that if the file type is in the list of rg --type-list, for example, *.vim, can I use rg 'xxx' -tvim to search text in all *.vim? But now it output unrecognized file type: vim.
I'm using the latest version in 2017-03-21

Most helpful comment

@FinallyFinancialFreedom Thanks! I added the vim file type, so the next release you should be able to do -tvim. :-)

All 5 comments

@FinallyFinancialFreedom Could you please provide a minimal reproducible example? Please show the exact commands you're running, the actual output of each command and the expected output.

ripgrep does not provide a vim file type by default. If you're adding the vim file type manually, then please consider reading the docs carefully:

--type-add ...
Add a new glob for a particular file type. Only one glob can be added at a time.
Multiple --type-add flags can be provided. Unless --type-clear is used, globs are added
to any existing globs defined inside of ripgrep.

Note that this MUST be passed to every invocation of ripgrep. Type settings are NOT
persisted.

Maybe I did not make it clearly.
I assumed that all filetypes in the output of rg --type-list command can be used after -t parameter, is it right?
vimscript: *.vim is in the list, and when i rg something -tvim in vim plugins folder, i got unrecognized file type: vim.. There are fzf.vim and vim.vim file under this folder.

Oh, I see. The type name is on the left hand side. The right hand side are the glob rules. So you would need to use -tvimscript. I would be OK with a PR that add a vim type as well, since vimscript seems annoying to type.

ok, -tvimscript works fine, vimscript is not so intuitive. Whatever, rg is blazing fast. It helps me a lot, thank you for the wonderful job.

@FinallyFinancialFreedom Thanks! I added the vim file type, so the next release you should be able to do -tvim. :-)

Was this page helpful?
0 / 5 - 0 ratings