mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 07:25:30 +00:00
Merge branch 'main' into feature-language-tex
This commit is contained in:
commit
d7a11ad990
16 changed files with 662 additions and 462 deletions
|
|
@ -37,12 +37,6 @@ in {
|
|||
description = "Default list of sources to enable for completion.";
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
|
|
@ -63,6 +57,14 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
cmdline = {
|
||||
sources = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = mkBool true "Show documentation whenever an item is selected";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ in {
|
|||
./typst.nix
|
||||
./vala.nix
|
||||
./wgsl.nix
|
||||
./yaml.nix
|
||||
./zig.nix
|
||||
];
|
||||
|
||||
|
|
|
|||
72
modules/plugins/languages/yaml.nix
Normal file
72
modules/plugins/languages/yaml.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.yaml;
|
||||
|
||||
defaultServer = "yaml-language-server";
|
||||
servers = {
|
||||
yaml-language-server = {
|
||||
package = pkgs.nodePackages.yaml-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.yamlls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/yaml-language-server", "--stdio"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.yaml = {
|
||||
enable = mkEnableOption "YAML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "YAML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = mkGrammarOption pkgs "yaml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "YAML LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
description = "YAML 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.yaml-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -57,8 +57,8 @@ in {
|
|||
};
|
||||
|
||||
mappings = {
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,22 +4,20 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.ui.illuminate;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["vim-illuminate"];
|
||||
vim = {
|
||||
startPlugins = ["vim-illuminate"];
|
||||
|
||||
vim.pluginRC.vim-illuminate = entryAnywhere ''
|
||||
require('illuminate').configure({
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'TelescopePrompt',
|
||||
},
|
||||
})
|
||||
'';
|
||||
# vim-illuminate does not have a setup function. It is instead called 'configure'
|
||||
# and does what you expect from a setup function. Wild.
|
||||
pluginRC.vim-illuminate = entryAnywhere ''
|
||||
require('illuminate').configure(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.ui.illuminate = {
|
||||
enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]";
|
||||
enable = mkEnableOption ''
|
||||
automatically highlight other uses of the word under the cursor [vim-illuminate]
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||
filetypes_denylist = mkOption {
|
||||
type = listOf str;
|
||||
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
|
||||
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
./gestures
|
||||
./icon-picker
|
||||
./images
|
||||
./leetcode-nvim
|
||||
./motion
|
||||
./multicursors
|
||||
./new-file-template
|
||||
|
|
@ -16,6 +17,6 @@
|
|||
./telescope
|
||||
./wakatime
|
||||
./yanky-nvim
|
||||
./leetcode-nvim
|
||||
./yazi-nvim
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
cfg = config.vim.utility.yanky-nvim;
|
||||
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
||||
usingShada = cfg.setupOpts.ring.storage == "shada";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
|
@ -28,5 +29,15 @@ in {
|
|||
require("yanky").setup(${toLuaObject cfg.setupOpts});
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = usingShada && ((config.vim.options.shada or "") == "");
|
||||
message = ''
|
||||
Yanky.nvim is configured to use 'shada' for the storage backend, but shada is disabled
|
||||
in 'vim.options'. Please re-enable shada, or switch to a different backend.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.yanky-nvim = {
|
||||
enable = mkEnableOption ''
|
||||
improved Yank and Put functionalities for Neovim [yanky-nvim]
|
||||
'';
|
||||
|
||||
setupOpts = {
|
||||
setupOpts = mkPluginSetupOption "yanky-nvim" {
|
||||
ring.storage = mkOption {
|
||||
type = enum ["shada" "sqlite" "memory"];
|
||||
default = "shada";
|
||||
|
|
@ -15,11 +16,11 @@ in {
|
|||
description = ''
|
||||
storage mode for ring values.
|
||||
|
||||
- shada: this will save pesistantly using Neovim ShaDa feature.
|
||||
- **shada**: this will save pesistantly using Neovim ShaDa feature.
|
||||
This means that history will be persisted between each session of Neovim.
|
||||
- memory: each Neovim instance will have his own history and it will be
|
||||
- **memory**: each Neovim instance will have his own history and it will be
|
||||
lost between sessions.
|
||||
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
- **sqlite**: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
nvf will add this dependency to `PATH` automatically.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.utility.yazi-nvim;
|
||||
keys = cfg.mappings;
|
||||
|
||||
inherit (options.vim.utility.yazi-nvim) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["snacks-nvim"];
|
||||
lazy.plugins."yazi.nvim" = {
|
||||
package = pkgs.vimPlugins.yazi-nvim;
|
||||
setupModule = "yazi";
|
||||
inherit (cfg) setupOpts;
|
||||
event = ["BufAdd" "VimEnter"];
|
||||
|
||||
keys = [
|
||||
(mkKeymap "n" keys.openYazi "<cmd>Yazi<CR>" {desc = mappings.openYazi.description;})
|
||||
(mkKeymap "n" keys.openYaziDir "<cmd>Yazi cwd<CR>" {desc = mappings.openYaziDir.description;})
|
||||
(mkKeymap "n" keys.yaziToggle "<cmd>Yazi toggle<CR>" {desc = mappings.yaziToggle.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./yazi-nvim.nix
|
||||
];
|
||||
}
|
||||
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.utility.yazi-nvim = {
|
||||
enable = mkEnableOption ''
|
||||
companion plugin for the yazi terminal file manager [yazi-nvim]
|
||||
'';
|
||||
|
||||
mappings = {
|
||||
openYazi = mkMappingOption "Open yazi at the current file [yazi.nvim]" "<leader>-";
|
||||
openYaziDir = mkMappingOption "Open the file manager in nvim's working directory [yazi.nvim]" "<leader>cw";
|
||||
yaziToggle = mkMappingOption "Resume the last yazi session [yazi.nvim]" "<c-up>";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "yazi-nvim" {
|
||||
open_for_directories = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to open Yazi instead of netrw";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue