profiles: add interface settings to the recommended-plugins
This commit is contained in:
parent
f95df25986
commit
02812ef960
4 changed files with 117 additions and 13 deletions
|
@ -12,6 +12,7 @@
|
|||
./modules/plugin.nix
|
||||
./modules/fn.nix
|
||||
|
||||
./modules/plugins/interface/colorizer.nix
|
||||
./modules/plugins/interface/lualine.nix
|
||||
./modules/plugins/language-server/lspconfig.nix
|
||||
./modules/plugins/navigation/hop-nvim.nix
|
||||
|
|
|
@ -32,7 +32,7 @@ let
|
|||
default = "setup";
|
||||
};
|
||||
setupSettings = mkOption {
|
||||
type = nullOr attrs;
|
||||
type = nullOr (either attrs (listOf anything));
|
||||
default = null;
|
||||
};
|
||||
afterSetup = mkOption {
|
||||
|
|
84
modules/plugins/interface/colorizer.nix
Normal file
84
modules/plugins/interface/colorizer.nix
Normal file
|
@ -0,0 +1,84 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) attrNames hasAttr;
|
||||
inherit (lib.nix2lua) nf;
|
||||
|
||||
cfg = config.plugins.interface.colorizer;
|
||||
|
||||
pkgs'.nvim-colorizer-lua = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "nvim-colorizer-lua";
|
||||
version = "2020-06-11";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "norcalli";
|
||||
repo = "nvim-colorizer.lua";
|
||||
rev = "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6";
|
||||
hash = "sha256-6YrnItxExL2C8pNIdLd+hXCjsB2MbZANwWkah6dreD8=";
|
||||
};
|
||||
};
|
||||
|
||||
allFiletypes = lib.unique (cfg.filetypes ++ (attrNames cfg.settings.byFiletype));
|
||||
allFiletypesWithSettings = map
|
||||
(ft:
|
||||
if ft != "*" && !(lib.hasPrefix "!" ft) && hasAttr ft cfg.settings.byFiletype
|
||||
then nf ft cfg.settings.byFiletype.${ft}
|
||||
else ft
|
||||
)
|
||||
allFiletypes;
|
||||
|
||||
in
|
||||
{
|
||||
options.plugins.interface.colorizer = with lib; {
|
||||
enable = mkEnableOption "nvim-colorizer-lua";
|
||||
package = mkPackageOption pkgs' "nvim-colorizer-lua" { };
|
||||
|
||||
filetypes = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = [ "*" "!vim" ];
|
||||
description = ''
|
||||
See: https://github.com/norcalli/nvim-colorizer.lua?tab=readme-ov-file#customization
|
||||
'';
|
||||
};
|
||||
|
||||
settings = {
|
||||
byFiletype = mkOption {
|
||||
type = with types; attrsOf attrs;
|
||||
default = { };
|
||||
example = {
|
||||
css = { rgb_fn = true; };
|
||||
html = { names = false; };
|
||||
};
|
||||
description = ''
|
||||
See: https://github.com/norcalli/nvim-colorizer.lua?tab=readme-ov-file#customization
|
||||
'';
|
||||
};
|
||||
|
||||
overrideDefaults = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
example = {
|
||||
mode = "foreground";
|
||||
};
|
||||
description = ''
|
||||
See: https://github.com/norcalli/nvim-colorizer.lua?tab=readme-ov-file#customization
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Plugin is required to enable 24-bit color
|
||||
vim.opt.termguicolors = true;
|
||||
|
||||
plugin.nvim-colorizer-lua = {
|
||||
name = "colorizer";
|
||||
package = cfg.package;
|
||||
setupSettings = [
|
||||
(if allFiletypesWithSettings == [ ] then [ "*" ] else allFiletypesWithSettings)
|
||||
cfg.settings.overrideDefaults
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,18 +5,37 @@ let inherit (lib.nix2lua) nf; in
|
|||
plugin.editorconfig-nvim.isDependency = lib.mkDefault true;
|
||||
|
||||
plugins = {
|
||||
interface.lualine = {
|
||||
enable = lib.mkDefault true;
|
||||
settings = lib.mkDefault {
|
||||
sections = {
|
||||
lualine_a = [
|
||||
[ "filename" (nf "path" 1) ]
|
||||
];
|
||||
lualine_b = [ "branch" "diff" "diagnostics" ];
|
||||
lualine_c = [ "lsp_progress" ];
|
||||
lualine_x = [ "filesize" "filetype" ];
|
||||
lualine_y = [ "progress" ];
|
||||
lualine_z = [ "location" "mode" ];
|
||||
interface = {
|
||||
colorizer = {
|
||||
enable = lib.mkDefault true;
|
||||
|
||||
filetypes = lib.mkDefault [ "*" ];
|
||||
|
||||
settings = {
|
||||
byFiletype = lib.mkDefault {
|
||||
css = { css = true; };
|
||||
scss = { css = true; };
|
||||
sass = { css = true; };
|
||||
less = { css = true; };
|
||||
};
|
||||
overrideDefaults = lib.mkDefault {
|
||||
names = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
lualine = {
|
||||
enable = lib.mkDefault true;
|
||||
settings = lib.mkDefault {
|
||||
sections = {
|
||||
lualine_a = [
|
||||
[ "filename" (nf "path" 1) ]
|
||||
];
|
||||
lualine_b = [ "branch" "diff" "diagnostics" ];
|
||||
lualine_c = [ "lsp_progress" ];
|
||||
lualine_x = [ "filesize" "filetype" ];
|
||||
lualine_y = [ "progress" ];
|
||||
lualine_z = [ "location" "mode" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue