Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.12k stars 176 forks source link

Does gtags sub-command follow Lf_WorkingDirectoryMode? #604

Open xaljer opened 4 years ago

xaljer commented 4 years ago

Describe your question, feature request, or bug.

I found that Leaderf gtags seems to learn the directory of gtags db files by root markers at vim startup. If I set a root marker which does not indicate the right db files location, Leaderf gtags can not work any more even i give the right root marker again.

For my uncommon usages, I wish to change root markers at run time to make Leaderf rg searching in different directories. And the default root marker may not be the one in directory which gtags indexed.

In the others words, it's better if leaderf file, rg, gtags working in different scope in some huge code base like AOSP. In my example, leaderf file and gtags (without pygments) can work fine in the whole project scope. But it's better to make rg work my real working directory, only searching in whole project in some cases. So, there is an option: g:Lf_WorkingDirectoryMode to specify the leader file behaviors, but i don't know if leaderf gtags follow it too?

In short, does the behaviors i described as designed? and can leaderf gtags always works on 'pwd' if g:Lf_WorkingDirectoryMode == 'c'?

Steps to reproduce

Actual behaviour

leaderf gtags learn working directory by root marks at startup even if let g:Lf_WorkingDirectoryMode = 'c'.

Expected behaviour

leaderf gtags works on 'pwd' when let g:Lf_WorkingDirectoryMode = 'c' no matter what root markers are.

Yggdroot commented 4 years ago

Leaderf gtags does not respect g:Lf_WorkingDirectoryMode, no matter what value g:Lf_WorkingDirectoryMode is, it always works like g:Lf_WorkingDirectoryMode == 'c' . But the value of g:Lf_RootMarkers will affect it.

xaljer commented 4 years ago

@Yggdroot , thanks, but it looks like not very consistent, right? If g:Lf_RootMarkers will affect gtags, it's not conform to the definition of c mode. It's better to have a separate mode option for gtags? Are there some other sub-commands need working directory mode?

Yggdroot commented 4 years ago

For my uncommon usages, I wish to change root markers at run time to make Leaderf rg searching in different directories.

Why do you change root markers at run time? Maybe you are not using Leaderf rg correctly.

xaljer commented 4 years ago
  1. there are 3 cases: a. search in whole project like: Leaderf rg "something". b. search in some sub directory like: Leaderf rg "something" a/sub/directory c. search in the git repository of current file. I don't know the git root directory to tell rg.
  2. Leaderf bar can give me a hint on I'm searching which directory.
Yggdroot commented 4 years ago

I will fix the issue with the solution that Leaderf gtags uses the value of g:Lf_RootMarkers when Leaderf gtags is first time launched, and the change of g:Lf_RootMarkers later won't affect Leaderf gtags, do you agree?

xaljer commented 4 years ago

@Yggdroot , I think this solution won't solve my problem. My expected behaviour is that Leaderf gtags always follow pwd. For more clearly behaviour, I think that Leaderf gtags use pwd or g:Lf_ RootMarkers should depends on Lf_WorkingDirectoryMode or a new one special for gtags.

xaljer commented 4 years ago

Leaderf file/gtags/rg learn the pwd or root markers every time they lunch is the most flexible design, i think.

as79-alex commented 3 years ago

In my case let g:Lf_WorkingDirectoryMode and let g:Lf_RootMarkers does not work at all. | I have many related projects and want to use root at parent folder with .projectRoot file there, whereas each folder inside has .git .

I set up let g:Lf_RootMarkers = ['.projectRoot'] and let g:Lf_WorkingDirectoryMode = 'ac' and it does't work - always start from current dir. Event let g:Lf_WorkingDirectory = expand('%:p:h') from .lvimrc doesn't work

Yggdroot commented 3 years ago

In my case let g:Lf_WorkingDirectoryMode and let g:Lf_RootMarkers does not work at all. | I have many related projects and want to use root at parent folder with .projectRoot file there, whereas each folder inside has .git .

I set up let g:Lf_RootMarkers = ['.projectRoot'] and let g:Lf_WorkingDirectoryMode = 'ac' and it does't work - always start from current dir. Event let g:Lf_WorkingDirectory = expand('%:p:h') from .lvimrc doesn't work

It should work, there must be something wrong with your configuration.