mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
Compare commits
36 commits
397dd4d134
...
f057ed34f1
Author | SHA1 | Date | |
---|---|---|---|
|
f057ed34f1 | ||
|
b6785f8218 | ||
|
250b503ef5 | ||
|
8a827f92c9 | ||
|
c99afe12c3 | ||
|
2bce0d957b | ||
|
8099b9c821 | ||
|
2df52f6ec4 | ||
|
a79827f1f3 | ||
|
22cfec78db | ||
|
0b0bbfd348 | ||
|
2aad0fb838 | ||
|
7a5c75b865 | ||
|
1df720f86c | ||
|
e39d469da9 | ||
|
947cf90878 | ||
|
a07e113f3a | ||
|
12b650fea7 | ||
|
c08d0a79cc | ||
|
a0281d329b | ||
|
cca14c7d29 | ||
|
c4e75c4c1a | ||
6eb5bea5ba | |||
5a95f812ce | |||
|
4f93abc2f2 | ||
|
c6ff6bbca6 | ||
|
516174e296 | ||
d3d5bbec92 | |||
3af7e4416e | |||
a42a4a4fb6 | |||
7a0e7739c5 | |||
|
715408d2bd | ||
|
1604c7423f | ||
|
dfdad4c2ce | ||
43e3663b2b | |||
|
b302e151e1 |
34 changed files with 714 additions and 426 deletions
|
@ -46,6 +46,8 @@ isMaximal: {
|
||||||
|
|
||||||
nix.enable = true;
|
nix.enable = true;
|
||||||
|
|
||||||
|
# Assembly is not common, and the asm LSP is a major hit-or-miss
|
||||||
|
assembly.enable = false;
|
||||||
markdown.enable = isMaximal;
|
markdown.enable = isMaximal;
|
||||||
html.enable = isMaximal;
|
html.enable = isMaximal;
|
||||||
css.enable = isMaximal;
|
css.enable = isMaximal;
|
||||||
|
|
|
@ -11,7 +11,7 @@ be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise,
|
||||||
```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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
||||||
|
@ -307,6 +312,8 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
- Add LSP, formatter and Treesitter support for Vala under `vim.languages.vala`
|
- Add LSP, formatter and Treesitter support for Vala under `vim.languages.vala`
|
||||||
- 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`
|
||||||
|
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
|
533
flake.lock
533
flake.lock
File diff suppressed because it is too large
Load diff
21
flake.nix
21
flake.nix
|
@ -21,6 +21,7 @@
|
||||||
./flake/legacyPackages.nix
|
./flake/legacyPackages.nix
|
||||||
./flake/overlays.nix
|
./flake/overlays.nix
|
||||||
./flake/packages.nix
|
./flake/packages.nix
|
||||||
|
./flake/develop.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
|
@ -56,20 +57,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {pkgs, ...}: {
|
||||||
self',
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
devShells = {
|
|
||||||
default = self'.devShells.lsp;
|
|
||||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
|
||||||
lsp = pkgs.mkShell {
|
|
||||||
packages = with pkgs; [nil statix deadnix alejandra];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Provide the default formatter. `nix fmt` in project root
|
# Provide the default formatter. `nix fmt` in project root
|
||||||
# will format available files with the correct formatter.
|
# will format available files with the correct formatter.
|
||||||
# P.S: Please do not format with nixfmt! It messes with many
|
# P.S: Please do not format with nixfmt! It messes with many
|
||||||
|
@ -468,6 +456,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;
|
||||||
|
|
30
flake/develop.nix
Normal file
30
flake/develop.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{lib, ...}: {
|
||||||
|
perSystem = {
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
self',
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
devShells = {
|
||||||
|
default = self'.devShells.lsp;
|
||||||
|
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
|
||||||
|
lsp = pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs; [nil statix deadnix alejandra];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# This package exists to make development easier by providing the place and
|
||||||
|
# boilerplate to build a test nvf configuration. Feel free to use this for
|
||||||
|
# testing, but make sure to discard the changes before creating a pull
|
||||||
|
# request.
|
||||||
|
packages.dev = let
|
||||||
|
configuration = {};
|
||||||
|
|
||||||
|
customNeovim = lib.nvim.neovimConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = [configuration];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
customNeovim.neovim;
|
||||||
|
};
|
||||||
|
}
|
|
@ -79,14 +79,14 @@
|
||||||
expr = true;
|
expr = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSetLznBinding = binding: action: {
|
mkSetLznBinding = mode: binding: action: {
|
||||||
inherit action;
|
inherit action mode;
|
||||||
key = binding.value;
|
key = binding.value;
|
||||||
desc = binding.description;
|
desc = binding.description;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSetLuaLznBinding = binding: action: {
|
mkSetLuaLznBinding = mode: binding: action: {
|
||||||
inherit action;
|
inherit action mode;
|
||||||
key = binding.value;
|
key = binding.value;
|
||||||
lua = true;
|
lua = true;
|
||||||
desc = binding.description;
|
desc = binding.description;
|
||||||
|
|
|
@ -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)";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,5 +54,10 @@ in {
|
||||||
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
||||||
(accidental) leaking of user configuration.
|
(accidental) leaking of user configuration.
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
(mkRemovedOptionModule ["vim" "lsp" "trouble" "mappings" "toggle"] ''
|
||||||
|
With Trouble having so many different modes, and breaking changes
|
||||||
|
upstream, it no longer makes sense, nor works, to toggle only Trouble.
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
|
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
|
||||||
|
|
||||||
|
borders = config.vim.ui.borders.plugins.nvim-cmp;
|
||||||
|
|
||||||
cfg = config.vim.autocomplete.nvim-cmp;
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||||
getPluginName = plugin:
|
getPluginName = plugin:
|
||||||
|
@ -42,6 +44,20 @@ in {
|
||||||
after = ''
|
after = ''
|
||||||
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
local kinds = require("cmp.types").lsp.CompletionItemKind
|
||||||
|
local deprio = function(kind)
|
||||||
|
return function(e1, e2)
|
||||||
|
if e1:get_kind() == kind then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if e2:get_kind() == kind then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
cmp.setup(${toLuaObject cfg.setupOpts})
|
cmp.setup(${toLuaObject cfg.setupOpts})
|
||||||
|
|
||||||
${optionalString config.vim.lazy.enable
|
${optionalString config.vim.lazy.enable
|
||||||
|
@ -67,10 +83,9 @@ in {
|
||||||
setupOpts = {
|
setupOpts = {
|
||||||
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
||||||
|
|
||||||
# TODO: try to get nvim-cmp to follow global border style
|
window = mkIf borders.enable {
|
||||||
window = mkIf config.vim.ui.borders.enable {
|
completion.border = borders.style;
|
||||||
completion = mkLuaInline "cmp.config.window.bordered()";
|
documentation.border = borders.style;
|
||||||
documentation = mkLuaInline "cmp.config.window.bordered()";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
formatting.format = cfg.format;
|
formatting.format = cfg.format;
|
||||||
|
|
|
@ -29,6 +29,8 @@ in {
|
||||||
sorting.comparators = mkOption {
|
sorting.comparators = mkOption {
|
||||||
type = mergelessListOf (either str luaInline);
|
type = mergelessListOf (either str luaInline);
|
||||||
default = [
|
default = [
|
||||||
|
(mkLuaInline "deprio(kinds.Text)")
|
||||||
|
(mkLuaInline "deprio(kinds.Snippet)")
|
||||||
"offset"
|
"offset"
|
||||||
"exact"
|
"exact"
|
||||||
"score"
|
"score"
|
||||||
|
@ -43,6 +45,12 @@ in {
|
||||||
(see `:help cmp-config.sorting.comparators`),
|
(see `:help cmp-config.sorting.comparators`),
|
||||||
or a string, in which case the builtin comparator with that name will
|
or a string, in which case the builtin comparator with that name will
|
||||||
be used.
|
be used.
|
||||||
|
|
||||||
|
A `deprio` function and a `kinds`
|
||||||
|
(`require("cmp.types").lsp.CompletionItemKind`) variable is provided
|
||||||
|
above `setupOpts`. By passing a type to the funcion, the returned
|
||||||
|
function will be a comparator that always ranks the specified kind the
|
||||||
|
lowest.
|
||||||
'';
|
'';
|
||||||
apply = map (
|
apply = map (
|
||||||
c:
|
c:
|
||||||
|
@ -64,7 +72,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format = mkOption {
|
format = mkOption {
|
||||||
type = luaInline;
|
type = nullOr luaInline;
|
||||||
default = mkLuaInline ''
|
default = mkLuaInline ''
|
||||||
function(entry, vim_item)
|
function(entry, vim_item)
|
||||||
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
||||||
|
|
|
@ -60,7 +60,7 @@ in {
|
||||||
inherit (cfg.ui) setupOpts;
|
inherit (cfg.ui) setupOpts;
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
(mkSetLuaLznBinding "n" mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals.nvimWebDevicons.enable = true;
|
visuals.nvim-web-devicons.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
49
modules/plugins/languages/asm.nix
Normal file
49
modules/plugins/languages/asm.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.types) package;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.assembly;
|
||||||
|
in {
|
||||||
|
options.vim.languages.assembly = {
|
||||||
|
enable = mkEnableOption "Assembly support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Assembly treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "asm";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.asm-lsp;
|
||||||
|
description = "asm-lsp package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.asm-lsp = ''
|
||||||
|
lspconfig.asm_lsp.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = {"${cfg.lsp.package}/bin/asm-lsp"},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
inherit (lib.nvim.languages) mkEnable;
|
inherit (lib.nvim.languages) mkEnable;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
./asm.nix
|
||||||
./bash.nix
|
./bash.nix
|
||||||
./dart.nix
|
./dart.nix
|
||||||
./clang.nix
|
./clang.nix
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.tinymist.setup {
|
lspconfig.tinymist.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
single_file_support = true,
|
||||||
on_attach = default_on_attach,
|
on_attach = default_on_attach,
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
|
|
|
@ -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",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,19 +21,18 @@ in {
|
||||||
|
|
||||||
cmd = "Trouble";
|
cmd = "Trouble";
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
(mkSetLznBinding "n" mappings.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>")
|
||||||
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>")
|
||||||
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Trouble toggle lsp_references<CR>")
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
(mkSetLznBinding "n" mappings.quickfix "<cmd>Trouble toggle quickfix<CR>")
|
||||||
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
(mkSetLznBinding "n" mappings.locList "<cmd>Trouble toggle loclist<CR>")
|
||||||
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
(mkSetLznBinding "n" mappings.symbols "<cmd>Trouble toggle symbols<CR>")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>l" = "Trouble";
|
|
||||||
"<leader>x" = "+Trouble";
|
"<leader>x" = "+Trouble";
|
||||||
"<leader>lw" = "Workspace";
|
"<leader>lw" = "+Workspace";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,12 +10,12 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "Trouble" {};
|
setupOpts = mkPluginSetupOption "Trouble" {};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
|
||||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||||
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
||||||
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
||||||
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
||||||
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
||||||
|
symbols = mkMappingOption "Symbols [trouble]" "<leader>xs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,7 @@ in {
|
||||||
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
||||||
++ optional cfg.lazygit.enable {
|
++ optional cfg.lazygit.enable {
|
||||||
key = cfg.lazygit.mappings.open;
|
key = cfg.lazygit.mappings.open;
|
||||||
|
mode = "n";
|
||||||
desc = lazygitMapDesc;
|
desc = lazygitMapDesc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ in {
|
||||||
setup = {
|
setup = {
|
||||||
style ? "dark",
|
style ? "dark",
|
||||||
transparent ? false,
|
transparent ? false,
|
||||||
|
...
|
||||||
}: let
|
}: let
|
||||||
style' =
|
style' =
|
||||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||||
|
@ -117,6 +118,7 @@ in {
|
||||||
setup = {
|
setup = {
|
||||||
style ? "dark",
|
style ? "dark",
|
||||||
transparent ? false,
|
transparent ? false,
|
||||||
|
...
|
||||||
}: ''
|
}: ''
|
||||||
-- Gruvbox theme
|
-- Gruvbox theme
|
||||||
require("gruvbox").setup({
|
require("gruvbox").setup({
|
||||||
|
@ -152,6 +154,7 @@ in {
|
||||||
setup = {
|
setup = {
|
||||||
style ? "main",
|
style ? "main",
|
||||||
transparent ? false,
|
transparent ? false,
|
||||||
|
...
|
||||||
}: ''
|
}: ''
|
||||||
require("rose-pine").setup({
|
require("rose-pine").setup({
|
||||||
dark_variant = "${style}", -- main, moon, or dawn
|
dark_variant = "${style}", -- main, moon, or dawn
|
||||||
|
|
|
@ -4,33 +4,23 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
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.startPlugins = ["which-key"];
|
vim = {
|
||||||
|
startPlugins = ["which-key"];
|
||||||
|
|
||||||
vim.pluginRC.whichkey = entryAnywhere ''
|
pluginRC.whichkey = entryAnywhere ''
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
wk.setup ({
|
wk.setup (${toLuaObject cfg.setupOpts})
|
||||||
key_labels = {
|
wk.add(${toLuaObject register})
|
||||||
["<space>"] = "SPACE",
|
|
||||||
["<leader>"] = "SPACE",
|
|
||||||
["<cr>"] = "RETURN",
|
|
||||||
["<tab>"] = "TAB",
|
|
||||||
},
|
|
||||||
|
|
||||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
|
||||||
window = {
|
|
||||||
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
|
||||||
},
|
|
||||||
''}
|
|
||||||
})
|
|
||||||
|
|
||||||
wk.register(${toLuaObject cfg.register})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./which-key.nix
|
./which-key.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -1,14 +1,51 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
config,
|
||||||
inherit (lib.types) attrsOf nullOr str;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) attrsOf nullOr str attrs enum bool;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.binds.whichKey = {
|
options.vim.binds.whichKey = {
|
||||||
enable = mkEnableOption "which-key keybind helper menu";
|
enable = mkEnableOption "which-key keybind helper menu";
|
||||||
|
|
||||||
register = mkOption {
|
register = mkOption {
|
||||||
description = "Register label for which-key keybind helper menu";
|
|
||||||
type = attrsOf (nullOr str);
|
type = attrsOf (nullOr str);
|
||||||
default = {};
|
default = {};
|
||||||
|
description = "Register label for which-key keybind helper menu";
|
||||||
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "which-key" {
|
||||||
|
preset = mkOption {
|
||||||
|
type = enum ["classic" "modern" "helix"];
|
||||||
|
default = "modern";
|
||||||
|
description = "The default preset for the which-key window";
|
||||||
|
};
|
||||||
|
|
||||||
|
notify = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Show a warning when issues were detected with mappings";
|
||||||
|
};
|
||||||
|
|
||||||
|
replace = mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = {
|
||||||
|
"<space>" = "SPACE";
|
||||||
|
"<leader>" = "SPACE";
|
||||||
|
"<cr>" = "RETURN";
|
||||||
|
"<tab>" = "TAB";
|
||||||
|
};
|
||||||
|
description = "Functions/Lua Patterns for formatting the labels";
|
||||||
|
};
|
||||||
|
|
||||||
|
win = {
|
||||||
|
border = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = config.vim.ui.borders.plugins.which-key.style;
|
||||||
|
description = "Which-key window border style";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,36 +34,37 @@ in {
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
[
|
[
|
||||||
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
(mkSetLznBinding "n" mappings.findFiles "<cmd>Telescope find_files<CR>")
|
||||||
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
(mkSetLznBinding "n" mappings.liveGrep "<cmd>Telescope live_grep<CR>")
|
||||||
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
(mkSetLznBinding "n" mappings.buffers "<cmd>Telescope buffers<CR>")
|
||||||
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
(mkSetLznBinding "n" mappings.helpTags "<cmd>Telescope help_tags<CR>")
|
||||||
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
(mkSetLznBinding "n" mappings.open "<cmd>Telescope<CR>")
|
||||||
|
(mkSetLznBinding "n" mappings.resume "<cmd>Telescope resume<CR>")
|
||||||
|
|
||||||
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
(mkSetLznBinding "n" mappings.gitCommits "<cmd>Telescope git_commits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
(mkSetLznBinding "n" mappings.gitBufferCommits "<cmd>Telescope git_bcommits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
(mkSetLznBinding "n" mappings.gitBranches "<cmd>Telescope git_branches<CR>")
|
||||||
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
(mkSetLznBinding "n" mappings.gitStatus "<cmd>Telescope git_status<CR>")
|
||||||
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
(mkSetLznBinding "n" mappings.gitStash "<cmd>Telescope git_stash<CR>")
|
||||||
]
|
]
|
||||||
++ (optionals config.vim.lsp.enable [
|
++ (optionals config.vim.lsp.enable [
|
||||||
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
(mkSetLznBinding "n" mappings.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>")
|
||||||
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
(mkSetLznBinding "n" mappings.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>")
|
||||||
|
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Telescope lsp_references<CR>")
|
||||||
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
(mkSetLznBinding "n" mappings.lspImplementations "<cmd>Telescope lsp_implementations<CR>")
|
||||||
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
(mkSetLznBinding "n" mappings.lspDefinitions "<cmd>Telescope lsp_definitions<CR>")
|
||||||
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
(mkSetLznBinding "n" mappings.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>")
|
||||||
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.diagnostics "<cmd>Telescope diagnostics<CR>")
|
||||||
])
|
])
|
||||||
++ (
|
++ (
|
||||||
optionals config.vim.treesitter.enable [
|
optionals config.vim.treesitter.enable [
|
||||||
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
(mkSetLznBinding "n" mappings.treesitter "<cmd>Telescope treesitter<CR>")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
++ (
|
++ (
|
||||||
optionals config.vim.projects.project-nvim.enable [
|
optionals config.vim.projects.project-nvim.enable [
|
||||||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
(mkSetLznBinding "n" mappings.findProjects "<cmd>Telescope projects<CR>")
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule ["vim" "visuals" "enable"] ''
|
(mkRemovedOptionModule ["vim" "visuals" "enable"] ''
|
||||||
As top-level toggles are being deprecated, you are encouraged
|
As top-level toggles are being deprecated, you are encouraged to handle plugin
|
||||||
to handle plugin toggles under individual options.
|
toggles under individual options.
|
||||||
'')
|
'')
|
||||||
|
|
||||||
./cellular-automaton
|
./cellular-automaton
|
||||||
|
@ -15,5 +15,6 @@ in {
|
||||||
./nvim-cursorline
|
./nvim-cursorline
|
||||||
./nvim-scrollbar
|
./nvim-scrollbar
|
||||||
./nvim-web-devicons
|
./nvim-web-devicons
|
||||||
|
./tiny-devicons-auto-colors
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ in {
|
||||||
enable = mkEnableOption "Neovim dev icons [nvim-web-devicons]";
|
enable = mkEnableOption "Neovim dev icons [nvim-web-devicons]";
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "nvim-web-devicons" {
|
setupOpts = mkPluginSetupOption "nvim-web-devicons" {
|
||||||
color_icons = mkEnableOption "different highlight colors per icon";
|
color_icons = mkEnableOption "different highlight colors per icon" // {default = true;};
|
||||||
variant = mkOption {
|
variant = mkOption {
|
||||||
type = nullOr (enum ["light" "dark"]);
|
type = nullOr (enum ["light" "dark"]);
|
||||||
default = null;
|
default = null;
|
||||||
|
|
21
modules/plugins/visuals/tiny-devicons-auto-colors/config.nix
Normal file
21
modules/plugins/visuals/tiny-devicons-auto-colors/config.nix
Normal 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})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./tiny-devicons-auto-colors.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -9,7 +9,6 @@
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.dag) entryBefore entryAfter;
|
|
||||||
cfg = config.vim.lazy;
|
cfg = config.vim.lazy;
|
||||||
|
|
||||||
toLuaLznKeySpec = keySpec:
|
toLuaLznKeySpec = keySpec:
|
||||||
|
@ -59,6 +58,16 @@
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
load =
|
||||||
|
if spec.load != null
|
||||||
|
then
|
||||||
|
mkLuaInline ''
|
||||||
|
funcion()
|
||||||
|
${spec.load}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else null;
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||||
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
||||||
|
|
|
@ -22,21 +22,21 @@
|
||||||
'';
|
'';
|
||||||
|
|
||||||
desc = mkOption {
|
desc = mkOption {
|
||||||
description = "Description of the key map";
|
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Description of the key map";
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = mkOption {
|
ft = mkOption {
|
||||||
description = "TBD";
|
|
||||||
type = nullOr (listOf str);
|
type = nullOr (listOf str);
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "TBD";
|
||||||
};
|
};
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Modes to bind in";
|
|
||||||
type = either str (listOf str);
|
type = either str (listOf str);
|
||||||
default = ["n" "x" "s" "o"];
|
example = ["n" "x" "o"];
|
||||||
|
description = "Modes to bind in";
|
||||||
};
|
};
|
||||||
|
|
||||||
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||||
|
@ -48,6 +48,21 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lznEvent = submodule {
|
||||||
|
options = {
|
||||||
|
event = mkOption {
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
example = "BufEnter";
|
||||||
|
description = "Exact event name";
|
||||||
|
};
|
||||||
|
pattern = mkOption {
|
||||||
|
type = nullOr (either str (listOf str));
|
||||||
|
example = "BufEnter *.lua";
|
||||||
|
description = "Event pattern";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
lznPluginType = submodule {
|
lznPluginType = submodule {
|
||||||
options = {
|
options = {
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
@ -57,84 +72,67 @@
|
||||||
|
|
||||||
setupModule = mkOption {
|
setupModule = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Lua module to run setup function on.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua module to run setup function on.";
|
||||||
};
|
};
|
||||||
|
|
||||||
setupOpts = mkOption {
|
setupOpts = mkOption {
|
||||||
type = submodule {freeformType = attrsOf anything;};
|
type = attrsOf anything;
|
||||||
description = "Options to pass to the setup function";
|
|
||||||
default = {};
|
default = {};
|
||||||
|
description = "Options to pass to the setup function";
|
||||||
};
|
};
|
||||||
|
|
||||||
# lz.n options
|
# lz.n options
|
||||||
|
|
||||||
enabled = mkOption {
|
enabled = mkOption {
|
||||||
type = nullOr (either bool str);
|
type = nullOr (either bool str);
|
||||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll = mkOption {
|
beforeAll = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||||
};
|
};
|
||||||
|
|
||||||
before = mkOption {
|
before = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||||
};
|
};
|
||||||
|
|
||||||
after = mkOption {
|
after = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Lua code to run after plugin is loaded. This will be wrapped in a function.
|
Lua code to run after plugin is loaded. This will be wrapped in a function.
|
||||||
|
|
||||||
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
|
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
|
||||||
'';
|
'';
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
description = "Lazy-load on event";
|
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
||||||
default = null;
|
default = null;
|
||||||
type = let
|
description = "Lazy-load on event";
|
||||||
event = submodule {
|
|
||||||
options = {
|
|
||||||
event = mkOption {
|
|
||||||
type = nullOr (either str (listOf str));
|
|
||||||
description = "Exact event name";
|
|
||||||
example = "BufEnter";
|
|
||||||
};
|
|
||||||
pattern = mkOption {
|
|
||||||
type = nullOr (either str (listOf str));
|
|
||||||
description = "Event pattern";
|
|
||||||
example = "BufEnter *.lua";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
nullOr (oneOf [str (listOf str) event]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cmd = mkOption {
|
cmd = mkOption {
|
||||||
description = "Lazy-load on command";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
|
default = null;
|
||||||
|
description = "Lazy-load on command";
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = mkOption {
|
ft = mkOption {
|
||||||
description = "Lazy-load on filetype";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
|
default = null;
|
||||||
|
description = "Lazy-load on filetype";
|
||||||
};
|
};
|
||||||
|
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
description = "Lazy-load on key mapping";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||||
|
default = null;
|
||||||
example = ''
|
example = ''
|
||||||
keys = [
|
keys = [
|
||||||
{
|
{
|
||||||
|
@ -152,20 +150,21 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
|
description = "Lazy-load on key mapping";
|
||||||
};
|
};
|
||||||
|
|
||||||
colorscheme = mkOption {
|
colorscheme = mkOption {
|
||||||
description = "Lazy-load on colorscheme.";
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lazy-load on colorscheme.";
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
||||||
|
|
||||||
priority = mkOption {
|
priority = mkOption {
|
||||||
type = nullOr int;
|
type = nullOr int;
|
||||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||||
};
|
};
|
||||||
|
|
||||||
load = mkOption {
|
load = mkOption {
|
||||||
|
@ -183,20 +182,14 @@ in {
|
||||||
options.vim.lazy = {
|
options.vim.lazy = {
|
||||||
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
|
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
|
||||||
loader = mkOption {
|
loader = mkOption {
|
||||||
description = "Lazy loader to use";
|
|
||||||
type = enum ["lz.n"];
|
type = enum ["lz.n"];
|
||||||
default = "lz.n";
|
default = "lz.n";
|
||||||
|
description = "Lazy loader to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
default = [];
|
|
||||||
type = attrsOf lznPluginType;
|
type = attrsOf lznPluginType;
|
||||||
description = ''
|
default = {};
|
||||||
Plugins to lazy load.
|
|
||||||
|
|
||||||
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
|
|
||||||
function this should be either the `package.pname` or `package.name`.
|
|
||||||
'';
|
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
toggleterm-nvim = {
|
toggleterm-nvim = {
|
||||||
|
@ -214,15 +207,21 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
description = ''
|
||||||
|
Plugins to lazy load.
|
||||||
|
|
||||||
|
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
|
||||||
|
function this should be either the `package.pname` or `package.name`.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
enableLznAutoRequire = mkOption {
|
enableLznAutoRequire = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
|
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
|
||||||
off for debugging.
|
off for debugging.
|
||||||
'';
|
'';
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
builtLazyConfig = mkOption {
|
builtLazyConfig = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue