Compare commits

..

7 commits

15 changed files with 147 additions and 258 deletions

View file

@ -55,8 +55,6 @@ inputs: let
enableExtraDiagnostics = true;
nim.enable = false;
elixir.enable = false;
nix.enable = true;
markdown.enable = true;

View file

@ -5,7 +5,6 @@ Below are the commands you may run to try out different configurations provided
configurations are provided:
- Nix
- Tidal
- Maximal
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
@ -22,7 +21,6 @@ once you garbage collect.
```console
$ nix run github:notashelf/nvf#nix
$ nix run github:notashelf/nvf#tidal
$ nix run github:notashelf/nvf#maximal
```
@ -33,10 +31,6 @@ $ nix run github:notashelf/nvf#maximal
`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins.
By running `nix run .#`, which is the default package, you will build Neovim with this config.
#### Tidal {#sec-configs-tidal}
Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.
#### Maximal {#sec-configs-maximal}
`Maximal` is the ultimate configuration that will enable support for more commonly used language as well as additional

View file

@ -23,4 +23,10 @@ Release notes for release 0.7
- Add `deno fmt` as the default Markdown formatter. This will be enabled
automatically if you have autoformatting enabled, but can be disabled manually
if you choose to.
- Remove vim-tidal and friends
- Remove unmaintained Elixir language module. This has been long broken, and was
unmaintained due to my disinterest in using Elixir. If you depend on Elixir
language support, please create an issue. Do keep in mind that elixirls **does
not exist in nixpkgs**.

View file

@ -546,38 +546,6 @@
"type": "github"
}
},
"plugin-elixir-ls": {
"flake": false,
"locked": {
"lastModified": 1713724318,
"narHash": "sha256-1kLMxznNRRJ7M10zkuWexA/sPFaN449M0SKUjLrnc8c=",
"owner": "elixir-lsp",
"repo": "elixir-ls",
"rev": "8486de473a219dcdb72408702f8d56d0227c7366",
"type": "github"
},
"original": {
"owner": "elixir-lsp",
"repo": "elixir-ls",
"type": "github"
}
},
"plugin-elixir-tools": {
"flake": false,
"locked": {
"lastModified": 1713617654,
"narHash": "sha256-pJgtW51FLs+Yr+tlQckRmGkRnSUQNI3fEROn3D51mMs=",
"owner": "elixir-tools",
"repo": "elixir-tools.nvim",
"rev": "3c4f8344a341818417b3d75c04eb96d894cb4640",
"type": "github"
},
"original": {
"owner": "elixir-tools",
"repo": "elixir-tools.nvim",
"type": "github"
}
},
"plugin-fidget-nvim": {
"flake": false,
"locked": {
@ -1796,8 +1764,6 @@
"plugin-diffview-nvim": "plugin-diffview-nvim",
"plugin-dracula": "plugin-dracula",
"plugin-dressing-nvim": "plugin-dressing-nvim",
"plugin-elixir-ls": "plugin-elixir-ls",
"plugin-elixir-tools": "plugin-elixir-tools",
"plugin-fidget-nvim": "plugin-fidget-nvim",
"plugin-flutter-tools": "plugin-flutter-tools",
"plugin-gesture-nvim": "plugin-gesture-nvim",

View file

@ -178,16 +178,6 @@
flake = false;
};
plugin-elixir-ls = {
url = "github:elixir-lsp/elixir-ls";
flake = false;
};
plugin-elixir-tools = {
url = "github:elixir-tools/elixir-tools.nvim";
flake = false;
};
plugin-glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;

View file

@ -0,0 +1,16 @@
{lib, ...}: let
inherit (lib.modules) mkRemovedOptionModule;
in {
imports = [
# 2024-06-06
(mkRemovedOptionModule ["vim" "languages" "elixir"] ''
Elixir language support has been removed as of 2024-06-06 as it was long unmaintained. If
you dependend on this language support, please consider contributing to its maintenance.
'')
(mkRemovedOptionModule ["vim" "tidal"] ''
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
you depended on this functionality, please open an issue.
'')
];
}

View file

@ -53,7 +53,13 @@
"warnings"
];
allModules = concatLists [neovim plugins wrapper];
# Extra modules, such as deprecation warnings
# or renames in one place.
extra = map (p: ./extra + "/${p}") [
"deprecations.nix"
];
allModules = concatLists [neovim plugins wrapper extra];
pkgsModule = {config, ...}: {
config = {

View file

@ -1,15 +1,17 @@
{
pkgs,
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either package listOf str bool;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) diagnostics mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.bash;
@ -55,6 +57,7 @@
ls_sources,
null_ls.builtins.diagnostics.shellcheck.with({
command = "${pkg}/bin/shellcheck",
diagnostics_format = "#{m} [#{c}]"
})
)
'';
@ -114,4 +117,30 @@ in {
};
};
};
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.bash-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "bash";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
};
})
]);
}

View file

@ -1,83 +0,0 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib.lists) isList;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
cfg = config.vim.languages.bash;
diagnosticsProviders = {
shellcheck = {
package = pkgs.shellcheck;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.shellcheck.with({
command = "${pkg}/bin/shellcheck",
})
)
'';
};
};
formats = {
shfmt = {
package = pkgs.shfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.shfmt.with({
command = "${pkgs.shfmt}/bin/shfmt",
})
)
'';
};
};
servers = {
bash-ls = {
package = pkgs.nodePackages.bash-language-server;
lspConfig = ''
lspconfig.bashls.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/bash-language-server", "start"}''
};
}
'';
};
};
in {
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.bash-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "bash";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
};
})
]);
}

View file

@ -1,6 +0,0 @@
{
imports = [
./bash.nix
./config.nix
];
}

View file

