mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-16 07:27:47 +00:00
Compare commits
No commits in common. "4fd0ac17504c8f25dbaae73ced5bf14ba053d42c" and "5589d1ff576e91d7479c739b5aa694036d46a0ac" have entirely different histories.
4fd0ac1750
...
5589d1ff57
9 changed files with 16 additions and 244 deletions
|
|
@ -76,7 +76,6 @@ isMaximal: {
|
||||||
csharp.enable = isMaximal;
|
csharp.enable = isMaximal;
|
||||||
julia.enable = isMaximal;
|
julia.enable = isMaximal;
|
||||||
vala.enable = isMaximal;
|
vala.enable = isMaximal;
|
||||||
nu.enable = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals = {
|
visuals = {
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,6 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
- Telescope:
|
- Telescope:
|
||||||
- Fixed `project-nvim` command and keybinding
|
- Fixed `project-nvim` command and keybinding
|
||||||
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
||||||
- Add `hcl` lsp/formatter (not the same as `terraform`, which is not useful for e.g. `nomad` config files).
|
|
||||||
|
|
||||||
[Soliprem](https://github.com/Soliprem):
|
[Soliprem](https://github.com/Soliprem):
|
||||||
|
|
||||||
|
|
@ -315,7 +314,6 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
the Typst language module.
|
the Typst language module.
|
||||||
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
|
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
|
||||||
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
|
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
|
||||||
- Add LSP and Treesitter support for Nushell under `vim.languages.nu`
|
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
|
|
||||||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -98,11 +98,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732617236,
|
"lastModified": 1730958623,
|
||||||
"narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=",
|
"narHash": "sha256-JwQZIGSYnRNOgDDoIgqKITrPVil+RMWHsZH1eE1VGN0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e",
|
"rev": "85f7e662eda4fa3a995556527c87b2524b691933",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -1713,11 +1713,11 @@
|
||||||
"plugin-rustaceanvim": {
|
"plugin-rustaceanvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732565373,
|
"lastModified": 1731172933,
|
||||||
"narHash": "sha256-WRaNW0trZYEUKd05Uc+5nP+G81HI14d6lM7/WWz61E0=",
|
"narHash": "sha256-B2AdSgGPANCBbVN+Sd7gvJ16ODZZwv4WSOxnRs3SWnk=",
|
||||||
"owner": "mrcjkb",
|
"owner": "mrcjkb",
|
||||||
"repo": "rustaceanvim",
|
"repo": "rustaceanvim",
|
||||||
"rev": "fee0aa094b0c9f93fffe5a385b3d5d2386c2b072",
|
"rev": "244443311f1c4e34ec1ea7f219a4b682b6ec066e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ in {
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./hcl.nix
|
|
||||||
./kotlin.nix
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
|
|
@ -33,7 +32,6 @@ in {
|
||||||
./zig.nix
|
./zig.nix
|
||||||
./csharp.nix
|
./csharp.nix
|
||||||
./julia.nix
|
./julia.nix
|
||||||
./nu.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages = {
|
options.vim.languages = {
|
||||||
|
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (builtins) attrNames;
|
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
|
||||||
inherit (lib.types) package bool enum;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.hcl;
|
|
||||||
|
|
||||||
defaultServer = "terraform-ls";
|
|
||||||
servers = {
|
|
||||||
terraform-ls = {
|
|
||||||
package = pkgs.terraform-ls;
|
|
||||||
lspConfig = ''
|
|
||||||
lspconfig.terraformls.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach=default_on_attach,
|
|
||||||
cmd = {"${lib.getExe cfg.lsp.package}", "serve"},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultFormat = "hclfmt";
|
|
||||||
formats = {
|
|
||||||
hclfmt = {
|
|
||||||
package = pkgs.hclfmt;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.hclfmt.with({
|
|
||||||
command = "${lib.getExe cfg.format.package}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
options.vim.languages.hcl = {
|
|
||||||
enable = mkEnableOption "HCL support";
|
|
||||||
|
|
||||||
treesitter = {
|
|
||||||
enable = mkEnableOption "HCL treesitter" // {default = config.vim.languages.enableTreesitter;};
|
|
||||||
package = mkGrammarOption pkgs "hcl";
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp = {
|
|
||||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
|
|
||||||
# TODO: (maybe, is it better?) it would be cooler to use vscode-extensions.hashicorp.hcl probably, shouldn't be too hard
|
|
||||||
package = mkOption {
|
|
||||||
type = package;
|
|
||||||
default = servers.${defaultServer}.package;
|
|
||||||
description = "HCL language server package (terraform-ls)";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
format = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = config.vim.languages.enableFormat;
|
|
||||||
description = "Enable HCL formatting";
|
|
||||||
};
|
|
||||||
type = mkOption {
|
|
||||||
type = enum (attrNames formats);
|
|
||||||
default = defaultFormat;
|
|
||||||
description = "HCL formatter to use";
|
|
||||||
};
|
|
||||||
package = mkOption {
|
|
||||||
type = package;
|
|
||||||
default = formats.${cfg.format.type}.package;
|
|
||||||
description = "HCL formatter package";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
|
||||||
{
|
|
||||||
# hcl style official: https://developer.hashicorp.com/terraform/language/style#code-formatting
|
|
||||||
vim.pluginRC.hcl = ''
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = "hcl",
|
|
||||||
callback = function(opts)
|
|
||||||
local bo = vim.bo[opts.buf]
|
|
||||||
bo.tabstop = 2
|
|
||||||
bo.shiftwidth = 2
|
|
||||||
bo.softtabstop = 2
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
local ft = require('Comment.ft')
|
|
||||||
ft
|
|
||||||
.set('hcl', '#%s')
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
(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 = lib.optionalAttrs (! config.vim.languages.terraform.lsp.enable) {
|
|
||||||
terraform-ls = servers.${cfg.lsp.server}.lspConfig;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
|
||||||
vim.lsp.null-ls.enable = true;
|
|
||||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
|
||||||
inherit (lib.types) str either package listOf;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
|
||||||
inherit (lib.nvim.lua) expToLua;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
|
||||||
inherit (builtins) isList;
|
|
||||||
|
|
||||||
defaultServer = "nushell";
|
|
||||||
servers = {
|
|
||||||
nushell = {
|
|
||||||
package = pkgs.nushell;
|
|
||||||
lspConfig = ''
|
|
||||||
lspconfig.nushell.setup{
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = default_on_attach,
|
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
|
||||||
then expToLua cfg.lsp.package
|
|
||||||
else ''{"${cfg.lsp.package}/bin/nu", "--no-config-file", "--lsp"}''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
cfg = config.vim.languages.nu;
|
|
||||||
in {
|
|
||||||
options.vim.languages.nu = {
|
|
||||||
enable = mkEnableOption "Nu language support";
|
|
||||||
|
|
||||||
treesitter = {
|
|
||||||
enable = mkEnableOption "Nu treesitter" // {default = config.vim.languages.enableTreesitter;};
|
|
||||||
package = mkGrammarOption pkgs "nu";
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp = {
|
|
||||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
|
|
||||||
server = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = defaultServer;
|
|
||||||
description = "Nu LSP server to use";
|
|
||||||
};
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = either package (listOf str);
|
|
||||||
default = servers.${cfg.lsp.server}.package;
|
|
||||||
example = ''[(lib.getExe pkgs.nushell) "--lsp"]'';
|
|
||||||
description = "Nu LSP server package, or the command to run as a list of strings";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
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.nu-lsp = servers.${cfg.lsp.server}.lspConfig;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
@ -21,10 +21,7 @@
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.typst_lsp.setup {
|
lspconfig.typst_lsp.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = function(client, bufnr)
|
on_attach = default_on_attach,
|
||||||
-- Disable semantic tokens as a workaround for a semantic token error when using non-english characters
|
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
|
||||||
end,
|
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
|
|
@ -39,10 +36,7 @@
|
||||||
lspconfig.tinymist.setup {
|
lspconfig.tinymist.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
single_file_support = true,
|
single_file_support = true,
|
||||||
on_attach = function(client, bufnr)
|
on_attach = default_on_attach,
|
||||||
-- Disable semantic tokens as a workaround for a semantic token error when using non-english characters
|
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
|
||||||
end,
|
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep tryEval;
|
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
@ -21,36 +21,10 @@
|
||||||
else keySpec.action;
|
else keySpec.action;
|
||||||
};
|
};
|
||||||
|
|
||||||
toLuaLznSpec = name: spec: let
|
toLuaLznSpec = name: spec:
|
||||||
packageName =
|
|
||||||
if typeOf spec.package == "string"
|
|
||||||
then spec.package
|
|
||||||
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
|
||||||
then spec.package.pname
|
|
||||||
else spec.package.name;
|
|
||||||
in
|
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
// {
|
// {
|
||||||
"@1" =
|
"@1" = name;
|
||||||
if spec.package != null && packageName != name && spec.load == null
|
|
||||||
then
|
|
||||||
abort ''
|
|
||||||
vim.lazy.plugins.${name} does not match the package name ${packageName}.
|
|
||||||
|
|
||||||
Please either:
|
|
||||||
- rename it to vim.lazy.plugins.${packageName}, or
|
|
||||||
- if you intend to use a custom loader, specify a
|
|
||||||
vim.lazy.plugins.${name}.load function.
|
|
||||||
''
|
|
||||||
else if spec.package == null && spec.load == null
|
|
||||||
then
|
|
||||||
abort ''
|
|
||||||
vim.lazy.plugins.${name} has null package but no load function given.
|
|
||||||
|
|
||||||
Please either specify a package, or (if you know what you're doing) provide a
|
|
||||||
custom load function.
|
|
||||||
''
|
|
||||||
else name;
|
|
||||||
beforeAll =
|
beforeAll =
|
||||||
if spec.beforeAll != null
|
if spec.beforeAll != null
|
||||||
then
|
then
|
||||||
|
|
@ -88,7 +62,7 @@
|
||||||
if spec.load != null
|
if spec.load != null
|
||||||
then
|
then
|
||||||
mkLuaInline ''
|
mkLuaInline ''
|
||||||
function(name)
|
function()
|
||||||
${spec.load}
|
${spec.load}
|
||||||
end
|
end
|
||||||
''
|
''
|
||||||
|
|
@ -102,7 +76,7 @@
|
||||||
};
|
};
|
||||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||||
|
|
||||||
pluginPackages = filter (x: x != null) (mapAttrsToList (_: plugin: plugin.package) cfg.plugins);
|
pluginPackages = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||||
|
|
||||||
specToNotLazyConfig = _: spec: ''
|
specToNotLazyConfig = _: spec: ''
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,8 @@
|
||||||
lznPluginType = submodule {
|
lznPluginType = submodule {
|
||||||
options = {
|
options = {
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = nullOr pluginType;
|
type = pluginType;
|
||||||
description = ''
|
description = "Plugin package";
|
||||||
Plugin package.
|
|
||||||
|
|
||||||
If null, a custom load function must be provided
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setupModule = mkOption {
|
setupModule = mkOption {
|
||||||
|
|
@ -177,7 +173,7 @@
|
||||||
description = ''
|
description = ''
|
||||||
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
||||||
|
|
||||||
This will be wrapped in a `function(name) ... end`.
|
This will be wrapped in a function.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue