configure astrocore more

This commit is contained in:
Prunebutt 2025-11-21 22:08:37 +01:00
parent dc02604cdf
commit e0dfc1e2d1
6 changed files with 112 additions and 13 deletions

View file

@ -1,3 +1,17 @@
{ {pkgs,...}@args: {
enablePrintInit = true; enablePrintInit = true;
# extraPackages = with pkgs; [
# ];
opts = {
relativenumber = true;
number = true;
spell = false;
signcolumn = "yes";
wrap = false;
};
withNodeJs = args.withNojeJs or true;
# TODO: autocmnds necessary?
} }

View file

@ -7,9 +7,7 @@
}; };
outputs = { self, nixpkgs, nixvim, flake-utils, ... }@inputs: outputs = { self, nixpkgs, nixvim, flake-utils, ... }@inputs:
let flake-utils.lib.eachDefaultSystem (system:
config = import ./config; # import the module directly
in flake-utils.lib.eachDefaultSystem (system:
let let
nixvimLib = nixvim.lib.${system}; nixvimLib = nixvim.lib.${system};
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
@ -18,6 +16,16 @@
inherit pkgs; inherit pkgs;
module = ./.; module = ./.;
}; };
mkNixvim = specialArgs:
nixvim.legacyPackages.${system}.makeNixvimWithModule {
inherit pkgs;
module = ./.;
extraSpecialArgs = specialArgs // {
inherit pkgs;
};
};
in { in {
formatter = nixpkgs.legacyPackages.${system}.alejandra; formatter = nixpkgs.legacyPackages.${system}.alejandra;
@ -30,7 +38,8 @@
packages = { packages = {
# Lets you run `nix run .` to start nixvim # Lets you run `nix run .` to start nixvim
default = nvim; default = mkNixvim { };
lite = mkNixvim { withNodeJs = false; };
}; };
devShells.default = import ./shell.nix { inherit pkgs; }; devShells.default = import ./shell.nix { inherit pkgs; };

View file

@ -1,12 +1,12 @@
{pkgs, lib,...}: let {pkgs, lib,...}: let
inherit lib.nixvim.lua.toLuaObject; inherit (lib.nixvim.lua) toLuaObject;
options = { options = {
features = { features = {
large_buf = { size = 1024 * 256; lines = 10000 }; # set global limits for large files for disabling features like treesitter large_buf = { size = 1024 * 256; lines = 10000; }; # set global limits for large files for disabling features like treesitter
autopairs = true; # enable autopairs at start autopairs = true; # enable autopairs at start
cmp = true; # enable completion at start cmp = true; # enable completion at start
diagnostics = { virtual_text = true; virtual_lines = false }; # diagnostic settings on startup diagnostics = { virtual_text = true; virtual_lines = false; }; # diagnostic settings on startup
highlighturl = true; # highlight URLs at start highlighturl = true; # highlight URLs at start
notifications = true; # enable notifications at start notifications = true; # enable notifications at start
}; };
@ -28,11 +28,45 @@
# [".*/etc/foo/.*"] = "fooscript"; # [".*/etc/foo/.*"] = "fooscript";
# }; # };
# }; # };
rooter = {
# list of detectors in order of prevalence, elements can be:
# "lsp" : lsp detection
# string[] : a list of directory patterns to look for
# fun(bufnr: integer): string|string[] : a function that takes a buffer number and outputs detected roots
detector = [
"lsp" # highest priority is getting workspace from running language servers
[ ".git" "_darcs" ".hg" ".bzr" ".svn" ] # next check for a version controlled parent directory
[ "lua" "MakeFile" "package.json" ] # lastly check for known project root files
];
# ignore things from root detection
ignore = {
servers = []; # list of language server names to ignore (Ex. { "efm" })
dirs = []; # list of directory patterns (Ex. { "~/.cargo/*" })
};
# automatically update working directory (update manually with `:AstroRoot`)
autochdir = false;
# scope of working directory to change ("global"|"tab"|"win")
scope = "global";
# show notification on every working directory change
notify = true;
};
sessions = {
autosave = {
last = true; # autosave last session
cwd = true; # auosave session for each working dir
};
# Patterns to ignore when saving sessions
ignore = {
dirs = []; # working directories to ignore sessions in
filetypes = [ "gitcommit" "gitrebase" ]; # filetypes to ignore sessions
buftypes = []; # buffer types to ignore sessions
};
};
}; };
in { in {
extraPlugins = [pkgs.vimPlugins.astrocore]; extraPlugins = [pkgs.vimPlugins.astrocore];
extraConfigLua = /*lua*/ '' extraConfigLua = /*lua*/ ''
require('astrocore').setup(${toLuaObject options}) require('astrocore').setup(${toLuaObject options})
'' '';
} }

7
plugins/astroui.nix Normal file
View file

@ -0,0 +1,7 @@
{pkgs, lib, ...}:{
extraPlugins = [pkgs.vimPlugins.astroui];
extraConfigLua = /*lua*/ ''
require('astroui').setup({});
'';
}

View file

@ -1,5 +1,12 @@
{ {lib, ...}: let
imports = [ definitions = lib.attrNames (
./treesitter.nix lib.filterAttrs
]; (filename: kind:
filename != "default.nix"
&& (kind == "regular" || kind == "directory")
)
(builtins.readDir ./.)
);
in {
imports = map (file: import ./${file}) definitions;
} }

28
plugins/lsp/default.nix Normal file
View file

@ -0,0 +1,28 @@
{pkgs, ...}@args:{
plugins.lsp = {
enable = true;
servers = {
bashls.enable = true;
cssls.enable = true;
docker_compose_language_service.enable = true;
dockerls.enable = true;
helm_ls.enable = true;
html.enable = true;
jsonls.enable = true;
lua_ls.enable = true;
nginx_language_server.enable = true;
nixd.enable = true;
pyright.enable = true;
yamlls.enable = true;
clangd.enable = true;
marksman.enable = true;
texlab.enable = true;
lemminx.enable = true; # XML
java_language_server.enable = false;
zls.enable = false;
rust_analyzer.enable = false;
};
};
}