1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

plugins/venv-selector: init

This commit is contained in:
Gaetan Lepage 2025-10-26 00:39:23 +02:00 committed by Gaétan Lepage
parent 822e21e5b3
commit 24d2ac2373
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,40 @@
{
lib,
config,
...
}:
lib.nixvim.plugins.mkNeovimPlugin {
name = "venv-selector";
package = "venv-selector-nvim";
maintainers = [ lib.maintainers.GaetanLepage ];
dependencies = [
"fd"
];
settingsExample = {
name = [
"venv"
".venv"
];
dap_enabled = true;
pyenv_path = lib.nixvim.nestedLiteralLua "vim.fn.expand('$HOME/.pyenv/versions')";
};
extraConfig = cfg: {
warnings = lib.nixvim.mkWarnings "plugins.venv-selector" (
lib.map
(pickerName: {
when = (cfg.settings.picker or null) == pickerName && !config.plugins.${pickerName}.enable;
message = ''
You have to enable `plugins.${pickerName}` as `settings.picker` is set to `"${pickerName}"`.
'';
})
[
"telescope"
"fzf-lua"
]
);
};
}

View file

@ -0,0 +1,68 @@
{ lib, ... }:
{
empty = {
plugins.venv-selector.enable = true;
};
example = {
plugins.venv-selector = {
enable = true;
settings = {
name = [
"venv"
".venv"
];
dap_enabled = true;
pyenv_path = lib.nixvim.mkRaw "vim.fn.expand('$HOME/.pyenv/versions')";
};
};
};
defaults = {
plugins.venv-selector = {
enable = true;
settings = {
cache.file = "~/.cache/venv-selector/venvs2.json";
hooks = [
(lib.nixvim.mkRaw "require('venv-selector.hooks').dynamic_python_lsp_hook")
];
options = {
on_venv_activate_callback = null;
enable_default_searches = true;
enable_cached_venvs = true;
cached_venv_automatic_activation = true;
activate_venv_in_terminal = true;
set_environment_variables = true;
notify_user_on_venv_activation = false;
search_timeout = 5;
debug = false;
fd_binary_name = lib.nixvim.mkRaw "require('venv-selector.config').find_fd_command_name()";
require_lsp_activation = true;
on_telescope_result_callback = null;
picker_filter_type = "substring";
selected_venv_marker_color = "#00FF00";
selected_venv_marker_icon = "";
picker_icons = [ ];
picker_columns = [
"marker"
"search_icon"
"search_name"
"search_result"
];
picker = "auto";
statusline_func = {
nvchad = null;
lualine = null;
};
picker_options = {
snacks = {
layout.preset = "select";
};
};
};
};
};
};
}