Compare commits

...

10 commits

Author SHA1 Message Date
raf
76783408b2
Merge 8f1b38ee81 into c08d0a79cc 2024-11-10 20:58:19 +00:00
Ching Pei Yang
c08d0a79cc docs: cleanup formatting 2024-11-10 23:38:22 +03:00
Ching Pei Yang
a0281d329b another mistake
name should match package.pname
2024-11-10 23:38:22 +03:00
Ching Pei Yang
cca14c7d29 docs: fix typo 2024-11-10 23:38:22 +03:00
diniamo
c4e75c4c1a wrapper: get meta from wrapped neovim package 2024-11-10 15:05:45 +03:00
6eb5bea5ba docs: update 0.7 release notes 2024-11-10 13:56:48 +03:00
5a95f812ce visuals/tiny-devicons-auto-colors: init module 2024-11-10 13:56:48 +03:00
diniamo
4f93abc2f2 languages/zig: don't bundle zig, improve module 2024-11-10 13:32:55 +03:00
Soliprem
c6ff6bbca6
binds/which-key: changing to the new spec (#448) 2024-11-10 02:09:38 +01:00
Soliprem
516174e296 languages/r: adding formatters 2024-11-10 00:55:13 +03:00
13 changed files with 192 additions and 36 deletions

View file

@ -12,7 +12,7 @@ pattern. Otherwise, the `before` and `after` hooks should do what you need.
```nix ```nix
{ {
config.vim.lazy.plugins = { config.vim.lazy.plugins = {
aerial-nvim = { aerial.nvim = {
# ^^^^^^^^^ this name should match the package.pname or package.name # ^^^^^^^^^ this name should match the package.pname or package.name
package = aerial-nvim; package = aerial-nvim;

View file

@ -6,9 +6,9 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
```nix ```nix
{ {
config.vim.lazy.plugins = { config.vim.lazy.plugins = {
aerial = { "aerial.nvim" = {
package = pkgs.vimPlugins.aerial-nvim; package = pkgs.vimPlugins.aerial-nvim;
setupModule = aerial; setupModule = "aerial";
setupOpts = { setupOpts = {
option_name = true; option_name = true;
}; };

View file

@ -220,6 +220,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim [ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
[credo]: https://github.com/rrrene/credo [credo]: https://github.com/rrrene/credo
[tiny-devicons-auto-colors]: https://github.com/rachartier/tiny-devicons-auto-colors.nvim
- Add `deno fmt` as the default Markdown formatter. This will be enabled - Add `deno fmt` as the default Markdown formatter. This will be enabled
automatically if you have autoformatting enabled, but can be disabled manually automatically if you have autoformatting enabled, but can be disabled manually
@ -288,6 +289,9 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
- Add combined nvf configuration (`config.vim`) into the final package's - Add combined nvf configuration (`config.vim`) into the final package's
passthru as `passthru.neovimConfiguration` for easier debugging. passthru as `passthru.neovimConfiguration` for easier debugging.
- Add support for [tiny-devicons-auto-colors] under
`vim.visuals.tiny-devicons-auto-colors`
[ppenguin](https://github.com/ppenguin): [ppenguin](https://github.com/ppenguin):
- Telescope: - Telescope:
@ -297,6 +301,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
[Soliprem](https://github.com/Soliprem): [Soliprem](https://github.com/Soliprem):
- Add LSP and Treesitter support for R under `vim.languages.R`. - Add LSP and Treesitter support for R under `vim.languages.R`.
- Add formatter suppoort for R, with styler and formatR as options
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with - Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
ccc ccc
- Fixed typo in Otter's setupOpts - Fixed typo in Otter's setupOpts
@ -308,6 +313,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
- Add [Tinymist](https://github.com/Myriad-Dreamin/tinymist] as a formatter for - Add [Tinymist](https://github.com/Myriad-Dreamin/tinymist] as a formatter for
the Typst language module. the Typst language module.
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly` - Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
[Bloxx12](https://github.com/Bloxx12) [Bloxx12](https://github.com/Bloxx12)

View file

@ -1790,6 +1790,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-tiny-devicons-auto-colors": {
"flake": false,
"locked": {
"lastModified": 1724403745,
"narHash": "sha256-Ndkbvxn/x7+fxEYD7JIygqUiItuhoY+4+DaL/pJGKdc=",
"owner": "rachartier",
"repo": "tiny-devicons-auto-colors.nvim",
"rev": "a39fa4c92268832f6034306793b8acbfec2a7549",
"type": "github"
},
"original": {
"owner": "rachartier",
"repo": "tiny-devicons-auto-colors.nvim",
"type": "github"
}
},
"plugin-todo-comments": { "plugin-todo-comments": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -2112,6 +2128,7 @@
"plugin-sqls-nvim": "plugin-sqls-nvim", "plugin-sqls-nvim": "plugin-sqls-nvim",
"plugin-tabular": "plugin-tabular", "plugin-tabular": "plugin-tabular",
"plugin-telescope": "plugin-telescope", "plugin-telescope": "plugin-telescope",
"plugin-tiny-devicons-auto-colors": "plugin-tiny-devicons-auto-colors",
"plugin-todo-comments": "plugin-todo-comments", "plugin-todo-comments": "plugin-todo-comments",
"plugin-toggleterm-nvim": "plugin-toggleterm-nvim", "plugin-toggleterm-nvim": "plugin-toggleterm-nvim",
"plugin-tokyonight": "plugin-tokyonight", "plugin-tokyonight": "plugin-tokyonight",

View file

@ -464,6 +464,11 @@
flake = false; flake = false;
}; };
plugin-tiny-devicons-auto-colors = {
url = "github:rachartier/tiny-devicons-auto-colors.nvim";
flake = false;
};
plugin-gitsigns-nvim = { plugin-gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim"; url = "github:lewis6991/gitsigns.nvim";
flake = false; flake = false;

View file

@ -128,9 +128,10 @@ in {
# will return the configuration in full. # will return the configuration in full.
passthru.neovimConfig = vimOptions; passthru.neovimConfig = vimOptions;
meta = { meta =
description = "Wrapped version of Neovim with additional helper scripts"; neovim-wrapped.meta
mainProgram = "nvim"; // {
description = "Wrapped Neovim package with helper scripts to print the config (path)";
}; };
}; };
} }

View file

@ -15,7 +15,38 @@
cfg = config.vim.languages.r; cfg = config.vim.languages.r;
r-with-languageserver = pkgs.rWrapper.override { r-with-languageserver = pkgs.rWrapper.override {
packages = with pkgs.rPackages; [languageserver]; packages = [pkgs.rPackages.languageserver];
};
defaultFormat = "format_r";
formats = {
styler = {
package = pkgs.rWrapper.override {
packages = [pkgs.rPackages.styler];
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.styler.with({
command = "${cfg.format.package}/bin/R",
})
)
'';
};
format_r = {
package = pkgs.rWrapper.override {
packages = [pkgs.rPackages.formatR];
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.format_r.with({
command = "${cfg.format.package}/bin/R",
})
)
'';
};
}; };
defaultServer = "r_language_server"; defaultServer = "r_language_server";
@ -62,6 +93,22 @@ in {
default = servers.${cfg.lsp.server}.package; default = servers.${cfg.lsp.server}.package;
}; };
}; };
format = {
enable = mkEnableOption "R formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "R formatter to use";
};
package = mkOption {
type = package;
default = formats.${cfg.format.type}.package;
description = "R formatter package";
};
};
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
@ -70,6 +117,11 @@ in {
vim.treesitter.grammars = [cfg.treesitter.package]; vim.treesitter.grammars = [cfg.treesitter.package];
}) })
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
})
(mkIf cfg.lsp.enable { (mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true; vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig; vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;

View file

@ -4,13 +4,33 @@
lib, lib,
... ...
}: let }: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList; inherit (lib.lists) isList;
inherit (lib.types) either listOf package str; inherit (lib.types) either listOf package str enum;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.nvim.types) mkGrammarOption;
defaultServer = "zls";
servers = {
zls = {
package = pkgs.zls;
internalFormatter = true;
lspConfig = ''
lspconfig.zls.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else "{'${cfg.lsp.package}/bin/zls'}"
}
}
'';
};
};
cfg = config.vim.languages.zig; cfg = config.vim.languages.zig;
in { in {
options.vim.languages.zig = { options.vim.languages.zig = {
@ -22,20 +42,19 @@ in {
}; };
lsp = { lsp = {
enable = mkEnableOption "Zig LSP support (zls)" // {default = config.vim.languages.enableLSP;}; enable = mkEnableOption "Zig LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "Zig LSP server to use";
};
package = mkOption { package = mkOption {
description = "ZLS package, or the command to run as a list of strings"; description = "ZLS package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
type = either package (listOf str); type = either package (listOf str);
default = pkgs.zls; default = pkgs.zls;
}; };
zigPackage = mkOption {
description = "Zig package used by ZLS";
type = package;
default = pkgs.zig;
};
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
@ -46,23 +65,7 @@ in {
(mkIf cfg.lsp.enable { (mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true; vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.zig-lsp = '' vim.lsp.lspconfig.sources.zig-lsp = servers.${cfg.lsp.server}.lspConfig;
lspconfig.zls.setup {
capabilities = capabilities,
on_attach=default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/zls"}''
},
settings = {
["zls"] = {
zig_exe_path = "${cfg.lsp.zigPackage}/bin/zig",
zig_lib_path = "${cfg.lsp.zigPackage}/lib/zig",
}
}
}
'';
}) })
]); ]);
} }

View file

@ -5,9 +5,12 @@
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.binds.whichKey; cfg = config.vim.binds.whichKey;
register = mapAttrsToList (n: v: mkLuaInline "{ '${n}', desc = '${v}' }") cfg.register;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
@ -16,7 +19,7 @@ in {
pluginRC.whichkey = entryAnywhere '' pluginRC.whichkey = entryAnywhere ''
local wk = require("which-key") local wk = require("which-key")
wk.setup (${toLuaObject cfg.setupOpts}) wk.setup (${toLuaObject cfg.setupOpts})
wk.register(${toLuaObject cfg.register}) wk.add(${toLuaObject register})
''; '';
}; };
}; };

View file

@ -15,5 +15,6 @@ in {
./nvim-cursorline ./nvim-cursorline
./nvim-scrollbar ./nvim-scrollbar
./nvim-web-devicons ./nvim-web-devicons
./tiny-devicons-auto-colors
]; ];
} }

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.tiny-devicons-auto-colors;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["tiny-devicons-auto-colors" "nvim-web-devicons"];
pluginRC.tiny-devicons-auto-colors = entryAnywhere ''
require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./tiny-devicons-auto-colors.nix
];
}

View file

@ -0,0 +1,41 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) int float;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
in {
options.vim.visuals.tiny-devicons-auto-colors = {
enable = mkEnableOption "alternative nvim-web-devicons icon colors [tiny-devicons-auto-colors]";
setupOpts = mkPluginSetupOption "tiny-devicons-auto-colors" {
factors = {
lightness = mkOption {
type = float;
default = 1.76;
description = "Lightness factor of icons";
};
chroma = mkOption {
type = int;
default = 1;
description = "Chroma factor of icons";
};
hue = mkOption {
type = float;
default = 1.25;
description = "Hue factor of icons";
};
cache = {
enabled = mkEnableOption "caching of icon colors. This will greatly improve performance" // {default = true;};
path = mkOption {
type = luaInline;
default = mkLuaInline "vim.fn.stdpath(\"cache\") .. \"/tiny-devicons-auto-colors-cache.json\"";
description = "Path to the cache file";
};
};
};
};
};
}