telescope-project.nvim
telescope-project.nvim copied to clipboard
Feature Request: Search on current project's files
Expose the command to search files in the current project directly so that you can bind a shortcut directly to it. As I see currently you have to invoke the menu, find the current project again and then be able to search on its files.
also a option to disable the find files search instantly after the project has been selected
@matheusfillipe How does it differ to the option "browse inside files within your project" accessible via b/C-b ?
@matu3ba When you are editing a big project sometimes :Telescope find_files will only list files under your current working directory. This plugin always has the feature to fuzzy search over files of the current project regardless of the current working directory. The problem is that it only exposes one command that I can bind to (:lua require'telescope'.extensions.project.project{}<cr>) unless I am mistaken that's the only telescope command it has.
Another problem with the b\C-b thing is that you have to first type the name of the project you are on. What I want is to be able to already search for the files of the current project with a single command.
I guess this project isn't currently keeping track of the last selected project so that would be needed for this, and then expose a command to directly have the file exploring telescope from that menu.
Ah, I get it.
Instead of require'telescope'.extensions.project.project{}<cr> you want
require'telescope'.extensions.project.project{}.all()<cr>
and
require'telescope'.extensions.project.project{}.current()<cr>
Yes, this would help. I am planning this for running scripts (local project) vs editing scripts (all projects). But having it upstream would make things simpler.
Any news on this issue? I'm a convert from doom-emacs and Visual Studio Code. In Doom, I could just hit <Leader> p f or <Leader> <Leader> to search for a file in the current project. I used this all the time!
In VS Code this is covered by hitting Ctrl-P. The files even come up sorted according to recency.
Having this functionality work as frictionless as possible in Neovim is a hard requirement for my workflow. And it's already covered by tools like CommandT or CtrlP. However, I think that Telescope is the way to go from this point on, so having a fast "jump to project-file" is crucial from my point of view.
Hey Tim, I am in the process of figuring out and communicating the intended direction to become maintainer.
There are 3 blockers on the refactor (#75) for this:
- [ ] setting up 2 different entry points/modes with 1 for editing projects and 1 for using projects and prefix relevant functions to make clear if they modify telescope-project.txt and telescopoe-workspaces.txt
- [ ] expose the path of current project as lua function, so users can define their own keybindings
- [ ] encode the behavior of :lcd,:cd and ":nocd" into the picker call functions of telescope-project
- [ ] (no real blocker) provide example keybindings
If you want to move things forward, open a PR for 1. so we can discuss the design and iterate further. Do you have any idea, how I could indicate a "public and user API for other plugins" and "forbidden/private functions" in lua to differentiate the first point?
@matu3ba I'm not a lua-programmer at all and will have difficulties making time to implement this feature. I can't promise anything, but I'll at least take a look at the sourcecode.
@tim-hilt Hey Tim, lua is fairly easy (you have 2 type of tables and functions). Files are also only tables. I am still using this for logging:
local fp = assert(io.open("/tmp/tmpfile", "w")) --DEBUG
for index,tables in pairs(repo_paths) do --DEBUG
fp:write(index) --DEBUG
fp:write(", ") --DEBUG
fp:write(tables) --DEBUG
fp:write("\n") --DEBUG
end --DEBUG
fp.close() --DEBUG
local fp = assert(io.open("/tmp/tmpfile", "w")) --DEBUG
for index,tables in ipairs(repo_paths) do --DEBUG
fp:write(index) --DEBUG
fp:write(", ") --DEBUG
fp:write(tostring(tables)) --DEBUG
fp:write("\n") --DEBUG
end --DEBUG
fp.close() --DEBUG
-- deleting lines ending with DEBUG :g/.*DEBUG$/del
also a option to disable the find files search instantly after the project has been selected
any news on this one?
also a option to disable the find files search instantly after the project has been selected
This bit already exists, see <C-l> when selecting a project.
As for the other issue, if you use Git for your projects you might find Telescope's builtin for git-files more useful than the regular file finder, and it is scoped to the project root.