mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-26 18:58:43 +02:00
project-nvim: init plugin (#55)
This commit is contained in:
parent
f0ad4cd2ec
commit
9658aaf990
5 changed files with 107 additions and 0 deletions
|
@ -49,6 +49,7 @@
|
||||||
./utils/notify.nix
|
./utils/notify.nix
|
||||||
./utils/nvim-autopairs.nix
|
./utils/nvim-autopairs.nix
|
||||||
./utils/nvim-tree.nix
|
./utils/nvim-tree.nix
|
||||||
|
./utils/project-nvim.nix
|
||||||
./utils/specs.nix
|
./utils/specs.nix
|
||||||
./utils/startify.nix
|
./utils/startify.nix
|
||||||
./utils/surround.nix
|
./utils/surround.nix
|
||||||
|
|
|
@ -105,4 +105,16 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
mkRaw = r: { __raw = r; };
|
mkRaw = r: { __raw = r; };
|
||||||
|
|
||||||
|
rawType = types.submodule {
|
||||||
|
options = {
|
||||||
|
__raw = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "raw lua code";
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
isRawType = v: lib.isAttrs v && lib.hasAttr "__raw" v && lib.isString v.__raw;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ in
|
||||||
./fzf-native.nix
|
./fzf-native.nix
|
||||||
./fzy-native.nix
|
./fzy-native.nix
|
||||||
./media-files.nix
|
./media-files.nix
|
||||||
|
./project-nvim.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO:add support for aditional filetypes. This requires autocommands!
|
# TODO:add support for aditional filetypes. This requires autocommands!
|
||||||
|
|
15
plugins/telescope/project-nvim.nix
Normal file
15
plugins/telescope/project-nvim.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{ pkgs, config, lib, ...}:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.plugins.telescope.extensions.project-nvim = {
|
||||||
|
enable = mkEnableOption "Enable project-nvim telescope extension";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
plugins.telescope.enabledExtensions = [ "projects" ];
|
||||||
|
};
|
||||||
|
}
|
78
plugins/utils/project-nvim.nix
Normal file
78
plugins/utils/project-nvim.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.plugins.project-nvim;
|
||||||
|
helpers = import ../helpers.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.plugins.project-nvim = {
|
||||||
|
enable = mkEnableOption "Enable project.nvim";
|
||||||
|
|
||||||
|
manualMode = mkOption {
|
||||||
|
type = types.nullOr types.bool;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
detectionMethods = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
patterns = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
ignoreLsp = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
excludeDirs = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
showHidden = mkOption {
|
||||||
|
type = types.nullOr types.bool;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
silentChdir = mkOption {
|
||||||
|
type = types.nullOr types.bool;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
scopeChdir = mkOption {
|
||||||
|
type = types.nullOr (types.enum [ "global" "tab" "win" ]);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
dataPath = mkOption {
|
||||||
|
type = types.nullOr (types.either types.str helpers.rawType);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
options = {
|
||||||
|
manual_mode = cfg.manualMode;
|
||||||
|
detection_methods = cfg.detectionMethods;
|
||||||
|
patterns = cfg.patterns;
|
||||||
|
ignore_lsp = cfg.ignoreLsp;
|
||||||
|
exclude_dirs = cfg.excludeDirs;
|
||||||
|
show_hidden = cfg.showHidden;
|
||||||
|
silent_chdir = cfg.silentChdir;
|
||||||
|
scope_schdir = cfg.scopeChdir;
|
||||||
|
data_path = cfg.dataPath;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [ pkgs.vimPlugins.project-nvim ];
|
||||||
|
|
||||||
|
extraConfigLua = ''
|
||||||
|
require('project_nvim').setup(${helpers.toLuaObject options})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue