Compare commits

...

11 commits

Author SHA1 Message Date
d2286843a6
plugins/visuals: remove overzealous multi-line in deprecation message 2024-11-09 23:47:41 +03:00
ebbeb89b42
filetree/neo-tree: rename deprecated nvimWebDevicons option 2024-11-09 23:47:40 +03:00
769ac9e6b3
binds/which-key: migrate to setupOpts 2024-11-09 23:47:35 +03:00
a20c3fbbd3
flake: bump inputs 2024-11-09 23:43:29 +03:00
diniamo
715408d2bd nvim-cmp: move text and snippet completions to the bottom
This doesn't guarantee that snippets will be above text completions, but
that should still be the case, since the `kind` comparator sorts
snippets above text.
2024-11-09 23:42:17 +03:00
Soliprem
1604c7423f
languages/assembly: init (#447)
* asm: init

* docs: added changelog for assembly

* asm: fixing requested changes

* configuration: assembly set to false
2024-11-09 23:13:27 +03:00
Ching Pei Yang
dfdad4c2ce
lazy: update lazy.plugins default 2024-11-08 19:03:01 +01:00
raf
43e3663b2b
Merge pull request #445 from horriblename/fix/devicon-color
nvim-web-devicons: re-enable icon color
2024-11-08 20:54:08 +03:00
Ching Pei Yang
b302e151e1
devicon: re-enable icon color
was mistakenly disabled in a6bb6e1b3e
2024-11-08 18:46:15 +01:00
0ba3ccdab8
modules: add config.vim to built package's passthru
Accessible under `<package>.passthru.neovimConfiguration`
2024-11-08 19:47:01 +03:00
Soliprem
1bd0ae5f7e
typst: added tinymist and activated formatters (#444)
* typst: added tinymist and activated formatters

* docs: added tinymist release notes

* typst: formatting

* docs: complying with standards

* typst: formatting
2024-11-08 18:10:40 +03:00
16 changed files with 442 additions and 305 deletions

View file

@ -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;

View file

@ -285,6 +285,9 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
- Add [](#opt-vim.spellcheck.extraSpellWords) to allow adding arbitrary - Add [](#opt-vim.spellcheck.extraSpellWords) to allow adding arbitrary
spellfiles to Neovim's runtime with ease. spellfiles to Neovim's runtime with ease.
- Add combined nvf configuration (`config.vim`) into the final package's
passthru as `passthru.neovimConfiguration` for easier debugging.
[ppenguin](https://github.com/ppenguin): [ppenguin](https://github.com/ppenguin):
- Telescope: - Telescope:
@ -302,6 +305,9 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
`vim.languages.kotlin` `vim.languages.kotlin`
- changed default keybinds for leap.nvim to avoid altering expected behavior - changed default keybinds for leap.nvim to avoid altering expected behavior
- 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
the Typst language module.
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
[Bloxx12](https://github.com/Bloxx12) [Bloxx12](https://github.com/Bloxx12)
@ -326,4 +332,3 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
[Nowaaru](https://github.com/Nowaaru): [Nowaaru](https://github.com/Nowaaru):
- Add `precognition-nvim`. - Add `precognition-nvim`.

File diff suppressed because it is too large Load diff

View file

@ -123,6 +123,11 @@ in {
paths = [neovim-wrapped printConfig printConfigPath]; paths = [neovim-wrapped printConfig printConfigPath];
postBuild = "echo Helpers added"; postBuild = "echo Helpers added";
# Allow evaluating vimOptions, i.e., config.vim from the packages' passthru
# attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig
# will return the configuration in full.
passthru.neovimConfig = vimOptions;
meta = { meta = {
description = "Wrapped version of Neovim with additional helper scripts"; description = "Wrapped version of Neovim with additional helper scripts";
mainProgram = "nvim"; mainProgram = "nvim";

View file

@ -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

View file

@ -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:

View file

@ -24,7 +24,7 @@ in {
cmd = ["Neotree"]; cmd = ["Neotree"];
}; };
visuals.nvimWebDevicons.enable = true; visuals.nvim-web-devicons.enable = true;
}; };
}; };
} }

View 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"},
}
'';
})
]);
}

View file

@ -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

View file

@ -14,6 +14,38 @@
cfg = config.vim.languages.typst; cfg = config.vim.languages.typst;
defaultServer = "tinymist";
servers = {
typst-lsp = {
package = pkgs.typst-lsp;
lspConfig = ''
lspconfig.typst_lsp.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/typst-lsp"}''
},
}
'';
};
tinymist = {
package = pkgs.tinymist;
lspConfig = ''
lspconfig.tinymist.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/tinymist"}''
},
}
'';
};
};
defaultFormat = "typstfmt"; defaultFormat = "typstfmt";
formats = { formats = {
typstfmt = { typstfmt = {
@ -52,11 +84,17 @@ in {
lsp = { lsp = {
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;}; enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Typst LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption { package = mkOption {
description = "typst-lsp package, or the command to run as a list of strings"; description = "typst-lsp package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
type = either package (listOf str); type = either package (listOf str);
default = pkgs.typst-lsp; default = servers.${cfg.lsp.server}.package;
}; };
}; };
@ -82,19 +120,14 @@ 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.typst-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.typst-lsp = '' vim.lsp.lspconfig.sources.typst-lsp = servers.${cfg.lsp.server}.lspConfig;
lspconfig.typst_lsp.setup {
capabilities = capabilities,
on_attach=default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/typst-lsp"}''
},
}
'';
}) })
]); ]);
} }

View file

@ -4,33 +4,20 @@
... ...
}: 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.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.binds.whichKey; cfg = config.vim.binds.whichKey;
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 = {
["<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}) wk.register(${toLuaObject cfg.register})
''; '';
}; };
};
} }

View file

@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./which-key.nix ./which-key.nix
./config.nix ./config.nix

View file

@ -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";
};
};
}; };
}; };
} }

View file

@ -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

View file

@ -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;

View file

@ -189,7 +189,7 @@ in {
}; };
plugins = mkOption { plugins = mkOption {
default = []; default = {};
type = attrsOf lznPluginType; type = attrsOf lznPluginType;
description = '' description = ''
Plugins to lazy load. Plugins to lazy load.