mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
11 commits
1f7ecd61cb
...
d2286843a6
Author | SHA1 | Date | |
---|---|---|---|
d2286843a6 | |||
ebbeb89b42 | |||
769ac9e6b3 | |||
a20c3fbbd3 | |||
|
715408d2bd | ||
|
1604c7423f | ||
|
dfdad4c2ce | ||
43e3663b2b | |||
|
b302e151e1 | ||
0ba3ccdab8 | |||
|
1bd0ae5f7e |
16 changed files with 442 additions and 305 deletions
|
@ -46,6 +46,8 @@ isMaximal: {
|
|||
|
||||
nix.enable = true;
|
||||
|
||||
# Assembly is not common, and the asm LSP is a major hit-or-miss
|
||||
assembly.enable = false;
|
||||
markdown.enable = isMaximal;
|
||||
html.enable = isMaximal;
|
||||
css.enable = isMaximal;
|
||||
|
|
|
@ -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
|
||||
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):
|
||||
|
||||
- Telescope:
|
||||
|
@ -302,6 +305,9 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
|||
`vim.languages.kotlin`
|
||||
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
||||
- 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)
|
||||
|
||||
|
@ -326,4 +332,3 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
|||
[Nowaaru](https://github.com/Nowaaru):
|
||||
|
||||
- Add `precognition-nvim`.
|
||||
|
||||
|
|
516
flake.lock
516
flake.lock
File diff suppressed because it is too large
Load diff
|
@ -123,6 +123,11 @@ in {
|
|||
paths = [neovim-wrapped printConfig printConfigPath];
|
||||
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 = {
|
||||
description = "Wrapped version of Neovim with additional helper scripts";
|
||||
mainProgram = "nvim";
|
||||
|
|
|
@ -42,6 +42,20 @@ in {
|
|||
after = ''
|
||||
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
||||
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})
|
||||
|
||||
${optionalString config.vim.lazy.enable
|
||||
|
|
|
@ -29,6 +29,8 @@ in {
|
|||
sorting.comparators = mkOption {
|
||||
type = mergelessListOf (either str luaInline);
|
||||
default = [
|
||||
(mkLuaInline "deprio(kinds.Text)")
|
||||
(mkLuaInline "deprio(kinds.Snippet)")
|
||||
"offset"
|
||||
"exact"
|
||||
"score"
|
||||
|
@ -43,6 +45,12 @@ in {
|
|||
(see `:help cmp-config.sorting.comparators`),
|
||||
or a string, in which case the builtin comparator with that name will
|
||||
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 (
|
||||
c:
|
||||
|
|
|
@ -24,7 +24,7 @@ in {
|
|||
cmd = ["Neotree"];
|
||||
};
|
||||
|
||||
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;
|
||||
in {
|
||||
imports = [
|
||||
./asm.nix
|
||||
./bash.nix
|
||||
./dart.nix
|
||||
./clang.nix
|
||||
|
|
|
@ -14,6 +14,38 @@
|
|||
|
||||
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";
|
||||
formats = {
|
||||
typstfmt = {
|
||||
|
@ -52,11 +84,17 @@ in {
|
|||
lsp = {
|
||||
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 {
|
||||
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"]'';
|
||||
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];
|
||||
})
|
||||
|
||||
(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 {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.typst-lsp = ''
|
||||
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"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
vim.lsp.lspconfig.sources.typst-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -4,33 +4,20 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.binds.whichKey;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["which-key"];
|
||||
vim = {
|
||||
startPlugins = ["which-key"];
|
||||
|
||||
vim.pluginRC.whichkey = entryAnywhere ''
|
||||
pluginRC.whichkey = entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
wk.setup ({
|
||||
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.setup (${toLuaObject cfg.setupOpts})
|
||||
wk.register(${toLuaObject cfg.register})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./which-key.nix
|
||||
./config.nix
|
||||
|
|
|
@ -1,14 +1,51 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf nullOr str;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf nullOr str attrs enum bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.binds.whichKey = {
|
||||
enable = mkEnableOption "which-key keybind helper menu";
|
||||
|
||||
register = mkOption {
|
||||
description = "Register label for which-key keybind helper menu";
|
||||
type = attrsOf (nullOr str);
|
||||
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 {
|
||||
imports = [
|
||||
(mkRemovedOptionModule ["vim" "visuals" "enable"] ''
|
||||
As top-level toggles are being deprecated, you are encouraged
|
||||
to handle plugin toggles under individual options.
|
||||
As top-level toggles are being deprecated, you are encouraged to handle plugin
|
||||
toggles under individual options.
|
||||
'')
|
||||
|
||||
./cellular-automaton
|
||||
|
|
|
@ -16,7 +16,7 @@ in {
|
|||
enable = mkEnableOption "Neovim dev icons [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 {
|
||||
type = nullOr (enum ["light" "dark"]);
|
||||
default = null;
|
||||
|
|
|
@ -189,7 +189,7 @@ in {
|
|||
};
|
||||
|
||||
plugins = mkOption {
|
||||
default = [];
|
||||
default = {};
|
||||
type = attrsOf lznPluginType;
|
||||
description = ''
|
||||
Plugins to lazy load.
|
||||
|
|
Loading…
Reference in a new issue