mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Compare commits
15 commits
90bfb17fa3
...
22c105c08f
Author | SHA1 | Date | |
---|---|---|---|
|
22c105c08f | ||
6eb5bea5ba | |||
5a95f812ce | |||
|
4f93abc2f2 | ||
|
c6ff6bbca6 | ||
|
516174e296 | ||
d3d5bbec92 | |||
3af7e4416e | |||
a42a4a4fb6 | |||
7a0e7739c5 | |||
|
715408d2bd | ||
|
1604c7423f | ||
|
7f5c33605d | ||
|
62b1e30e49 | ||
|
c971673529 |
21 changed files with 677 additions and 369 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;
|
||||||
|
|
|
@ -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
|
@ -468,6 +468,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;
|
||||||
|
|
|
@ -42,6 +42,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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
|
||||||
cfg = config.vim.filetree.neo-tree;
|
cfg = config.vim.filetree.neo-tree;
|
||||||
in {
|
in {
|
||||||
|
@ -21,10 +22,31 @@ in {
|
||||||
setupModule = "neo-tree";
|
setupModule = "neo-tree";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
beforeAll =
|
||||||
|
optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled")
|
||||||
|
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||||
|
desc = "Loads neo-tree when openning a directory",
|
||||||
|
callback = function(args)
|
||||||
|
local stats = vim.uv.fs_stat(args.file)
|
||||||
|
|
||||||
|
if not stats or stats.type ~= "directory" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lz.n").trigger_load("neo-tree-nvim")
|
||||||
|
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
'';
|
||||||
cmd = ["Neotree"];
|
cmd = ["Neotree"];
|
||||||
|
event = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals.nvimWebDevicons.enable = true;
|
visuals.nvim-web-devicons.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.types) bool str int submodule enum either listOf;
|
inherit (lib.types) bool str enum either listOf;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
@ -150,6 +150,14 @@ in {
|
||||||
A list of filetypes that should not be replaced when opening a file
|
A list of filetypes that should not be replaced when opening a file
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
filesystem = {
|
||||||
|
hijack_netrw_behavior = mkOption {
|
||||||
|
type = enum ["disabled" "open_default" "open_current"];
|
||||||
|
default = "open_default";
|
||||||
|
description = "Hijack Netrw behavior";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ in {
|
||||||
package = "nvim-tree-lua";
|
package = "nvim-tree-lua";
|
||||||
setupModule = "nvim-tree";
|
setupModule = "nvim-tree";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||||
|
@ -31,9 +32,8 @@ in {
|
||||||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
pluginRC.nvimtreelua = entryAnywhere ''
|
beforeAll = ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
-- disable netrew completely
|
-- disable netrew completely
|
||||||
|
@ -42,6 +42,24 @@ in {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${optionalString (cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
|
||||||
|
desc = "Loads nvim-tree when openning a directory",
|
||||||
|
callback = function(args)
|
||||||
|
local stats = vim.uv.fs_stat(args.file)
|
||||||
|
|
||||||
|
if not stats or stats.type ~= "directory" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lz.n").trigger_load("nvim-tree-lua")
|
||||||
|
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
''}
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString cfg.openOnSetup ''
|
optionalString cfg.openOnSetup ''
|
||||||
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||||
|
@ -85,4 +103,5 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
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;
|
||||||
|
|
|
@ -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",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -26,6 +26,15 @@
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
// {
|
// {
|
||||||
"@1" = name;
|
"@1" = name;
|
||||||
|
beforeAll =
|
||||||
|
if spec.beforeAll != null
|
||||||
|
then
|
||||||
|
mkLuaInline ''
|
||||||
|
function()
|
||||||
|
${spec.beforeAll}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else null;
|
||||||
before =
|
before =
|
||||||
if spec.before != null
|
if spec.before != null
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue