telescope-project.nvim icon indicating copy to clipboard operation
telescope-project.nvim copied to clipboard

Feature Request: auto add project for opened file to list of projects

Open steve-lorimer opened this issue 4 years ago • 4 comments

I'm a vim noob, so I'm not sure how to do this, but I'd like to be able to automatically add the project for an opened file to the list of projects, if it's not already there.

I assume it would be achieved by adding some FileReadPre autocmd.

The workflow would, I guess, be something like:

1 Get file's directory 2. Check if the file has a git root directory (git rev-parse --show-toplevel) 3. If it does, check if that directory doesn't already exist in telescope-projects.txt 4. If it doesn't, add a new project

Does this sound reasonable?

Would this be the recommended approach?

Thanks in advance!

steve-lorimer avatar Nov 08 '21 15:11 steve-lorimer

Its much simpler to config the plugin and place the project folders accordingly as to not deal with autocmds etc.

FileReadPre is for :read cmds. You probably want something with Buf.

matu3ba avatar Nov 10 '21 22:11 matu3ba

config the plugin and place the project folders accordingly

Please could you elaborate, and perhaps show an example?

steve-lorimer avatar Nov 11 '21 10:11 steve-lorimer

https://github.com/nvim-telescope/telescope-project.nvim#available-setup-settings gives some examples. You just place your folders that contain git projects, ie into '~/dev/src3' within for that case 4 levels of nesting.

matu3ba avatar Nov 11 '21 11:11 matu3ba

Ah ok, thanks!

steve-lorimer avatar Nov 11 '21 12:11 steve-lorimer