mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-24 00:27:57 +00:00
Merge branch 'main' of github.com:NotAShelf/neovim-flake into nim-lang
This commit is contained in:
commit
38bf156537
74 changed files with 2027 additions and 1509 deletions
74
modules/languages/css.nix
Normal file
74
modules/languages/css.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
|
||||
|
||||
cfg = config.vim.languages.css;
|
||||
|
||||
defaultServer = "vscode-langservers-extracted";
|
||||
servers = {
|
||||
vscode-langservers-extracted = {
|
||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||
lspConfig = ''
|
||||
-- enable (broadcasting) snippet capability for completion
|
||||
-- see <https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cssls>
|
||||
local css_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
css_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- cssls setup
|
||||
lspconfig.cssls.setup {
|
||||
capabilities = css_capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/vscode-css-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.css = {
|
||||
enable = mkEnableOption "CSS language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "CSS treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = nvim.types.mkGrammarOption pkgs "css";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "CSS LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "CSS 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 = with types; either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.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.tailwindcss-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -2,27 +2,29 @@
|
|||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
./markdown
|
||||
./tidal
|
||||
./bash
|
||||
./dart
|
||||
./elixir
|
||||
./bash
|
||||
./markdown
|
||||
./tidal
|
||||
|
||||
./clang.nix
|
||||
./css.nix
|
||||
./go.nix
|
||||
./nix.nix
|
||||
./python.nix
|
||||
./rust.nix
|
||||
./sql.nix
|
||||
./ts.nix
|
||||
./zig.nix
|
||||
./html.nix
|
||||
./svelte.nix
|
||||
./java.nix
|
||||
./lua.nix
|
||||
./nim.nix
|
||||
./nix.nix
|
||||
./php.nix
|
||||
./python.nix
|
||||
./rust.nix
|
||||
./sql.nix
|
||||
./svelte.nix
|
||||
./tailwind.nix
|
||||
./terraform.nix
|
||||
./ts.nix
|
||||
./zig.nix
|
||||
];
|
||||
|
||||
options.vim.languages = {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
|
||||
|
||||
cfg = config.vim.languages.java;
|
||||
in {
|
||||
|
|
@ -38,7 +38,7 @@ in {
|
|||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/jdt-language-server", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
|
||||
else ''{"${getExe cfg.lsp.package}", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -4,9 +4,29 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) nvim mkIf mkMerge;
|
||||
inherit (lib) nvim mkIf mkMerge mkBinding isList;
|
||||
|
||||
cfg = config.vim.languages.markdown;
|
||||
self = import ./markdown.nix {
|
||||
inherit lib config pkgs;
|
||||
};
|
||||
mappings = self.options.vim.languages.markdown.glow.mappings;
|
||||
servers = {
|
||||
marksman = {
|
||||
package = pkgs.marksman;
|
||||
lspConfig = ''
|
||||
lspconfig.marksman.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
|
|
@ -18,13 +38,21 @@ in {
|
|||
(mkIf cfg.glow.enable {
|
||||
vim.startPlugins = ["glow-nvim"];
|
||||
|
||||
vim.globals = {
|
||||
"glow_binary_path" = "${pkgs.glow}/bin";
|
||||
};
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.glow.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
|
||||
];
|
||||
|
||||
vim.configRC.glow = nvim.dag.entryAnywhere ''
|
||||
autocmd FileType markdown noremap <leader>p :Glow<CR>
|
||||
vim.luaConfigRC.glow = nvim.dag.entryAnywhere ''
|
||||
require('glow').setup({
|
||||
glow_path = "${pkgs.glow}/bin/glow"
|
||||
});
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
|
||||
vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,40 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types nvim;
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkEnableOption mkMappingOption mkOption types nvim isList;
|
||||
|
||||
cfg = config.vim.languages.markdown;
|
||||
defaultServer = "marksman";
|
||||
servers = {
|
||||
marksman = {
|
||||
package = pkgs.marksman;
|
||||
lspConfig = ''
|
||||
lspconfig.marksman.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.markdown = {
|
||||
enable = mkEnableOption "Markdown markup language support";
|
||||
|
||||
glow.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable markdown preview in neovim with glow";
|
||||
glow = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable markdown preview in neovim with glow";
|
||||
};
|
||||
mappings = {
|
||||
openPreview = mkMappingOption "Open preview" "<leader>p";
|
||||
};
|
||||
};
|
||||
|
||||
treesitter = {
|
||||
|
|
@ -26,5 +49,22 @@ in {
|
|||
mdPackage = nvim.types.mkGrammarOption pkgs "markdown";
|
||||
mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Markdown LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Markdown 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 = with types; either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
57
modules/languages/tailwind.nix
Normal file
57
modules/languages/tailwind.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
|
||||
|
||||
cfg = config.vim.languages.tailwind;
|
||||
|
||||
defaultServer = "tailwindcss-language-server";
|
||||
servers = {
|
||||
tailwindcss-language-server = {
|
||||
package = pkgs.tailwindcss-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.tailwindcss.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/tailwindcss-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.tailwind = {
|
||||
enable = mkEnableOption "Tailwindcss language support";
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Tailwindcss LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Tailwindcss 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 = with types; either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.css-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue