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

plugins/telescope: add project extension #2792

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake-modules/dev/list-plugins/list-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class State(Enum):
"live-greps-args": False,
"manix": False,
"media-files": True,
"project": False,
"ui-select": False,
"undo": True,
}.items():
Expand Down
1 change: 1 addition & 0 deletions plugins/by-name/telescope/extensions/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
./live-greps-args.nix
./manix.nix
./media-files.nix
./project.nix
./ui-select.nix
./undo.nix
];
Expand Down
34 changes: 34 additions & 0 deletions plugins/by-name/telescope/extensions/project.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
let
mkExtension = import ./_mk-extension.nix;
in
mkExtension {
name = "project";
package = "telescope-project-nvim";

settingsExample = {
khaneliman marked this conversation as resolved.
Show resolved Hide resolved
base_dirs = [
"~/dev/src"
"~/dev/src2"
{
__unkeyed-1 = "~/dev/src3";
max_depth = 4;
}
{ path = "~/dev/src4"; }
{
path = "~/dev/src5";
max_depth = 2;
}
];
hidden_files = true;
theme = "dropdown";
order_by = "asc";
search_by = "title";
sync_with_nvim_tree = true;
on_project_selected.__raw = ''
function(prompt_bufnr)
require("telescope._extensions.project.actions").change_working_directory(prompt_bufnr, false)
require("harpoon.ui").nav_file(1)
end
'';
};
}
104 changes: 104 additions & 0 deletions tests/test-sources/plugins/by-name/telescope/project.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
empty = {
# Tries to create a file on loading
test.runNvim = false;
plugins.telescope = {
enable = true;
extensions.project.enable = true;
};
plugins.web-devicons.enable = true;
};

default = {
# Tries to create a file on loading
test.runNvim = false;
plugins.telescope = {
enable = true;

extensions.project = {
enable = true;

settings = {
base_dirs = null;
cd_scope = [
"tab"
"window"
];
hidden_files = false;
order_by = "recent";
search_by = "title";
sync_with_nvim_tree = false;
on_project_selected.__raw = "require('telescope._extensions.project.actions').find_project_files";
mappings = {
n = {
"d".__raw = "require('telescope._extensions.project.actions').delete_project";
"r".__raw = "require('telescope._extensions.project.actions').rename_project";
"c".__raw = "require('telescope._extensions.project.actions').add_project";
"C".__raw = "require('telescope._extensions.project.actions').add_project_cwd";
"f".__raw = "require('telescope._extensions.project.actions').find_project_files";
"b".__raw = "require('telescope._extensions.project.actions').browse_project_files";
"s".__raw = "require('telescope._extensions.project.actions').search_in_project_files";
"R".__raw = "require('telescope._extensions.project.actions').recent_project_files";
"w".__raw = "require('telescope._extensions.project.actions').change_working_directory";
"o".__raw = "require('telescope._extensions.project.actions').next_cd_scope";
};
i = {
"<c-d>".__raw = "require('telescope._extensions.project.actions').delete_project";
"<c-v>".__raw = "require('telescope._extensions.project.actions').rename_project";
"<c-a>".__raw = "require('telescope._extensions.project.actions').add_project";
"<c-A>".__raw = "require('telescope._extensions.project.actions').add_project_cwd";
"<c-f>".__raw = "require('telescope._extensions.project.actions').find_project_files";
"<c-b>".__raw = "require('telescope._extensions.project.actions').browse_project_files";
"<c-s>".__raw = "require('telescope._extensions.project.actions').search_in_project_files";
"<c-r>".__raw = "require('telescope._extensions.project.actions').recent_project_files";
"<c-l>".__raw = "require('telescope._extensions.project.actions').change_working_directory";
"<c-o>".__raw = "require('telescope._extensions.project.actions').next_cd_scope";
"<c-w>".__raw = "require('telescope._extensions.project.actions').change_workspace";
};
};
};
};
};
plugins.web-devicons.enable = true;
};

example = {
# Tries to create a file on loading
test.runNvim = false;
plugins.telescope = {
enable = true;

extensions.project = {
enable = true;

settings = {
base_dirs = [
"~/dev/src"
"~/dev/src2"
{
__unkeyed-1 = "~/dev/src3";
max_depth = 4;
}
{ path = "~/dev/src4"; }
{
path = "~/dev/src5";
max_depth = 2;
}
];
hidden_files = true;
theme = "dropdown";
order_by = "asc";
search_by = "title";
sync_with_nvim_tree = true;
on_project_selected.__raw = ''
function(prompt_bufnr)
require('telescope._extensions.project.actions').change_working_directory(prompt_bufnr, false)
require("harpoon.ui").nav_file(1)
end
'';
};
};
};
plugins.web-devicons.enable = true;
};
}
Loading