Open gongchencurry opened 1 year ago
Check if you have autochdir
enable in your vim/nvim config, as it will cd to current dir of opening file and :FZF and :AG will use that dir to detect files.
Okay, but what if I don't want to change the autochdir
setting and I just want to give :Ag
a path to use?
Okay, but what if I don't want to change the
autochdir
setting and I just want to give:Ag
a path to use?
i think u can change it via command mode in (n)vim: : cd <path_here>
some plugin will load up its top dir by checking if it's a git repo or smth like that but to have :rg or :ag do search on current folder, u can force set it via cd, u can even save current path and then cd to current dir, do rg/ag, then restore that path later after using :rg or :ag.
Indeed, this works:
:exec 'cd' GetGitRoot() | :Ag
man fzf
)I have a code project named test under the $HOME path. The code structure is as follows
:~/test$ tree . ├── a │ ├── 1.c │ ├── 2.c │ └── c │ └── 3.c └── b ├── 4.c └── 5.c
// I open the 1.c file :~/test$ vi a/1.c
At this point :FZF can find 4. c and 5. c :AG can match the content I want in 4. c and 5. c
However, once the project becomes huge and files become numerous,:FZF and :AG can only detect the same level directory of the opened files, and files in the outer directory cannot be detected
Can someone tell me what the reason is and what solutions are available Thank you.