Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use project commands like :FzfPreviewProjectFiles and :FzfPreviewProjectMruFiles on non-git repos #314

Open
gitaarik opened this issue Oct 17, 2022 · 2 comments

Comments

@gitaarik
Copy link

gitaarik commented Oct 17, 2022

Problems summary

I can't use project commands like :FzfPreviewProjectFiles and :FzfPreviewProjectMruFiles on non-git repos, even when I use ripgrep, which should make fzf-preview not require git.

Expected

That I can use project commands like :FzfPreviewProjectFiles and :FzfPreviewProjectMruFiles in non-git repo directories.

Proposed solution

So when you have ripgrep installed, the g:fzf_preview_filelist_command, which is used to get the file list from project, uses ripgrep instead of git. Also, you can overwrite g:fzf_preview_filelist_command to any kind of command. So we should not decide for the user whether they are allowed to use the project commands, just because we're not in a git repo.

If I remove this check on whether it's a git repo in these commands:

https://github.com/yuki-yano/fzf-preview.vim/blob/main/src/fzf/resource/project-files.ts#L8-L10
https://github.com/yuki-yano/fzf-preview.vim/blob/main/src/fzf/resource/project-mru.ts#L13-L15

It seems to fix the issue. I can make a PR for this if approved.

@GiuseppeMP
Copy link

@gitaarik Did you tried DirectoryFiles command?

@yuki-yano any thoughts?

@gitaarik
Copy link
Author

gitaarik commented Nov 4, 2022

@GiuseppeMP well there is no FzfPreviewDirectoryMruFiles, only FzfPreviewProjectMruFiles. I also point this out in #313. So if there would be a FzfPreviewDirectoryMruFiles command, then the project commands would maybe not even be necessary anymore, because we could consider every directory a project. This is of course only in the case ripgrep is installed, because only ripgrep is faster than git grep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants