Skip to content

Commit

Permalink
plugins/telescope: add project extension
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jan 5, 2025
1 parent e07a482 commit 974b1d2
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
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 = {
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;
};
}

0 comments on commit 974b1d2

Please sign in to comment.