@ -26,10 +26,10 @@
ccls = {
package = pkgs.ccls;
lspConfig = ''
lspconfig.ccls.setup{
capabilities = capabilities;
on_attach=default_on_attach;
cmd = ${packageToCmd cfg.lsp.package "ccls"};
lspconfig.ccls.setup {
capabilities = capabilities,
on_attach=default_on_attach,
cmd = ${packageToCmd cfg.lsp.package "ccls"},
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
}
'';
@ -40,10 +40,10 @@
local clangd_cap = capabilities
-- use same offsetEncoding as null-ls
clangd_cap.offsetEncoding = {"utf-16"}
lspconfig.clangd.setup{
capabilities = clangd_cap;
on_attach=default_on_attach;
cmd = ${packageToCmd cfg.lsp.package "clangd"};
lspconfig.clangd.setup {
capabilities = clangd_cap,
on_attach=default_on_attach,
cmd = ${packageToCmd cfg.lsp.package "clangd"},
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
}
'';
@ -83,12 +83,16 @@ in {
enable = mkEnableOption "C/C++ language support";
cHeader = mkOption {
description = ''
C syntax for headers. Can fix treesitter errors, see:
https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/
'';
type = bool;
default = false;
description = ''
Enable C syntax for headers.
::: {.note}
This can potentially fix Treesitter errors for headers. See [this reddit
post] https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/
:::
'';
};
treesitter = {
@ -107,16 +111,16 @@ in {
};
package = mkOption {
description = "clang LSP server 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 = servers.${cfg.lsp.server}.package;
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
description = "clang LSP server package, or the command to run as a list of strings";
};
opts = mkOption {
description = "Options to pass to clang LSP server";
default = "--offset-encoding=utf-16";
type = nullOr str;
default = null;
description = "Options to pass to clang LSP server";
};
};
@ -126,11 +130,13 @@ in {
type = bool;
default = config.vim.languages.enableDAP;
};
debugger = mkOption {
description = "clang debugger to use";
type = enum (attrNames debuggers);
default = defaultDebugger;
};
package = mkOption {
description = "clang debugger package.";
type = package;
@ -151,7 +157,6 @@ in {
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig;
})

View file

@ -1,18 +1,23 @@
{
config,
lib,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.trivial) boolToString;
inherit (lib.lists) isList;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum either listOf package nullOr str bool;
inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.dart;
ftcfg = cfg.flutter-tools;
defaultServer = "dart";
servers = {
dart = {
@ -48,15 +53,16 @@ in {
default = defaultServer;
};
package = mkOption {
description = "Dart LSP server 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 = servers.${cfg.lsp.server}.package;
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
description = "Dart LSP server package, or the command to run as a list of strings";
};
opts = mkOption {
description = "Options to pass to Dart LSP server";
type = nullOr str;
default = null;
description = "Options to pass to Dart LSP server";
};
};
@ -70,23 +76,26 @@ in {
flutter-tools = {
enable = mkOption {
description = "Enable flutter-tools for flutter support";
type = bool;
default = config.vim.languages.enableLSP;
description = "Enable flutter-tools for flutter support";
};
enableNoResolvePatch = mkOption {
description = ''
Patch flutter-tools so that it doesn't resolve symlinks when detecting flutter path.
This is required if you want to use a flutter package built with nix.
If you are using a flutter SDK installed from a different source and encounter the error "`dart` missing from PATH", disable this option.
'';
type = bool;
default = true;
description = ''
Whether to patch flutter-tools so that it doesn't resolve
symlinks when detecting flutter path.
This is required if you want to use a flutter package built with nix.
If you are using a flutter SDK installed from a different source
and encounter the error "`dart` missing from PATH", disable this option.
'';
};
color = {
enable = mkEnableOption "Whether or mot to highlight color variables at all";
enable = mkEnableOption "highlighting color variables";
highlightBackground = mkOption {
type = bool;
@ -112,4 +121,47 @@ in {
};
};
};
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.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf ftcfg.enable {
vim.startPlugins =
if ftcfg.enableNoResolvePatch
then ["flutter-tools-patched"]
else ["flutter-tools"];
vim.luaConfigRC.flutter-tools = entryAnywhere ''
require('flutter-tools').setup {
lsp = {
color = { -- show the derived colours for dart variables
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
},
capabilities = capabilities,
on_attach = default_on_attach;
flags = lsp_flags,
},
${optionalString cfg.dap.enable ''
debugger = {
enabled = true,
},
''}
}
'';
})
]);
}

View file

@ -1,76 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.lists) isList;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.dart;
ftcfg = cfg.flutter-tools;
servers = {
dart = {
package = pkgs.dart;
lspConfig = ''
lspconfig.dartls.setup{
capabilities = capabilities;
on_attach=default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/dart", "language-server", "--protocol=lsp"}''
};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
}
'';
};
};
in {
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.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf ftcfg.enable {
vim.startPlugins =
if ftcfg.enableNoResolvePatch
then ["flutter-tools-patched"]
else ["flutter-tools"];
vim.luaConfigRC.flutter-tools = entryAnywhere ''
require('flutter-tools').setup {
lsp = {
color = { -- show the derived colours for dart variables
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
},
capabilities = capabilities,
on_attach = default_on_attach;
flags = lsp_flags,
},
${optionalString cfg.dap.enable ''
debugger = {
enabled = true,
},
''}
}
'';
})
]);
}

View file

@ -1,6 +0,0 @@
{
imports = [
./dart.nix
./config.nix
];
}

View file

@ -2,10 +2,8 @@
inherit (lib.nvim.languages) mkEnable;
in {
imports = [
./bash
./dart
./elixir
./bash.nix
./dart.nix
./clang.nix
./css.nix
./go.nix