mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
e946799757
19 changed files with 317 additions and 108 deletions
|
@ -5,6 +5,7 @@
|
|||
./debug.nix
|
||||
./diagnostics.nix
|
||||
./highlight.nix
|
||||
./lsp.nix
|
||||
./spellcheck.nix
|
||||
];
|
||||
}
|
||||
|
|
82
modules/neovim/init/lsp.nix
Normal file
82
modules/neovim/init/lsp.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) attrsOf;
|
||||
inherit (lib.strings) concatLines;
|
||||
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.languages) lspOptions;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
lspConfigurations =
|
||||
mapAttrsToList (
|
||||
name: value: ''
|
||||
vim.lsp.config["${name}"] = ${toLuaObject value}
|
||||
''
|
||||
)
|
||||
cfg.servers;
|
||||
|
||||
enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
|
||||
in {
|
||||
options = {
|
||||
vim.lsp.servers = mkOption {
|
||||
type = attrsOf lspOptions;
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
"*" = {
|
||||
root_markers = [".git"];
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
multilineTokenSupport = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"clangd" = {
|
||||
filetypes = ["c"];
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
LSP configurations that will be managed using `vim.lsp.config()` and
|
||||
related utilities added in Neovim 0.11. LSPs defined here will be
|
||||
added to the resulting {file}`init.lua` using `vim.lsp.config` and
|
||||
enabled through `vim.lsp.enable` below the configuration table.
|
||||
|
||||
You may review the generated configuration by running {command}`nvf-print-config`
|
||||
in a shell. Please see {command}`:help lsp-config` for more details
|
||||
on the underlying API.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
vim.lsp.servers."*" = {
|
||||
capabilities = mkDefault (mkLuaInline "capabilities");
|
||||
on_attach = mkDefault (mkLuaInline "default_on_attach");
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf (cfg.servers != {}) {
|
||||
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
||||
-- Individual LSP configurations managed by nvf.
|
||||
${concatLines lspConfigurations}
|
||||
|
||||
-- Enable configured LSPs explicitly
|
||||
vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
|
@ -81,9 +81,11 @@ in {
|
|||
(mkIf cfg.codeActions.enable {
|
||||
vim.lsp.null-ls = {
|
||||
enable = true;
|
||||
setupOpts.sources.gitsigns-ca = mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'';
|
||||
setupOpts.sources = [
|
||||
(mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'')
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{lib, ...}: let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
|
@ -47,7 +51,11 @@ in {
|
|||
];
|
||||
|
||||
options.vim.languages = {
|
||||
enableLSP = mkEnable "LSP";
|
||||
# LSPs are now built into Neovim, and we should enable them by default
|
||||
# if `vim.lsp.enable` is true.
|
||||
enableLSP = mkEnable "LSP" // {default = config.vim.lsp.enable;};
|
||||
|
||||
# Those are still managed by plugins, and should be enabled here.
|
||||
enableDAP = mkEnable "Debug Adapter";
|
||||
enableTreesitter = mkEnable "Treesitter";
|
||||
enableFormat = mkEnable "Formatting";
|
||||
|
|
|
@ -2,5 +2,6 @@ _: {
|
|||
imports = [
|
||||
./which-key
|
||||
./cheatsheet
|
||||
./hardtime
|
||||
];
|
||||
}
|
||||
|
|
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.binds.hardtime-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["hardtime-nvim"];
|
||||
|
||||
pluginRC.hardtime = entryAnywhere ''
|
||||
require("hardtime").setup (${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/binds/hardtime/default.nix
Normal file
6
modules/plugins/utility/binds/hardtime/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hardtime.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
10
modules/plugins/utility/binds/hardtime/hardtime.nix
Normal file
10
modules/plugins/utility/binds/hardtime/hardtime.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.binds.hardtime-nvim = {
|
||||
enable = mkEnableOption "hardtime helper for no repeat keybinds";
|
||||
|
||||
setupOpts = mkPluginSetupOption "hardtime-nvim" {};
|
||||
};
|
||||
}
|
|
@ -11,13 +11,14 @@ in {
|
|||
description = ''
|
||||
[official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||
|
||||
the experimental Lua module loader to speed up the start up process
|
||||
Whethere to enable the experimental Lua module loader to speed up the start
|
||||
up process. If `true`, this will enable the experimental Lua module loader
|
||||
which:
|
||||
|
||||
If `true`, this will enable the experimental Lua module loader which:
|
||||
- overrides loadfile
|
||||
- adds the lua loader using the byte-compilation cache
|
||||
- adds the libs loader
|
||||
- removes the default Neovim loader
|
||||
* overrides loadfile
|
||||
* adds the lua loader using the byte-compilation cache
|
||||
* adds the libs loader
|
||||
* removes the default Neovim loader
|
||||
|
||||
::: {.note}
|
||||
The Lua module loader is *disabled* by default. Before setting this option, please
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue