feat(plugins/astrocore): fully configure as in astronvim

This commit is contained in:
Nicolas Goudry 2024-06-07 17:07:38 +02:00
parent 455cb6f839
commit 519e85f142
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44
8 changed files with 1215 additions and 12 deletions

View file

@ -1,27 +1,45 @@
# homepage: https://github.com/AstroNvim/astrocore
{ lib, pkgs, ... }:
{ helpers, icons, lib, pkgs, ... }:
let
autocmds = import ./autocmds.nix;
diagnostics = import ./diagnostics.nix { inherit icons; };
features = import ./features.nix;
mappings = import ./mappings.nix;
options = import ./options.nix { inherit lib; };
rooter = import ./rooter.nix;
sessions = import ./sessions.nix;
in
{
extra = {
packages = [
(import ./package { inherit lib pkgs; })
];
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_options.lua#L49-L53
config = ''
local g = {}
g.markdown_recommended_style = 0
if not vim.t.bufs then vim.t.bufs = vim.api.nvim_list_bufs() end -- initialize buffer list
require('astrocore').setup({
g = {
markdown_recommended_style = 0,
},
t = {
bufs = vim.t.bufs,
diagnostics = ${helpers.toLuaObject diagnostics},
features = ${helpers.toLuaObject features},
options = ${helpers.toLuaObject options.astrocore},
rooter = ${helpers.toLuaObject rooter},
sessions = ${helpers.toLuaObject sessions},
on_keys = {
auto_hlsearch = {
function(char)
if vim.fn.mode() == "n" then
local new_hlsearch = vim.tbl_contains({ "<CR>", "n", "N", "*", "#", "?", "/" }, vim.fn.keytrans(char))
if vim.opt.hlsearch:get() ~= new_hlsearch then vim.opt.hlsearch = new_hlsearch end
end
end,
},
},
})
'';
};
rootOpts = {
inherit (autocmds) autoGroups autoCmd;
inherit (mappings) keymaps;
inherit (options) opts;
};
}