mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-22 05:19:48 +01:00
Merge pull request #41 from NotAShelf/feature/projects
Feature/projects.nvim
This commit is contained in:
commit
97ed3c168d
11 changed files with 159 additions and 4 deletions
|
@ -136,6 +136,10 @@ inputs: let
|
|||
nvim-notify.enable = true;
|
||||
};
|
||||
|
||||
vim.projects = {
|
||||
project-nvim.enable = true;
|
||||
};
|
||||
|
||||
vim.utility = {
|
||||
colorizer.enable = true;
|
||||
icon-picker.enable = true;
|
||||
|
|
17
flake.lock
17
flake.lock
|
@ -1246,6 +1246,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"project-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1680567592,
|
||||
"narHash": "sha256-avV3wMiDbraxW4mqlEsKy0oeewaRj9Q33K8NzWoaptU=",
|
||||
"owner": "ahmedkhalf",
|
||||
"repo": "project.nvim",
|
||||
"rev": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ahmedkhalf",
|
||||
"repo": "project.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"registers": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1349,6 +1365,7 @@
|
|||
"orgmode-nvim": "orgmode-nvim",
|
||||
"plenary-nvim": "plenary-nvim",
|
||||
"presence-nvim": "presence-nvim",
|
||||
"project-nvim": "project-nvim",
|
||||
"registers": "registers",
|
||||
"rnix-lsp": "rnix-lsp",
|
||||
"rust-tools": "rust-tools",
|
||||
|
|
|
@ -292,6 +292,12 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# Project Management
|
||||
project-nvim = {
|
||||
url = "github:ahmedkhalf/project.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Visuals
|
||||
nvim-cursorline = {
|
||||
url = "github:yamatsum/nvim-cursorline";
|
||||
|
|
|
@ -2,8 +2,4 @@
|
|||
dag = import ./dag.nix {inherit lib;};
|
||||
booleans = import ./booleans.nix {inherit lib;};
|
||||
types = import ./types {inherit lib;};
|
||||
|
||||
imports = [
|
||||
./assertions.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ with lib; let
|
|||
"modes-nvim"
|
||||
"vim-repeat"
|
||||
"smartcolumn"
|
||||
"project-nvim"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginsType = with types;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
./assistant
|
||||
./session
|
||||
./comments
|
||||
./projects
|
||||
];
|
||||
|
||||
pkgsModule = {config, ...}: {
|
||||
|
|
5
modules/projects/default.nix
Normal file
5
modules/projects/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./project-nvim
|
||||
];
|
||||
}
|
62
modules/projects/project-nvim/config.nix
Normal file
62
modules/projects/project-nvim/config.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
options.vim.projects.project-nvim = {
|
||||
enable = mkEnableOption "Enable project-nvim for project management";
|
||||
|
||||
manualMode = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
||||
};
|
||||
|
||||
# detection methods should accept one or more strings from a list
|
||||
detectionMethods = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = ["lsp" "pattern"];
|
||||
description = "Detection methods to use";
|
||||
};
|
||||
|
||||
# patterns
|
||||
patterns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
||||
description = "Patterns to use for pattern detection method";
|
||||
};
|
||||
|
||||
# table of lsp servers to ignore by name
|
||||
lspIgnored = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "LSP servers no ignore by name";
|
||||
};
|
||||
|
||||
excludeDirs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "Directories to exclude from project root search";
|
||||
};
|
||||
|
||||
showHidden = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Show hidden files in telescope picker";
|
||||
};
|
||||
|
||||
silentChdir = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Silently change directory when changing project";
|
||||
};
|
||||
|
||||
scopeChdir = mkOption {
|
||||
type = types.enum ["global" "tab" "win"];
|
||||
default = "global";
|
||||
description = "What scope to change the directory";
|
||||
};
|
||||
};
|
||||
}
|
6
modules/projects/project-nvim/default.nix
Normal file
6
modules/projects/project-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./project-nvim.nix
|
||||
];
|
||||
}
|
51
modules/projects/project-nvim/project-nvim.nix
Normal file
51
modules/projects/project-nvim/project-nvim.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.projects.project-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"project-nvim"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.project-nvim = nvim.dag.entryAnywhere ''
|
||||
require('project_nvim').setup({
|
||||
manual_mode = ${boolToString cfg.manualMode},
|
||||
detection_methods = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.detectionMethods)} },
|
||||
|
||||
-- All the patterns used to detect root dir, when **"pattern"** is in
|
||||
-- detection_methods
|
||||
patterns = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.patterns)} },
|
||||
|
||||
-- Table of lsp clients to ignore by name
|
||||
-- eg: { "efm", ... }
|
||||
ignore_lsp = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.lspIgnored)} },
|
||||
|
||||
-- Don't calculate root dir on specific directories
|
||||
-- Ex: { "~/.cargo/*", ... }
|
||||
exclude_dirs = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.excludeDirs)} },
|
||||
|
||||
-- Show hidden files in telescope
|
||||
show_hidden = ${boolToString cfg.showHidden},
|
||||
|
||||
-- When set to false, you will get a message when project.nvim changes your
|
||||
-- directory.
|
||||
silent_chdir = ${boolToString cfg.silentChdir},
|
||||
|
||||
-- What scope to change the directory, valid options are
|
||||
-- * global (default)
|
||||
-- * tab
|
||||
-- * win
|
||||
scope_chdir = '${toString cfg.scopeChdir}',
|
||||
|
||||
-- Path where project.nvim will store the project history for use in
|
||||
-- telescope
|
||||
datapath = vim.fn.stdpath("data"),
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -109,6 +109,12 @@ in {
|
|||
then "telescope.load_extension('notify')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.projects.project-nvim.enable
|
||||
then "telescope.load_extension('projects')"
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue