mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-08 13:13:55 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
b6486a2aba
176 changed files with 4155 additions and 1832 deletions
|
|
@ -30,7 +30,16 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["chatgpt-nvim"];
|
||||
startPlugins = [
|
||||
"chatgpt-nvim"
|
||||
|
||||
# Dependencies
|
||||
"nui-nvim"
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
# ChatGPT.nvim explicitly depends on Telescope.
|
||||
telescope.enable = true;
|
||||
|
||||
pluginRC.chagpt = entryAnywhere ''
|
||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||
|
|
|
|||
301
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
301
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
|
|
@ -0,0 +1,301 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) int str enum nullOr attrs;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
in {
|
||||
options.vim.assistant = {
|
||||
codecompanion-nvim = {
|
||||
enable = mkEnableOption "complementary neovim plugin for codecompanion.nvim";
|
||||
|
||||
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||
opts = {
|
||||
send_code =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable code being sent to the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||
default = "ERROR";
|
||||
description = "Change the level of logging.";
|
||||
};
|
||||
|
||||
language = mkOption {
|
||||
type = str;
|
||||
default = "English";
|
||||
description = "Specify which language an LLM should respond in.";
|
||||
};
|
||||
};
|
||||
|
||||
display = {
|
||||
diff = {
|
||||
enabled =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable a diff view
|
||||
to see the changes made by the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
close_chat_at = mkOption {
|
||||
type = int;
|
||||
default = 240;
|
||||
description = ''
|
||||
Close an open chat buffer if the
|
||||
total columns of your display are less than...
|
||||
'';
|
||||
};
|
||||
|
||||
layout = mkOption {
|
||||
type = enum ["vertical" "horizontal"];
|
||||
default = "vertical";
|
||||
description = "Type of split for default provider.";
|
||||
};
|
||||
|
||||
provider = mkOption {
|
||||
type = enum ["default" "mini_diff"];
|
||||
default = "default";
|
||||
description = "The preferred kind of provider.";
|
||||
};
|
||||
};
|
||||
|
||||
inline = {
|
||||
layout = mkOption {
|
||||
type = enum ["vertical" "horizontal" "buffer"];
|
||||
default = "vertical";
|
||||
description = "Customize how output is created in new buffer.";
|
||||
};
|
||||
};
|
||||
|
||||
chat = {
|
||||
auto_scroll =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable automatic page scrolling.";
|
||||
};
|
||||
|
||||
show_settings = mkEnableOption ''
|
||||
LLM settings to appear at the top of the chat buffer.
|
||||
'';
|
||||
|
||||
start_in_insert_mode = mkEnableOption ''
|
||||
opening the chat buffer in insert mode.
|
||||
'';
|
||||
|
||||
show_header_separator = mkEnableOption ''
|
||||
header separators in the chat buffer.
|
||||
|
||||
Set this to false if you're using an
|
||||
external markdown formatting plugin.
|
||||
'';
|
||||
|
||||
show_references =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable references in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
show_token_count =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable the token count for each response.
|
||||
'';
|
||||
};
|
||||
|
||||
intro_message = mkOption {
|
||||
type = str;
|
||||
default = "Welcome to CodeCompanion ✨! Press ? for options.";
|
||||
description = "Message to appear in chat buffer.";
|
||||
};
|
||||
|
||||
separator = mkOption {
|
||||
type = str;
|
||||
default = "─";
|
||||
description = ''
|
||||
The separator between the
|
||||
different messages in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
icons = {
|
||||
pinned_buffer = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The icon to represent a pinned buffer.";
|
||||
};
|
||||
|
||||
watched_buffer = mkOption {
|
||||
type = str;
|
||||
default = "👀 ";
|
||||
description = "The icon to represent a watched buffer.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
action_palette = {
|
||||
width = mkOption {
|
||||
type = int;
|
||||
default = 95;
|
||||
description = "Width of the action palette.";
|
||||
};
|
||||
|
||||
height = mkOption {
|
||||
type = int;
|
||||
default = 10;
|
||||
description = "Height of the action palette.";
|
||||
};
|
||||
|
||||
prompt = mkOption {
|
||||
type = str;
|
||||
default = "Prompt ";
|
||||
description = "Prompt used for interactive LLM calls.";
|
||||
};
|
||||
|
||||
provider = mkOption {
|
||||
type = enum ["default" "telescope" "mini_pick"];
|
||||
default = "default";
|
||||
description = "Provider used for the action palette.";
|
||||
};
|
||||
|
||||
opts = {
|
||||
show_default_actions =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable showing default
|
||||
actions in the action palette.
|
||||
'';
|
||||
};
|
||||
|
||||
show_default_prompt_library =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable showing default
|
||||
prompt library in the action palette.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
adapters = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = "An adapter is what connects Neovim to an LLM.";
|
||||
};
|
||||
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Adapter used for the chat strategy.";
|
||||
};
|
||||
|
||||
keymaps = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps.";
|
||||
};
|
||||
|
||||
variables = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Define your own variables
|
||||
to share specific content.
|
||||
'';
|
||||
};
|
||||
|
||||
slash_commands = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Slash Commands (invoked with /) let you dynamically
|
||||
insert context into the chat buffer,
|
||||
such as file contents or date/time.
|
||||
'';
|
||||
};
|
||||
|
||||
tools = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = ''
|
||||
Configure tools to perform specific
|
||||
tasks when invoked by an LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
roles = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
The chat buffer places user and LLM responses under a H2 header.
|
||||
These can be customized in the configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
inline = {
|
||||
adapter = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Adapter used for the inline strategy.";
|
||||
};
|
||||
|
||||
variables = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Define your own variables
|
||||
to share specific content.
|
||||
'';
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
accept_change = {
|
||||
n = mkOption {
|
||||
type = str;
|
||||
default = "ga";
|
||||
description = "Accept the suggested change.";
|
||||
};
|
||||
};
|
||||
|
||||
reject_change = {
|
||||
n = mkOption {
|
||||
type = str;
|
||||
default = "gr";
|
||||
description = "Reject the suggested change.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
prompt_library = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = ''
|
||||
A prompt library is a collection of prompts
|
||||
that can be used in the action palette.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
32
modules/plugins/assistant/codecompanion/config.nix
Normal file
32
modules/plugins/assistant/codecompanion/config.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.assistant.codecompanion-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
lazy.plugins = {
|
||||
codecompanion-nvim = {
|
||||
package = "codecompanion-nvim";
|
||||
setupModule = "codecompanion";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
sourcePlugins = ["codecompanion-nvim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./codecompanion-nvim.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -37,6 +37,12 @@ in {
|
|||
inherit (cfg) setupOpts;
|
||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||
|
||||
event = [
|
||||
{
|
||||
event = "User";
|
||||
pattern = "LazyFile";
|
||||
}
|
||||
];
|
||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||
keys = [
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
imports = [
|
||||
./chatgpt
|
||||
./copilot
|
||||
./codecompanion
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.types) bool listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
|
@ -21,8 +21,9 @@
|
|||
freeformType = anything;
|
||||
options = {
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = "module of the provider";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Provider module.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -40,20 +41,7 @@ in {
|
|||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
description = "Settings for completion providers";
|
||||
};
|
||||
|
||||
transform_items = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = mkLuaInline "function(_, items) return items end";
|
||||
defaultText = ''
|
||||
Our default does nothing. If you want blink.cmp's default, which
|
||||
lowers the score for snippets, set this option to null.
|
||||
'';
|
||||
description = ''
|
||||
Function to use when transforming the items before they're returned
|
||||
for all providers.
|
||||
'';
|
||||
description = "Settings for completion providers.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -63,6 +51,12 @@ in {
|
|||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
type = keymapType;
|
||||
default = {};
|
||||
description = "blink.cmp cmdline keymap";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
|
|
@ -74,6 +68,16 @@ in {
|
|||
description = "Delay before auto show triggers";
|
||||
};
|
||||
};
|
||||
|
||||
menu.auto_show = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Manages the appearance of the completion menu. You may prevent the menu
|
||||
from automatically showing by this option to `false` and manually showing
|
||||
it with the show keymap command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
|
|
@ -103,7 +107,25 @@ in {
|
|||
fuzzy = {
|
||||
prebuilt_binaries = {
|
||||
download = mkBool false ''
|
||||
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
|
||||
Auto-downloads prebuilt binaries.
|
||||
|
||||
::: .{warning}
|
||||
Do not enable this option, as it does **not work** on Nix!
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
implementation = mkOption {
|
||||
type = enum ["lua" "prefer_rust" "rust" "prefer_rust_with_warning"];
|
||||
default = "prefer_rust";
|
||||
description = ''
|
||||
fuzzy matcher implementation for Blink.
|
||||
|
||||
* `"lua"`: slower, Lua native fuzzy matcher implementation
|
||||
* `"rust": use the SIMD fuzzy matcher, 'frizbee'
|
||||
* `"prefer_rust"`: use the rust implementation, but fall back to lua
|
||||
* `"prefer_rust_with_warning"`: use the rust implementation, and fall back to lua
|
||||
if it is not available after emitting a warning.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
@ -122,12 +144,14 @@ in {
|
|||
sourcePlugins = let
|
||||
sourcePluginType = submodule {
|
||||
options = {
|
||||
enable = mkEnableOption "this source";
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = ''
|
||||
`blink-cmp` source plugin package.
|
||||
'';
|
||||
};
|
||||
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
|
|
@ -136,7 +160,6 @@ in {
|
|||
Should be present in the source's documentation.
|
||||
'';
|
||||
};
|
||||
enable = mkEnableOption "this source";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs;
|
||||
inherit (lib.lists) map optional;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||
inherit (lib.lists) map optional elem;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
|
||||
|
|
@ -24,7 +24,22 @@
|
|||
|
||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||
|
||||
blinkBuiltins = [
|
||||
"path"
|
||||
"lsp"
|
||||
"snippets"
|
||||
"buffer"
|
||||
"omni"
|
||||
];
|
||||
in {
|
||||
assertions =
|
||||
mapAttrsToList (provider: definition: {
|
||||
assertion = elem provider blinkBuiltins || definition.module != null;
|
||||
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
|
||||
})
|
||||
cfg.setupOpts.sources.providers;
|
||||
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
lazy.plugins = {
|
||||
|
|
|
|||
|
|
@ -60,12 +60,6 @@ in {
|
|||
enableSharedCmpSources = true;
|
||||
|
||||
nvim-cmp = {
|
||||
sources = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
path = "[Path]";
|
||||
};
|
||||
|
||||
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
||||
|
||||
setupOpts = {
|
||||
|
|
|
|||
|
|
@ -98,14 +98,16 @@ in {
|
|||
|
||||
sources = mkOption {
|
||||
type = attrsOf (nullOr str);
|
||||
default = {};
|
||||
default = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
path = "[Path]";
|
||||
};
|
||||
example = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
};
|
||||
description = "The list of sources used by nvim-cmp";
|
||||
example = literalExpression ''
|
||||
{
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
sourcePlugins = mkOption {
|
||||
|
|
|
|||
|
|
@ -3,18 +3,50 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.diagnostics.nvim-lint;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-lint"];
|
||||
pluginRC.nvim-lint = entryAnywhere ''
|
||||
require("lint").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-lint"];
|
||||
pluginRC.nvim-lint = entryAnywhere ''
|
||||
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
||||
|
||||
local linters = require("lint").linters
|
||||
local nvf_linters = ${toLuaObject cfg.linters}
|
||||
for linter, config in pairs(nvf_linters) do
|
||||
if linters[linter] == nil then
|
||||
linters[linter] = config
|
||||
else
|
||||
for key, val in pairs(config) do
|
||||
linters[linter][key] = val
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
nvf_lint = ${toLuaObject cfg.lint_function}
|
||||
'';
|
||||
};
|
||||
})
|
||||
(mkIf (cfg.enable && cfg.lint_after_save) {
|
||||
vim = {
|
||||
augroups = [{name = "nvf_nvim_lint";}];
|
||||
autocmds = [
|
||||
{
|
||||
event = ["BufWritePost"];
|
||||
callback = mkLuaInline ''
|
||||
function(args)
|
||||
nvf_lint(args.buf)
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,187 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.diagnostics.nvim-lint = {
|
||||
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
|
||||
setupOpts = mkPluginSetupOption "nvim-lint" {
|
||||
linters_by_ft = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
default = {};
|
||||
example = {
|
||||
text = ["vale"];
|
||||
markdown = ["vale"];
|
||||
};
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) nullOr attrsOf listOf str either submodule bool enum;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
linterType = submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Name of the linter";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Command of the linter";
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = nullOr (listOf (either str luaInline));
|
||||
default = null;
|
||||
description = "Arguments to pass";
|
||||
};
|
||||
|
||||
stdin = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Send content via stdin.";
|
||||
};
|
||||
|
||||
append_fname = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Map of filetype to formatters. This option takes a set of
|
||||
`key = value` format where the `value` will be converted
|
||||
to its Lua equivalent. You are responsible for passing the
|
||||
correct Nix data types to generate a correct Lua value that
|
||||
conform is able to accept.
|
||||
Automatically add the current file name to the commands arguments. Only
|
||||
has an effect if stdin is false
|
||||
'';
|
||||
};
|
||||
|
||||
stream = mkOption {
|
||||
type = nullOr (enum ["stdout" "stderr" "both"]);
|
||||
default = null;
|
||||
description = "Result stream";
|
||||
};
|
||||
|
||||
ignore_exitcode = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Declares if exit code != 1 should be ignored or result in a warning.
|
||||
'';
|
||||
};
|
||||
|
||||
env = mkOption {
|
||||
type = nullOr (attrsOf str);
|
||||
default = null;
|
||||
description = "Environment variables to use";
|
||||
};
|
||||
|
||||
cwd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Working directory of the linter";
|
||||
};
|
||||
|
||||
parser = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = "Parser function";
|
||||
};
|
||||
|
||||
required_files = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = ["eslint.config.js"];
|
||||
description = ''
|
||||
Required files to lint. These files must exist relative to the cwd
|
||||
of the linter or else this linter will be skipped
|
||||
|
||||
::: {.note}
|
||||
This option is an nvf extension that only takes effect if you
|
||||
use the `nvf_lint()` lua function.
|
||||
|
||||
See {option}`vim.diagnostics.nvim-lint.lint_function`.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.diagnostics.nvim-lint = {
|
||||
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
|
||||
|
||||
# nvim-lint does not have a setup table.
|
||||
linters_by_ft = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
default = {};
|
||||
example = {
|
||||
text = ["vale"];
|
||||
markdown = ["vale"];
|
||||
};
|
||||
description = ''
|
||||
Map of filetype to formatters. This option takes a set of `key = value`
|
||||
format where the `value` will be converted to its Lua equivalent
|
||||
through `toLuaObject. You are responsible for passing the correct Nix
|
||||
data types to generate a correct Lua value that conform is able to
|
||||
accept.
|
||||
'';
|
||||
};
|
||||
|
||||
linters = mkOption {
|
||||
type = attrsOf linterType;
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
phpcs = {
|
||||
args = ["-q" "--report-json" "-"];
|
||||
|
||||
# this will replace the builtin's env table if it exists
|
||||
env = {
|
||||
ENV_VAR = "something";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
|
||||
description = ''
|
||||
Linter configurations. Builtin linters will be updated and not
|
||||
replaced, but note that this is not a deep extend operation, i.e. if
|
||||
you define an `env` option, it will replace the entire `env` table
|
||||
provided by the builtin (if it exists).
|
||||
'';
|
||||
};
|
||||
|
||||
lint_after_save = mkEnableOption "autocmd to lint after each save" // {default = true;};
|
||||
|
||||
lint_function = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline ''
|
||||
function(buf)
|
||||
local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
|
||||
local linters = require("lint").linters
|
||||
local linters_from_ft = require("lint").linters_by_ft[ft]
|
||||
|
||||
-- if no linter is configured for this filetype, stops linting
|
||||
if linters_from_ft == nil then return end
|
||||
|
||||
for _, name in ipairs(linters_from_ft) do
|
||||
local linter = linters[name]
|
||||
assert(linter, 'Linter with name `' .. name .. '` not available')
|
||||
|
||||
if type(linter) == "function" then
|
||||
linter = linter()
|
||||
end
|
||||
-- for require("lint").lint() to work, linter.name must be set
|
||||
linter.name = linter.name or name
|
||||
local cwd = linter.required_files
|
||||
|
||||
-- if no configuration files are configured, lint
|
||||
if cwd == nil then
|
||||
require("lint").lint(linter)
|
||||
else
|
||||
-- if configuration files are configured and present in the project, lint
|
||||
for _, fn in ipairs(cwd) do
|
||||
local path = vim.fs.joinpath(linter.cwd or vim.fn.getcwd(), fn);
|
||||
if vim.uv.fs_stat(path) then
|
||||
require("lint").lint(linter)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
example = literalExpression ''
|
||||
mkLuaInline '''
|
||||
function(buf)
|
||||
require("lint").try_lint()
|
||||
end
|
||||
'''
|
||||
'';
|
||||
description = "Define the global function nvf_lint which is used by nvf to lint.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -683,15 +683,48 @@ in {
|
|||
};
|
||||
|
||||
git_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn"];
|
||||
description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "before";
|
||||
description = ''
|
||||
Place where the git icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
modified_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn"];
|
||||
description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the modified icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
hidden_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the hidden icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
diagnostics_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the diagnostics icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
bookmarks_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the bookmark icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
padding = mkOption {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) attrs enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.lua) mkLuaInline;
|
||||
{lib, ...}: let
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.types) attrs either nullOr;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.formatter.conform-nvim = {
|
||||
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
|
||||
|
|
@ -31,26 +28,46 @@ in {
|
|||
};
|
||||
|
||||
format_on_save = mkOption {
|
||||
type = attrs;
|
||||
default = {
|
||||
lsp_format = "fallback";
|
||||
timeout_ms = 500;
|
||||
};
|
||||
type = nullOr (either attrs luaInline);
|
||||
default = mkLuaInline ''
|
||||
function()
|
||||
if not vim.g.formatsave or vim.b.disableFormatSave then
|
||||
return
|
||||
else
|
||||
return {lsp_format = "fallback", timeout_ms = 500}
|
||||
end
|
||||
end
|
||||
'';
|
||||
defaultText = literalMD ''
|
||||
enabled by default, and respects {option}`vim.lsp.formatOnSave` and
|
||||
{option}`vim.lsp.mappings.toggleFormatSave`
|
||||
'';
|
||||
description = ''
|
||||
Table that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter on save.
|
||||
Attribute set or Lua function that will be passed to
|
||||
`conform.format()`. If this is set, Conform will run the formatter
|
||||
on save.
|
||||
'';
|
||||
};
|
||||
|
||||
format_after_save = mkOption {
|
||||
type = attrs;
|
||||
default = {lsp_format = "fallback";};
|
||||
description = ''
|
||||
Table that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter asynchronously after
|
||||
save.
|
||||
'';
|
||||
};
|
||||
format_after_save = let
|
||||
defaultFormatAfterSaveOpts = {lsp_format = "fallback";};
|
||||
in
|
||||
mkOption {
|
||||
type = nullOr (either attrs luaInline);
|
||||
default = mkLuaInline ''
|
||||
function()
|
||||
if not vim.g.formatsave or vim.b.disableFormatSave then
|
||||
return
|
||||
else
|
||||
return ${toLuaObject defaultFormatAfterSaveOpts}
|
||||
end
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Table or function(luainline) that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter asynchronously after save.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ in {
|
|||
./gitsigns
|
||||
./vim-fugitive
|
||||
./git-conflict
|
||||
./gitlinker-nvim
|
||||
];
|
||||
|
||||
options.vim.git = {
|
||||
|
|
@ -15,6 +16,7 @@ in {
|
|||
* gitsigns
|
||||
* vim-fugitive
|
||||
* git-conflict
|
||||
* gitlinker-nvim
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.git.gitlinker-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
lazy.plugins = {
|
||||
"gitlinker-nvim" = {
|
||||
package = "gitlinker-nvim";
|
||||
setupModule = "gitlinker";
|
||||
inherit (cfg) setupOpts;
|
||||
cmd = ["GitLink"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./gitlinker-nvim.nix
|
||||
];
|
||||
}
|
||||
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal file
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.git.gitlinker-nvim = {
|
||||
enable = mkEnableOption "gitlinker-nvim" // {default = config.vim.git.enable;};
|
||||
setupOpts = mkPluginSetupOption "gitlinker-nvim" {};
|
||||
};
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
|
@ -32,6 +33,7 @@ in {
|
|||
return '<Ignore>'
|
||||
end
|
||||
'')
|
||||
|
||||
(mkSetExprBinding gsMappings.previousHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||
|
|
@ -77,13 +79,14 @@ in {
|
|||
}
|
||||
|
||||
(mkIf cfg.codeActions.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.code_actions.gitsigns
|
||||
)
|
||||
'';
|
||||
vim.lsp.null-ls = {
|
||||
enable = true;
|
||||
setupOpts.sources = [
|
||||
(mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'')
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
inherit (lib.lists) isList;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
|
||||
cfg = config.vim.languages.astro;
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
package = pkgs.astro-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.astro.setup {
|
||||
capabilities = capabilities;
|
||||
capabilities = capabilities,
|
||||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
|
|
@ -39,42 +39,35 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.biome.with({
|
||||
command = "${cfg.format.package}/bin/biome",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.eslint_d.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -88,19 +81,19 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Astro LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "Astro LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Astro LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
||||
description = "Astro LSP server package, or the command to run as a list of strings";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -143,16 +136,22 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.astro = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "astro";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either package listOf str bool;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
|
|
@ -37,14 +37,6 @@
|
|||
formats = {
|
||||
shfmt = {
|
||||
package = pkgs.shfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -52,15 +44,6 @@
|
|||
diagnosticsProviders = {
|
||||
shellcheck = {
|
||||
package = pkgs.shellcheck;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.shellcheck.with({
|
||||
command = "${pkg}/bin/shellcheck",
|
||||
diagnostics_format = "#{m} [#{c}]"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -73,7 +56,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Bash LSP server to use";
|
||||
|
|
@ -130,16 +113,23 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.sh = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "bash";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.sh = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "clang LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "clang LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "The clang LSP server to use";
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "C# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "C# LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "C# LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
|
|
@ -42,14 +43,6 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
@ -87,7 +80,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "CSS LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "CSS LSP server to use";
|
||||
|
|
@ -132,8 +125,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.css = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
51
modules/plugins/languages/cue.nix
Normal file
51
modules/plugins/languages/cue.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.cue;
|
||||
in {
|
||||
options.vim.languages.cue = {
|
||||
enable = mkEnableOption "CUE language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "CUE treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = mkGrammarOption pkgs "cue";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CUE LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.cue;
|
||||
description = "cue lsp implementation";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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.cue-lsp = ''
|
||||
lspconfig.cue.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
cmd = {"${cfg.lsp.package}/bin/cue", "lsp"},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.languages.dart;
|
||||
ftcfg = cfg.flutter-tools;
|
||||
|
|
@ -77,20 +77,29 @@ in {
|
|||
flutter-tools = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
default = config.vim.lsp.enable;
|
||||
description = "Enable flutter-tools for flutter support";
|
||||
};
|
||||
|
||||
flutterPackage = mkOption {
|
||||
type = nullOr package;
|
||||
default = pkgs.flutter;
|
||||
description = "Flutter package, or null to detect the flutter path at runtime instead.";
|
||||
};
|
||||
|
||||
enableNoResolvePatch = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
default = false;
|
||||
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.
|
||||
::: {.note}
|
||||
This is required if `flutterPackage` is set to null and the flutter
|
||||
package in your `PATH` was built with Nix. If you are using a flutter
|
||||
SDK installed from a different source and encounter the error "`dart`
|
||||
missing from `PATH`", leave this option disabled.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -122,25 +131,30 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
config.vim = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
treesitter.enable = true;
|
||||
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;
|
||||
lsp.lspconfig.enable = true;
|
||||
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-nvim"];
|
||||
startPlugins = [
|
||||
(
|
||||
if ftcfg.enableNoResolvePatch
|
||||
then "flutter-tools-patched"
|
||||
else "flutter-tools-nvim"
|
||||
)
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
vim.pluginRC.flutter-tools = entryAnywhere ''
|
||||
pluginRC.flutter-tools = entryAfter ["lsp-setup"] ''
|
||||
require('flutter-tools').setup {
|
||||
${optionalString (ftcfg.flutterPackage != null) "flutter_path = \"${ftcfg.flutterPackage}/bin/flutter\","}
|
||||
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
|
||||
|
|
@ -152,7 +166,6 @@ in {
|
|||
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach;
|
||||
flags = lsp_flags,
|
||||
},
|
||||
${optionalString cfg.dap.enable ''
|
||||
debugger = {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
./asm.nix
|
||||
./astro.nix
|
||||
./bash.nix
|
||||
./cue.nix
|
||||
./dart.nix
|
||||
./clang.nix
|
||||
./css.nix
|
||||
./elixir.nix
|
||||
./fsharp.nix
|
||||
./gleam.nix
|
||||
./go.nix
|
||||
./hcl.nix
|
||||
./helm.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./haskell.nix
|
||||
|
|
@ -41,10 +45,13 @@ in {
|
|||
./wgsl.nix
|
||||
./yaml.nix
|
||||
./ruby.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
];
|
||||
|
||||
options.vim.languages = {
|
||||
enableLSP = mkEnable "LSP";
|
||||
# Those are still managed by plugins, and should be enabled here.
|
||||
enableDAP = mkEnable "Debug Adapter";
|
||||
enableTreesitter = mkEnable "Treesitter";
|
||||
enableFormat = mkEnable "Formatting";
|
||||
|
|
|
|||
|
|
@ -38,14 +38,9 @@
|
|||
formats = {
|
||||
mix = {
|
||||
package = pkgs.elixir;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.mix.with({
|
||||
command = "${cfg.format.package}/bin/mix",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/mix";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -58,7 +53,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Elixir LSP server to use";
|
||||
|
|
@ -107,8 +102,12 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.elixir = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} =
|
||||
formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.elixir-tools.enable {
|
||||
|
|
|
|||
107
modules/plugins/languages/fsharp.nix
Normal file
107
modules/plugins/languages/fsharp.nix
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) either listOf package str enum;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
defaultServer = "fsautocomplete";
|
||||
servers = {
|
||||
fsautocomplete = {
|
||||
package = pkgs.fsautocomplete;
|
||||
internalFormatter = false;
|
||||
lspConfig = ''
|
||||
lspconfig.fsautocomplete.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else "{'${cfg.lsp.package}/bin/fsautocomplete'}"
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = "fantomas";
|
||||
formats = {
|
||||
fantomas = {
|
||||
package = pkgs.fantomas;
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.vim.languages.fsharp;
|
||||
in {
|
||||
options = {
|
||||
vim.languages.fsharp = {
|
||||
enable = mkEnableOption "F# language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "F# treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "fsharp";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "F# LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "F# LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
example = ''[lib.getExe pkgs.fsautocomplete "--state-directory" "~/.cache/fsautocomplete"]'';
|
||||
description = "F# LSP server package, or the command to run as a list of strings";
|
||||
};
|
||||
};
|
||||
format = {
|
||||
enable = mkEnableOption "F# formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "F# formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "F# formatter 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.fsharp-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.fsharp = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
|
|
@ -38,36 +38,15 @@
|
|||
formats = {
|
||||
gofmt = {
|
||||
package = pkgs.go;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.gofmt.with({
|
||||
command = "${cfg.format.package}/bin/gofmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = "${cfg.format.package}/bin/gofmt";
|
||||
};
|
||||
gofumpt = {
|
||||
package = pkgs.gofumpt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.gofumpt.with({
|
||||
command = "${cfg.format.package}/bin/gofumpt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = getExe cfg.format.package;
|
||||
};
|
||||
golines = {
|
||||
package = pkgs.golines;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.golines.with({
|
||||
command = "${cfg.format.package}/bin/golines",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = "${cfg.format.package}/bin/golines";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -88,7 +67,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Go LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Go LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Go LSP server to use";
|
||||
|
|
@ -105,7 +84,14 @@ in {
|
|||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;};
|
||||
enable =
|
||||
mkEnableOption "Go formatting"
|
||||
// {
|
||||
default = !cfg.lsp.enable && config.vim.languages.enableFormat;
|
||||
defaultText = literalMD ''
|
||||
disabled if Go LSP is enabled, otherwise follows {option}`vim.languages.enableFormat`
|
||||
'';
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
description = "Go formatter to use";
|
||||
|
|
@ -153,8 +139,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.go = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
description = "Haskell LSP package or command to run the Haskell LSP";
|
||||
example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package bool enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
|
@ -30,14 +31,6 @@
|
|||
formats = {
|
||||
hclfmt = {
|
||||
package = pkgs.hclfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.hclfmt.with({
|
||||
command = "${lib.getExe cfg.format.package}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -50,7 +43,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.lsp.enable;};
|
||||
# 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;
|
||||
|
|
@ -110,8 +103,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
89
modules/plugins/languages/helm.nix
Normal file
89
modules/plugins/languages/helm.nix
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
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.helm;
|
||||
yamlCfg = config.vim.languages.yaml;
|
||||
|
||||
helmCmd =
|
||||
if isList cfg.lsp.package
|
||||
then cfg.lsp.package
|
||||
else ["${cfg.lsp.package}/bin/helm_ls" "serve"];
|
||||
yamlCmd =
|
||||
if isList yamlCfg.lsp.package
|
||||
then builtins.elemAt yamlCfg.lsp.package 0
|
||||
else "${yamlCfg.lsp.package}/bin/yaml-language-server";
|
||||
|
||||
defaultServer = "helm-ls";
|
||||
servers = {
|
||||
helm-ls = {
|
||||
package = pkgs.helm-ls;
|
||||
lspConfig = ''
|
||||
lspconfig.helm_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
cmd = ${expToLua helmCmd},
|
||||
settings = {
|
||||
['helm-ls'] = {
|
||||
yamlls = {
|
||||
path = "${yamlCmd}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.helm = {
|
||||
enable = mkEnableOption "Helm language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Helm treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "helm";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Helm LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Helm LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Helm LSP server package";
|
||||
type = 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.helm-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
{
|
||||
# Enables filetype detection
|
||||
vim.startPlugins = [pkgs.vimPlugins.vim-helm];
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
description = "java language server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ in {
|
|||
lsp = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
default = config.vim.lsp.enable;
|
||||
description = ''
|
||||
Whether to enable Julia LSP support.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.types) either package listOf str;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.lists) isList;
|
||||
|
|
@ -19,14 +18,6 @@
|
|||
diagnosticsProviders = {
|
||||
ktlint = {
|
||||
package = pkgs.ktlint;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.ktlint.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -39,7 +30,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
description = "kotlin_language_server package with Kotlin runtime";
|
||||
|
|
@ -76,11 +67,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "kotlin";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.kotlin = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -4,16 +4,30 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.types) bool either enum listOf package str;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
|
||||
cfg = config.vim.languages.lua;
|
||||
defaultFormat = "stylua";
|
||||
formats = {
|
||||
stylua = {
|
||||
package = pkgs.stylua;
|
||||
};
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["luacheck"];
|
||||
diagnosticsProviders = {
|
||||
luacheck = {
|
||||
package = pkgs.luajitPackages.luacheck;
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
||||
|
|
@ -29,7 +43,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
description = "LuaLS package, or the command to run as a list of strings";
|
||||
|
|
@ -39,6 +53,34 @@ in {
|
|||
|
||||
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableFormat;
|
||||
description = "Enable Lua formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "Lua formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Lua formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Lua diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Lua";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
|
|
@ -74,6 +116,27 @@ in {
|
|||
})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.lua = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.lua = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]))
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.lists) isList concatLists;
|
||||
inherit (lib.types) bool enum either package listOf str;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either package listOf str nullOr;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.markdown;
|
||||
|
|
@ -32,31 +33,23 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "denofmt";
|
||||
defaultFormat = "deno_fmt";
|
||||
formats = {
|
||||
# for backwards compatibility
|
||||
denofmt = {
|
||||
package = pkgs.deno;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.deno_fmt.with({
|
||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||
command = "${cfg.format.package}/bin/deno",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
deno_fmt = {
|
||||
package = pkgs.deno;
|
||||
};
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettierd.with({
|
||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||
command = "${cfg.format.package}/bin/prettierd",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||
diagnosticsProviders = {
|
||||
markdownlint-cli2 = {
|
||||
package = pkgs.markdownlint-cli2;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -74,7 +67,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
@ -96,7 +89,7 @@ in {
|
|||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "Markdown formatter to use";
|
||||
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
|
|
@ -121,15 +114,19 @@ in {
|
|||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||
|
||||
Inline Markdown rendering with [render-markdown.nvim]
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "render-markdown" {
|
||||
auto_override_publish_diagnostics = mkOption {
|
||||
description = "Automatically override the publish_diagnostics handler";
|
||||
type = bool;
|
||||
default = true;
|
||||
file_types = lib.mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of buffer filetypes to enable this plugin in.
|
||||
|
||||
This will cause the plugin to attach to new buffers who
|
||||
have any of these filetypes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -146,6 +143,15 @@ in {
|
|||
setupOpts = mkPluginSetupOption "markview-nvim" {};
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Markdown diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Markdown";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -160,8 +166,17 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.markdown = [cfg.format.type];
|
||||
setupOpts.formatters.${
|
||||
if cfg.format.type == "denofmt"
|
||||
then "deno_fmt"
|
||||
else cfg.format.type
|
||||
} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
# Extensions
|
||||
|
|
@ -178,5 +193,16 @@ in {
|
|||
require("markview").setup(${toLuaObject cfg.extensions.markview-nvim.setupOpts})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.markdown = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
|
|
@ -38,14 +39,9 @@
|
|||
formats = {
|
||||
nimpretty = {
|
||||
package = pkgs.nim;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.nimpretty.with({
|
||||
command = "${pkgs.nim}/bin/nimpretty",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/nimpretty";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -58,7 +54,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nim LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "Nim LSP server to use";
|
||||
type = str;
|
||||
|
|
@ -110,8 +106,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nim = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) concatStringsSep;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
|
|
@ -13,7 +15,6 @@
|
|||
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
|
||||
cfg = config.vim.languages.nix;
|
||||
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
else ''{"${package}/bin/${defaultCmd}"}'';
|
||||
servers = {
|
||||
nil = {
|
||||
package = pkgs.nil;
|
||||
package = inputs.nil.packages.${pkgs.stdenv.system}.nil;
|
||||
internalFormatter = true;
|
||||
lspConfig = ''
|
||||
lspconfig.nil_ls.setup{
|
||||
|
|
@ -100,26 +101,10 @@
|
|||
formats = {
|
||||
alejandra = {
|
||||
package = pkgs.alejandra;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.alejandra.with({
|
||||
command = "${cfg.format.package}/bin/alejandra"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.nixfmt.with({
|
||||
command = "${cfg.format.package}/bin/nixfmt"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -159,7 +144,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "Nix LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
|
|
@ -237,17 +222,24 @@ in {
|
|||
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig;
|
||||
(mkIf (cfg.format.enable && (!cfg.lsp.enable || !servers.${cfg.lsp.server}.internalFormatter)) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nix = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "nix";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.nix = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
type = str;
|
||||
default = defaultServer;
|
||||
|
|
|
|||
|
|
@ -37,14 +37,6 @@
|
|||
formats = {
|
||||
ocamlformat = {
|
||||
package = pkgs.ocamlPackages.ocamlformat;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.ocamlformat.with({
|
||||
command = "${cfg.format.package}/bin/ocamlformat",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -57,7 +49,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "OCaml LSP server to user";
|
||||
type = enum (attrNames servers);
|
||||
|
|
@ -97,9 +89,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.ocamlformat = formats.${cfg.format.type}.nullConfig;
|
||||
vim.extraPackages = [formats.${cfg.format.type}.package];
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.ocaml = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Odin LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Odin LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,26 @@
|
|||
}
|
||||
'';
|
||||
};
|
||||
|
||||
intelephense = {
|
||||
package = pkgs.intelephense;
|
||||
lspConfig = ''
|
||||
lspconfig.intelephense.setup{
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''
|
||||
{
|
||||
"${getExe cfg.lsp.package}",
|
||||
"--stdio"
|
||||
},
|
||||
''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.php = {
|
||||
|
|
@ -75,7 +95,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "PHP LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "PHP LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "PHP LSP server to use";
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
};
|
||||
|
||||
python-lsp-server = {
|
||||
package = pkgs.python-lsp-server;
|
||||
package = pkgs.python3Packages.python-lsp-server;
|
||||
lspConfig = ''
|
||||
lspconfig.pylsp.setup{
|
||||
capabilities = capabilities;
|
||||
|
|
@ -66,26 +66,10 @@
|
|||
formats = {
|
||||
black = {
|
||||
package = pkgs.black;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.black.with({
|
||||
command = "${cfg.format.package}/bin/black",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
isort = {
|
||||
package = pkgs.isort;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.isort.with({
|
||||
command = "${cfg.format.package}/bin/isort",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
black-and-isort = {
|
||||
|
|
@ -96,15 +80,6 @@
|
|||
black --quiet - "$@" | isort --profile black -
|
||||
'';
|
||||
};
|
||||
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.black.with({
|
||||
command = "${cfg.format.package}/bin/black",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
ruff = {
|
||||
|
|
@ -115,14 +90,6 @@
|
|||
ruff format -
|
||||
'';
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.ruff.with({
|
||||
command = "${cfg.format.package}/bin/ruff",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -132,7 +99,7 @@
|
|||
# idk if this is the best way to install/run debugpy
|
||||
package = pkgs.python3.withPackages (ps: with ps; [debugpy]);
|
||||
dapConfig = ''
|
||||
dap.adapters.python = function(cb, config)
|
||||
dap.adapters.debugpy = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
|
|
@ -161,7 +128,7 @@
|
|||
dap.configurations.python = {
|
||||
{
|
||||
-- The first three options are required by nvim-dap
|
||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
type = 'debugpy'; -- the type here established the link to the adapter definition: `dap.adapters.debugpy`
|
||||
request = 'launch';
|
||||
name = "Launch file";
|
||||
|
||||
|
|
@ -202,7 +169,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Python LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Python LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Python LSP server to use";
|
||||
|
|
@ -272,8 +239,22 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
# HACK: I'm planning to remove these soon so I just took the easiest way out
|
||||
setupOpts.formatters_by_ft.python =
|
||||
if cfg.format.type == "black-and-isort"
|
||||
then ["black"]
|
||||
else [cfg.format.type];
|
||||
setupOpts.formatters =
|
||||
if (cfg.format.type == "black-and-isort")
|
||||
then {
|
||||
black.command = "${cfg.format.package}/bin/black";
|
||||
}
|
||||
else {
|
||||
${cfg.format.type}.command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
|
|
|
|||
|
|
@ -24,28 +24,29 @@
|
|||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.styler];
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.styler.with({
|
||||
command = "${cfg.format.package}/bin/R",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
};
|
||||
};
|
||||
|
||||
format_r = {
|
||||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.formatR];
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.format_r.with({
|
||||
command = "${cfg.format.package}/bin/R",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
stdin = true;
|
||||
args = [
|
||||
"--slave"
|
||||
"--no-restore"
|
||||
"--no-save"
|
||||
"-s"
|
||||
"-e"
|
||||
''formatR::tidy_source(source="stdin")''
|
||||
];
|
||||
# TODO: range_args seem to be possible
|
||||
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "R LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "R LSP server to use";
|
||||
|
|
@ -118,8 +119,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.r = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.types) either listOf package str enum;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
|
||||
cfg = config.vim.languages.ruby;
|
||||
|
||||
|
|
@ -35,24 +35,8 @@
|
|||
defaultFormat = "rubocop";
|
||||
formats = {
|
||||
rubocop = {
|
||||
# TODO: is this right?
|
||||
package = pkgs.rubyPackages.rubocop;
|
||||
nullConfig = ''
|
||||
local conditional = function(fn)
|
||||
local utils = require("null-ls.utils").make_conditional_utils()
|
||||
return fn(utils)
|
||||
end
|
||||
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.rubocop.with({
|
||||
command="${pkgs.bundler}/bin/bundle",
|
||||
args = vim.list_extend(
|
||||
{"exec", "rubocop", "-a" },
|
||||
null_ls.builtins.formatting.rubocop._opts.args
|
||||
),
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -60,14 +44,7 @@
|
|||
diagnosticsProviders = {
|
||||
rubocop = {
|
||||
package = pkgs.rubyPackages.rubocop;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.rubocop.with({
|
||||
command = "${lib.getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -80,7 +57,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Ruby LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Ruby LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
@ -136,16 +113,23 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.ruby = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "ruby";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.ruby = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.strings) optionalString;
|
||||
|
|
@ -21,14 +22,6 @@
|
|||
formats = {
|
||||
rustfmt = {
|
||||
package = pkgs.rustfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.rustfmt.with({
|
||||
command = "${cfg.format.package}/bin/rustfmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -50,7 +43,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
description = "rust-analyzer package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
|
|
@ -128,8 +121,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.rust = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.lsp.enable;};
|
||||
package = mkPackageOption pkgs "metals" {
|
||||
default = ["metals"];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) diagnostics;
|
||||
|
||||
cfg = config.vim.languages.sql;
|
||||
|
|
@ -41,15 +41,10 @@
|
|||
formats = {
|
||||
sqlfluff = {
|
||||
package = sqlfluffDefault;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.sqlfluff.with({
|
||||
command = "${cfg.format.package}/bin/sqlfluff",
|
||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = getExe cfg.format.package;
|
||||
append_args = ["--dialect=${cfg.dialect}"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -57,15 +52,10 @@
|
|||
diagnosticsProviders = {
|
||||
sqlfluff = {
|
||||
package = sqlfluffDefault;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.sqlfluff.with({
|
||||
command = "${pkg}/bin/sqlfluff",
|
||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
cmd = getExe sqlfluffDefault;
|
||||
args = ["lint" "--format=json" "--dialect=${cfg.dialect}"];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -89,7 +79,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "SQL LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "SQL LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "SQL LSP server to use";
|
||||
|
|
@ -150,16 +140,20 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.sql = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "sql";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.sql = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
|
||||
cfg = config.vim.languages.svelte;
|
||||
|
|
@ -39,42 +39,31 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.biome.with({
|
||||
command = "${cfg.format.package}/bin/biome",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.eslint_d.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -88,7 +77,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Svelte LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Svelte LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Svelte LSP server to use";
|
||||
|
|
@ -143,16 +132,22 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.svelte-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.svelte = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "svelte";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.svelte = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ in {
|
|||
enable = mkEnableOption "Tailwindcss language support";
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Tailwindcss LSP server to use";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Terraform LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Terraform LSP support (terraform-ls)" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
description = "terraform-ls package";
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.types) enum either listOf package str bool;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
|
@ -77,55 +77,36 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
filetypes = { "typescript", "javascript" },
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettierd",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.biome.with({
|
||||
command = "${cfg.format.package}/bin/biome",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.eslint_d.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.cjs"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -140,7 +121,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Typescript/Javascript LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Typescript/Javascript LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Typescript/Javascript LSP server to use";
|
||||
|
|
@ -215,16 +196,28 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.typescript = [cfg.format.type];
|
||||
# .tsx files
|
||||
formatters_by_ft.typescriptreact = [cfg.format.type];
|
||||
formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "ts";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
||||
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
|
||||
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) nullOr enum either attrsOf listOf package str;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
|
|
@ -61,26 +60,10 @@
|
|||
formats = {
|
||||
typstfmt = {
|
||||
package = pkgs.typstfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.typstfmt.with({
|
||||
command = "${cfg.format.package}/bin/typstfmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
# https://github.com/Enter-tainer/typstyle
|
||||
typstyle = {
|
||||
package = pkgs.typstyle;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.typstfmt.with({
|
||||
command = "${cfg.format.package}/bin/typstyle",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
|
@ -93,7 +76,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Typst LSP server to use";
|
||||
|
|
@ -176,8 +159,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.typst-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.typst = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Vala LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "Vala LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "WGSL LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "WGSL LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -14,14 +14,27 @@
|
|||
|
||||
cfg = config.vim.languages.yaml;
|
||||
|
||||
onAttach =
|
||||
if config.vim.languages.helm.lsp.enable
|
||||
then ''
|
||||
on_attach = function(client, bufnr)
|
||||
local filetype = vim.bo[bufnr].filetype
|
||||
if filetype == "helm" then
|
||||
client.stop()
|
||||
end
|
||||
end''
|
||||
else "on_attach = default_on_attach";
|
||||
|
||||
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;
|
||||
capabilities = capabilities,
|
||||
${onAttach},
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
|
|
@ -42,7 +55,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "YAML LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Zig LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Zig LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||
|
|
@ -13,7 +15,10 @@
|
|||
usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable;
|
||||
usingBlinkCmp = config.vim.autocomplete.blink-cmp.enable;
|
||||
self = import ./module.nix {inherit config lib pkgs;};
|
||||
conformCfg = config.vim.formatter.conform-nvim;
|
||||
conformFormatOnSave = conformCfg.enable && conformCfg.setupOpts.format_on_save != null;
|
||||
|
||||
augroup = "nvf_lsp";
|
||||
mappingDefinitions = self.options.vim.lsp.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
mkBinding = binding: action:
|
||||
|
|
@ -28,6 +33,60 @@ in {
|
|||
sourcePlugins = ["cmp-nvim-lsp"];
|
||||
};
|
||||
|
||||
augroups = [{name = augroup;}];
|
||||
autocmds =
|
||||
(optional cfg.inlayHints.enable {
|
||||
group = augroup;
|
||||
event = ["LspAttach"];
|
||||
desc = "LSP on-attach enable inlay hints autocmd";
|
||||
callback = mkLuaInline ''
|
||||
function(event)
|
||||
local bufnr = event.buf
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
'';
|
||||
})
|
||||
++ (optional (!conformFormatOnSave) {
|
||||
group = augroup;
|
||||
event = ["BufWritePre"];
|
||||
desc = "LSP on-attach create format on save autocmd";
|
||||
callback = mkLuaInline ''
|
||||
function(ev)
|
||||
if vim.b.disableFormatSave or not vim.g.formatsave then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = ev.buf
|
||||
|
||||
${optionalString cfg.null-ls.enable ''
|
||||
-- prefer null_ls formatter
|
||||
do
|
||||
local clients = vim.lsp.get_clients({
|
||||
bufnr = bufnr,
|
||||
name = "null-ls",
|
||||
method = "textDocument/formatting",
|
||||
})
|
||||
if clients[1] then
|
||||
vim.lsp.buf.format({ bufnr = bufnr, id = clients[1].id })
|
||||
return
|
||||
end
|
||||
end
|
||||
''}
|
||||
|
||||
local clients = vim.lsp.get_clients({
|
||||
bufnr = bufnr,
|
||||
method = "textDocument/formatting",
|
||||
})
|
||||
if clients[1] then
|
||||
vim.lsp.buf.format({ bufnr = bufnr, id = clients[1].id })
|
||||
end
|
||||
end
|
||||
'';
|
||||
});
|
||||
|
||||
pluginRC.lsp-setup = ''
|
||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||
|
||||
|
|
@ -54,60 +113,9 @@ in {
|
|||
${mkBinding mappings.toggleFormatOnSave "function() vim.b.disableFormatSave = not vim.b.disableFormatSave end"}
|
||||
end
|
||||
|
||||
-- Enable formatting
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
format_callback = function(client, bufnr)
|
||||
if vim.g.formatsave then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
${
|
||||
if config.vim.lsp.null-ls.enable
|
||||
then ''
|
||||
if vim.b.disableFormatSave then
|
||||
return
|
||||
end
|
||||
|
||||
local function is_null_ls_formatting_enabled(bufnr)
|
||||
local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype")
|
||||
local generators = require("null-ls.generators").get_available(
|
||||
file_type,
|
||||
require("null-ls.methods").internal.FORMATTING
|
||||
)
|
||||
return #generators > 0
|
||||
end
|
||||
|
||||
if is_null_ls_formatting_enabled(bufnr) then
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end
|
||||
})
|
||||
else
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end
|
||||
''
|
||||
else "
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
})
|
||||
"
|
||||
}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
${optionalString config.vim.ui.breadcrumbs.enable ''local navic = require("nvim-navic")''}
|
||||
default_on_attach = function(client, bufnr)
|
||||
attach_keymaps(client, bufnr)
|
||||
format_callback(client, bufnr)
|
||||
${optionalString config.vim.ui.breadcrumbs.enable ''
|
||||
-- let navic attach to buffers
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
|
|
@ -118,6 +126,7 @@ in {
|
|||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
${optionalString usingNvimCmp ''
|
||||
-- TODO(horriblename): migrate to vim.lsp.config['*']
|
||||
-- HACK: copied from cmp-nvim-lsp. If we ever lazy load lspconfig we
|
||||
-- should re-evaluate whether we can just use `default_capabilities`
|
||||
capabilities = {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
./lightbulb
|
||||
./otter
|
||||
./lspkind
|
||||
./lsplines
|
||||
./nvim-docs-view
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ in {
|
|||
config = mkIf cfg.lspconfig.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
lsp.enable = true;
|
||||
|
||||
startPlugins = ["nvim-lspconfig"];
|
||||
|
||||
pluginRC.lspconfig = entryAfter ["lsp-setup"] ''
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.lsplines.enable) {
|
||||
vim.startPlugins = ["lsp-lines"];
|
||||
vim.pluginRC.lsplines = entryAfter ["lspconfig"] ''
|
||||
require("lsp_lines").setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
lsplines = {
|
||||
enable = mkEnableOption ''
|
||||
diagnostics using virtual lines on top of the real line of code. [lsp_lines]
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -3,51 +3,24 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
self = import ./lspsaga.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
||||
vim = {
|
||||
startPlugins = ["lspsaga-nvim"];
|
||||
lazy.plugins.lspsaga-nvim = {
|
||||
package = "lspsaga-nvim";
|
||||
setupModule = "lspsaga";
|
||||
inherit (cfg.lspsaga) setupOpts;
|
||||
|
||||
maps = {
|
||||
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
||||
normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder")
|
||||
(mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc")
|
||||
|
||||
(mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end")
|
||||
(mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end")
|
||||
|
||||
(mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename")
|
||||
(mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition")
|
||||
|
||||
(mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics")
|
||||
(mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics")
|
||||
|
||||
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
||||
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
||||
|
||||
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
||||
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
||||
];
|
||||
event = ["LspAttach"];
|
||||
};
|
||||
|
||||
pluginRC.lspsaga = entryAnywhere ''
|
||||
require('lspsaga').init_lsp_saga({
|
||||
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
||||
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
||||
''}
|
||||
})
|
||||
'';
|
||||
# Optional dependencies, pretty useful to enhance default functionality of
|
||||
# Lspsaga.
|
||||
treesitter.enable = mkDefault true;
|
||||
visuals.nvim-web-devicons.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,47 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkRemovedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.types) borderType mkPluginSetupOption;
|
||||
inherit (lib.nvim.lua) mkLuaInline;
|
||||
|
||||
uiKindSetupOpts =
|
||||
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
|
||||
then {
|
||||
ui.kind =
|
||||
mkLuaInline
|
||||
# lua
|
||||
''
|
||||
require("catppuccin.groups.integrations.lsp_saga").custom_kind()
|
||||
'';
|
||||
}
|
||||
else {};
|
||||
in {
|
||||
imports = [
|
||||
(mkRemovedOptionModule ["vim" "lsp" "lspsaga" "mappings"] ''
|
||||
Lspsaga mappings have been removed from nvf, as the original author has made
|
||||
very drastic changes to the API after taking back ownership, and the fork we
|
||||
used is now archived. Please refer to Lspsaga documentation to add keybinds
|
||||
for functionality you have used.
|
||||
|
||||
<https://nvimdev.github.io/lspsaga>
|
||||
'')
|
||||
];
|
||||
|
||||
options.vim.lsp.lspsaga = {
|
||||
enable = mkEnableOption "LSP Saga";
|
||||
|
||||
mappings = {
|
||||
lspFinder = mkMappingOption "LSP Finder [LSPSaga]" "<leader>lf";
|
||||
renderHoveredDoc = mkMappingOption "Rendered hovered docs [LSPSaga]" "<leader>lh";
|
||||
|
||||
smartScrollUp = mkMappingOption "Smart scroll up [LSPSaga]" "<C-f>";
|
||||
smartScrollDown = mkMappingOption "Smart scroll up [LSPSaga]" "<C-b>";
|
||||
|
||||
rename = mkMappingOption "Rename [LSPSaga]" "<leader>lr";
|
||||
previewDefinition = mkMappingOption "Preview definition [LSPSaga]" "<leader>ld";
|
||||
|
||||
showLineDiagnostics = mkMappingOption "Show line diagnostics [LSPSaga]" "<leader>ll";
|
||||
showCursorDiagnostics = mkMappingOption "Show cursor diagnostics [LSPSaga]" "<leader>lc";
|
||||
|
||||
nextDiagnostic = mkMappingOption "Next diagnostic [LSPSaga]" "<leader>ln";
|
||||
previousDiagnostic = mkMappingOption "Previous diagnostic [LSPSaga]" "<leader>lp";
|
||||
|
||||
codeAction = mkMappingOption "Code action [LSPSaga]" "<leader>ca";
|
||||
|
||||
signatureHelp = mkMappingOption "Signature help [LSPSaga]" "<leader>ls";
|
||||
};
|
||||
setupOpts =
|
||||
mkPluginSetupOption "lspsaga" {
|
||||
border_style = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "Border type, see {command}`:help nvim_open_win`";
|
||||
};
|
||||
}
|
||||
// uiKindSetupOpts;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,12 @@
|
|||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
|
||||
formatOnSave = mkEnableOption "format on save";
|
||||
|
||||
inlayHints = {
|
||||
enable = mkEnableOption "inlay hints";
|
||||
};
|
||||
|
||||
mappings = {
|
||||
goToDefinition =
|
||||
mkMappingOption "Go to definition"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,12 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
cfg = config.vim.lsp.null-ls;
|
||||
in {
|
||||
config = mkIf cfg.null-ls.enable (mkMerge [
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
startPlugins = [
|
||||
|
|
@ -18,35 +17,14 @@ in {
|
|||
"plenary-nvim"
|
||||
];
|
||||
|
||||
# null-ls implies LSP already being set up
|
||||
# since it will hook into LSPs to receive information
|
||||
# null-ls implies that LSP is already being set up
|
||||
# as it will hook into LSPs to receive information.
|
||||
lsp.enable = true;
|
||||
|
||||
pluginRC = {
|
||||
# early setup for null-ls
|
||||
null_ls-setup = entryAnywhere ''
|
||||
local null_ls = require("null-ls")
|
||||
local null_helpers = require("null-ls.helpers")
|
||||
local null_methods = require("null-ls.methods")
|
||||
local ls_sources = {}
|
||||
'';
|
||||
|
||||
# null-ls setup
|
||||
null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
|
||||
require('null-ls').setup({
|
||||
debug = ${boolToString cfg.null-ls.debug},
|
||||
diagnostics_format = "${cfg.null-ls.diagnostics_format}",
|
||||
debounce = ${toString cfg.null-ls.debounce},
|
||||
default_timeout = ${toString cfg.null-ls.default_timeout},
|
||||
sources = ls_sources,
|
||||
on_attach = default_on_attach
|
||||
})
|
||||
'';
|
||||
};
|
||||
pluginRC.null_ls = entryAfter ["lsp-setup"] ''
|
||||
require('null-ls').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
vim.pluginRC = mapAttrs (_: v: (entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources;
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,87 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf str int;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) listOf str int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||
inherit (lib.nvim.config) batchRenameOptions;
|
||||
|
||||
migrationTable = {
|
||||
debug = "debug";
|
||||
diagnostics_format = "diagnostics_format";
|
||||
debounce = "debounce";
|
||||
default_timeout = "default_timeout";
|
||||
sources = "sources";
|
||||
};
|
||||
|
||||
renamedSetupOpts =
|
||||
batchRenameOptions
|
||||
["vim" "lsp" "null-ls"]
|
||||
["vim" "lsp" "null-ls" "setupOpts"]
|
||||
migrationTable;
|
||||
in {
|
||||
imports = renamedSetupOpts;
|
||||
|
||||
options.vim.lsp.null-ls = {
|
||||
enable = mkEnableOption "null-ls, also enabled automatically";
|
||||
enable = mkEnableOption ''
|
||||
null-ls, plugin to use Neovim as a language server to inject LSP diagnostics,
|
||||
code actions, and more via Lua.
|
||||
'';
|
||||
|
||||
debug = mkEnableOption "debugging information for `null-ls";
|
||||
setupOpts = mkPluginSetupOption "null-ls" {
|
||||
debug = mkEnableOption ''
|
||||
debugging information for null-ls.
|
||||
|
||||
diagnostics_format = mkOption {
|
||||
type = str;
|
||||
default = "[#{m}] #{s} (#{c})";
|
||||
description = "Diagnostic output format for null-ls";
|
||||
};
|
||||
Displays all possible log messages and writes them to the null-ls log,
|
||||
which you can view with the command `:NullLsLog`
|
||||
'';
|
||||
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
default = 250;
|
||||
description = "Default debounce";
|
||||
};
|
||||
diagnostics_format = mkOption {
|
||||
type = str;
|
||||
default = "[#{m}] #{s} (#{c})";
|
||||
description = ''
|
||||
Sets the default format used for diagnostics. null-ls will replace th
|
||||
e following special components with the relevant diagnostic information:
|
||||
|
||||
default_timeout = mkOption {
|
||||
type = int;
|
||||
default = 5000;
|
||||
description = "Default timeout value, in milliseconds";
|
||||
};
|
||||
* `#{m}`: message
|
||||
* `#{s}`: source name (defaults to null-ls if not specified)
|
||||
* `#{c}`: code (if available)
|
||||
'';
|
||||
};
|
||||
|
||||
sources = mkOption {
|
||||
description = "null-ls sources";
|
||||
type = attrsOf str;
|
||||
default = {};
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
default = 250;
|
||||
description = ''
|
||||
Amount of time between the last change to a buffer and the next `textDocument/didChange` notification.
|
||||
'';
|
||||
};
|
||||
|
||||
default_timeout = mkOption {
|
||||
type = int;
|
||||
default = 5000;
|
||||
description = ''
|
||||
Amount of time (in milliseconds) after which built-in sources will time out.
|
||||
|
||||
:::{.note}
|
||||
Built-in sources can define their own timeout period and users can override
|
||||
the timeout period on a per-source basis
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
sources = mkOption {
|
||||
type = nullOr (listOf luaInline);
|
||||
default = null;
|
||||
description = "Sources for null-ls to register";
|
||||
};
|
||||
|
||||
on_attach = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = mkLuaInline "on_attach";
|
||||
description = ''
|
||||
Defines an on_attach callback to run whenever null-ls attaches to a buffer.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
19
modules/plugins/mini/cursorword/config.nix
Normal file
19
modules/plugins/mini/cursorword/config.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.mini.cursorword;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["mini-cursorword"];
|
||||
|
||||
pluginRC.mini-ai = entryAnywhere ''
|
||||
require("mini.cursorword").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
9
modules/plugins/mini/cursorword/cursorword.nix
Normal file
9
modules/plugins/mini/cursorword/cursorword.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.mini.cursorword = {
|
||||
enable = mkEnableOption "mini.cursorword";
|
||||
setupOpts = mkPluginSetupOption "mini.cursorword" {};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/mini/cursorword/default.nix
Normal file
6
modules/plugins/mini/cursorword/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./cursorword.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
./colors
|
||||
./comment
|
||||
./completion
|
||||
./cursorword
|
||||
./diff
|
||||
./doc
|
||||
./extra
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
|
@ -10,6 +11,21 @@
|
|||
cfg = config.vim.mini.indentscope;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
autocmds = [
|
||||
{
|
||||
callback = mkLuaInline ''
|
||||
function()
|
||||
local ignore_filetypes = ${toLuaObject cfg.setupOpts.ignore_filetypes}
|
||||
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
|
||||
vim.b.miniindentscope_disable = true
|
||||
end
|
||||
end
|
||||
'';
|
||||
desc = "Disable indentscope for certain filetypes";
|
||||
event = ["FileType"];
|
||||
}
|
||||
];
|
||||
|
||||
startPlugins = ["mini-indentscope"];
|
||||
|
||||
pluginRC.mini-indentscope = entryAnywhere ''
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.types) str listOf;
|
||||
in {
|
||||
options.vim.mini.indentscope = {
|
||||
enable = mkEnableOption "mini.indentscope";
|
||||
setupOpts = mkPluginSetupOption "mini.indentscope" {};
|
||||
setupOpts = mkPluginSetupOption "mini.indentscope" {
|
||||
ignore_filetypes = mkOption {
|
||||
type = listOf str;
|
||||
default = ["help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
|
||||
description = "File types to ignore for illuminate";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
cfg = config.vim.minimap.minimap-vim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
pkgs.code-minimap
|
||||
"minimap-vim"
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["minimap-vim"];
|
||||
extraPackages = [pkgs.code-minimap];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>m" = "+Minimap";
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>m" = "+Minimap";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,28 @@
|
|||
bCfg = config.vim.ui.breadcrumbs;
|
||||
in {
|
||||
config = mkMerge [
|
||||
# TODO: move into nvim-tree file
|
||||
(mkIf config.vim.filetree.nvimTree.enable {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
extensions = ["nvim-tree"];
|
||||
};
|
||||
})
|
||||
{
|
||||
vim.statusline.lualine.setupOpts.extensions =
|
||||
(lib.optionals config.vim.filetree.nvimTree.enable ["nvim-tree"])
|
||||
++ (lib.optionals config.vim.filetree.neo-tree.enable ["neo-tree"])
|
||||
++ (lib.optionals config.vim.utility.snacks-nvim.enable [
|
||||
{
|
||||
# same extensions as nerdtree / neo-tree
|
||||
# https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/extensions/nerdtree.lua
|
||||
# https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/extensions/neo-tree.lua
|
||||
sections = {
|
||||
lualine_a = mkLuaInline ''
|
||||
{
|
||||
function()
|
||||
return vim.fn.fnamemodify(vim.fn.getcwd(), ":~")
|
||||
end,
|
||||
}
|
||||
'';
|
||||
};
|
||||
filetypes = ["snacks_picker_list" "snacks_picker_input"];
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
|
|
|
|||
|
|
@ -124,8 +124,6 @@ in {
|
|||
mkOption {
|
||||
type = enum themesConcatted;
|
||||
default = "auto";
|
||||
# TODO: xml generation error if the closing '' is on a new line.
|
||||
# issue: https://gitlab.com/rycee/nmd/-/issues/10
|
||||
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
||||
description = "Theme for lualine";
|
||||
};
|
||||
|
|
@ -241,35 +239,26 @@ in {
|
|||
{
|
||||
-- Lsp server name
|
||||
function()
|
||||
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
|
||||
local buf_ft = vim.bo.filetype
|
||||
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
|
||||
|
||||
-- List of buffer types to exclude
|
||||
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
|
||||
|
||||
-- Check if the current buffer type is in the excluded list
|
||||
for _, excluded_type in ipairs(excluded_buf_ft) do
|
||||
if buf_ft == excluded_type then
|
||||
return ""
|
||||
if excluded_buf_ft[buf_ft] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
|
||||
if vim.tbl_isempty(clients) then
|
||||
return "No Active LSP"
|
||||
end
|
||||
|
||||
-- Get the name of the LSP server active in the current buffer
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
local msg = 'No Active Lsp'
|
||||
|
||||
-- if no lsp client is attached then return the msg
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
|
||||
local active_clients = {}
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
table.insert(active_clients, client.name)
|
||||
end
|
||||
|
||||
return msg
|
||||
return table.concat(active_clients, ", ")
|
||||
end,
|
||||
icon = ' ',
|
||||
separator = {left = ''},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.tabline.nvimBufferline;
|
||||
self = import ./nvim-bufferline.nix {inherit lib;};
|
||||
self = import ./nvim-bufferline.nix {inherit config lib;};
|
||||
inherit (self.options.vim.tabline.nvimBufferline) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
{lib, ...}: let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
|
@ -23,7 +27,14 @@ in {
|
|||
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
||||
highlights = mkOption {
|
||||
type = either attrs luaInline;
|
||||
default = {};
|
||||
default =
|
||||
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
|
||||
then
|
||||
mkLuaInline
|
||||
''
|
||||
require("catppuccin.groups.integrations.bufferline").get()
|
||||
''
|
||||
else {};
|
||||
description = ''
|
||||
Overrides the highlight groups of bufferline.
|
||||
|
||||
|
|
@ -98,7 +109,7 @@ in {
|
|||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The indicatotor icon to use for the current buffer.
|
||||
The indicator icon to use for the current buffer.
|
||||
|
||||
::: {.warning}
|
||||
This **must** be omitted while style is not `icon`
|
||||
|
|
@ -261,14 +272,12 @@ in {
|
|||
|
||||
offsets = mkOption {
|
||||
type = listOf attrs;
|
||||
default = [
|
||||
{
|
||||
filetype = "NvimTree";
|
||||
text = "File Explorer";
|
||||
highlight = "Directory";
|
||||
separator = true;
|
||||
}
|
||||
];
|
||||
default = map (filetype: {
|
||||
inherit filetype;
|
||||
text = "File Explorer";
|
||||
highlight = "Directory";
|
||||
separator = true;
|
||||
}) ["NvimTree" "neo-tree" "snacks_layout_box"];
|
||||
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -66,21 +66,22 @@ in {
|
|||
transparent_background = ${boolToString transparent},
|
||||
term_colors = true,
|
||||
integrations = {
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
transparent_panel = ${boolToString transparent},
|
||||
show_root = true,
|
||||
},
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
transparent_panel = ${boolToString transparent},
|
||||
show_root = true,
|
||||
},
|
||||
|
||||
hop = true,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
ts_rainbow = true,
|
||||
ts_rainbow = true,
|
||||
fidget = true,
|
||||
alpha = true,
|
||||
leap = true,
|
||||
lsp_saga = true,
|
||||
markdown = true,
|
||||
noice = true,
|
||||
notify = true, -- nvim-notify
|
||||
|
|
@ -106,9 +107,9 @@ in {
|
|||
style' =
|
||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||
in ''
|
||||
require('oxocarbon')
|
||||
vim.opt.background = "${style'}"
|
||||
vim.cmd.colorscheme = "oxocarbon"
|
||||
require('oxocarbon')
|
||||
vim.opt.background = "${style'}"
|
||||
vim.cmd.colorscheme = "oxocarbon"
|
||||
${optionalString transparent ''
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
|
|
|
|||
|
|
@ -24,12 +24,19 @@ in {
|
|||
grammars = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
regex
|
||||
kdl
|
||||
];
|
||||
'';
|
||||
description = ''
|
||||
List of treesitter grammars to install.
|
||||
List of treesitter grammars to install. For grammars to be installed properly,
|
||||
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
|
||||
|
||||
For languages already supported by nvf, you may
|
||||
use the {option}`vim.language.<lang>.treesitter` options, which
|
||||
will automatically add the required grammars to this.
|
||||
For languages already supported by nvf, you may use
|
||||
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||
the required grammars to this.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr listOf enum bool str int either;
|
||||
inherit (lib.types) nullOr listOf enum bool str int;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||
mkSimpleIconOption = default:
|
||||
|
|
@ -74,7 +74,7 @@ in {
|
|||
::: {.note}
|
||||
This will pass `draw_empty` to the `nvim_navic` winbar
|
||||
component, which causes the component to be drawn even
|
||||
if it's empty
|
||||
if it's empty.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
|
@ -86,145 +86,163 @@ in {
|
|||
close = mkOption {
|
||||
type = str;
|
||||
default = "<esc>";
|
||||
description = "keybinding to close Navbuddy UI";
|
||||
description = "Close and return the cursor to its original location.";
|
||||
};
|
||||
|
||||
nextSibling = mkOption {
|
||||
type = str;
|
||||
default = "j";
|
||||
description = "keybinding to navigate to the next sibling node";
|
||||
description = "Navigate to the next sibling node.";
|
||||
};
|
||||
|
||||
previousSibling = mkOption {
|
||||
type = str;
|
||||
default = "k";
|
||||
description = "keybinding to navigate to the previous sibling node";
|
||||
description = "Navigate to the previous sibling node.";
|
||||
};
|
||||
|
||||
parent = mkOption {
|
||||
type = str;
|
||||
default = "h";
|
||||
description = "keybinding to navigate to the parent node";
|
||||
description = "Navigate to the parent node.";
|
||||
};
|
||||
|
||||
children = mkOption {
|
||||
type = str;
|
||||
default = "l";
|
||||
description = "keybinding to navigate to the child node";
|
||||
description = "Navigate to the child node.";
|
||||
};
|
||||
|
||||
root = mkOption {
|
||||
type = str;
|
||||
default = "0";
|
||||
description = "keybinding to navigate to the root node";
|
||||
description = "Navigate to the root node.";
|
||||
};
|
||||
|
||||
visualName = mkOption {
|
||||
type = str;
|
||||
default = "v";
|
||||
description = "visual selection of name";
|
||||
description = "Select the name visually.";
|
||||
};
|
||||
|
||||
visualScope = mkOption {
|
||||
type = str;
|
||||
default = "V";
|
||||
description = "visual selection of scope";
|
||||
description = "Select the scope visually.";
|
||||
};
|
||||
|
||||
yankName = mkOption {
|
||||
type = str;
|
||||
default = "y";
|
||||
description = "yank the name to system clipboard";
|
||||
description = "Yank the name to system clipboard.";
|
||||
};
|
||||
|
||||
yankScope = mkOption {
|
||||
type = str;
|
||||
default = "Y";
|
||||
description = "yank the scope to system clipboard";
|
||||
description = "Yank the scope to system clipboard.";
|
||||
};
|
||||
|
||||
insertName = mkOption {
|
||||
type = str;
|
||||
default = "i";
|
||||
description = "insert at start of name";
|
||||
description = "Insert at the start of name.";
|
||||
};
|
||||
|
||||
insertScope = mkOption {
|
||||
type = str;
|
||||
default = "I";
|
||||
description = "insert at start of scope";
|
||||
description = "Insert at the start of scope.";
|
||||
};
|
||||
|
||||
appendName = mkOption {
|
||||
type = str;
|
||||
default = "a";
|
||||
description = "insert at end of name";
|
||||
description = "Insert at the end of name.";
|
||||
};
|
||||
|
||||
appendScope = mkOption {
|
||||
type = str;
|
||||
default = "A";
|
||||
description = "insert at end of scope";
|
||||
description = "Insert at the end of scope.";
|
||||
};
|
||||
|
||||
rename = mkOption {
|
||||
type = str;
|
||||
default = "r";
|
||||
description = "rename the node";
|
||||
description = "Rename the node.";
|
||||
};
|
||||
|
||||
delete = mkOption {
|
||||
type = str;
|
||||
default = "d";
|
||||
description = "delete the node";
|
||||
description = "Delete the node.";
|
||||
};
|
||||
|
||||
foldCreate = mkOption {
|
||||
type = str;
|
||||
default = "f";
|
||||
description = "create a new fold";
|
||||
description = "Create a new fold of the node.";
|
||||
};
|
||||
|
||||
foldDelete = mkOption {
|
||||
type = str;
|
||||
default = "F";
|
||||
description = "delete the current fold";
|
||||
description = "Delete the current fold of the node.";
|
||||
};
|
||||
|
||||
comment = mkOption {
|
||||
type = str;
|
||||
default = "c";
|
||||
description = "comment the node";
|
||||
description = "Comment the node.";
|
||||
};
|
||||
|
||||
select = mkOption {
|
||||
type = str;
|
||||
default = "<enter>";
|
||||
description = "goto selected symbol";
|
||||
description = "Goto the node.";
|
||||
};
|
||||
|
||||
moveDown = mkOption {
|
||||
type = str;
|
||||
default = "J";
|
||||
description = "move focused node down";
|
||||
description = "Move the node down.";
|
||||
};
|
||||
|
||||
moveUp = mkOption {
|
||||
type = str;
|
||||
default = "K";
|
||||
description = "move focused node up";
|
||||
description = "Move the node up.";
|
||||
};
|
||||
|
||||
togglePreview = mkOption {
|
||||
type = str;
|
||||
default = "s";
|
||||
description = "Toggle the preview.";
|
||||
};
|
||||
|
||||
vsplit = mkOption {
|
||||
type = str;
|
||||
default = "<C-v>";
|
||||
description = "Open the node in a vertical split.";
|
||||
};
|
||||
|
||||
hsplit = mkOption {
|
||||
type = str;
|
||||
default = "<C-s>";
|
||||
description = "Open the node in a horizontal split.";
|
||||
};
|
||||
|
||||
telescope = mkOption {
|
||||
type = str;
|
||||
default = "t";
|
||||
description = "fuzzy finder at current level";
|
||||
description = "Start fuzzy finder at the current level.";
|
||||
};
|
||||
|
||||
help = mkOption {
|
||||
type = str;
|
||||
default = "g?";
|
||||
description = "open mapping help window";
|
||||
description = "Open the mappings help window.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -232,7 +250,7 @@ in {
|
|||
useDefaultMappings = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "use default Navbuddy keybindings (disables user-specified keybinds)";
|
||||
description = "Add the default Navbuddy keybindings in addition to the keybinding added by this module.";
|
||||
};
|
||||
|
||||
window = {
|
||||
|
|
@ -242,13 +260,13 @@ in {
|
|||
border = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use";
|
||||
description = "The border style to use.";
|
||||
};
|
||||
|
||||
scrolloff = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = "Scrolloff value within navbuddy window";
|
||||
description = "The scrolloff value within a navbuddy window.";
|
||||
};
|
||||
|
||||
sections = {
|
||||
|
|
@ -265,7 +283,7 @@ in {
|
|||
border = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the left section of Navbuddy UI";
|
||||
description = "The border style to use for the left section of the Navbuddy UI.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -282,7 +300,7 @@ in {
|
|||
border = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the middle section of Navbuddy UI";
|
||||
description = "The border style to use for the middle section of the Navbuddy UI.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -292,13 +310,13 @@ in {
|
|||
border = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the right section of Navbuddy UI";
|
||||
description = "The border style to use for the right section of the Navbuddy UI.";
|
||||
};
|
||||
|
||||
preview = mkOption {
|
||||
type = enum ["leaf" "always" "never"];
|
||||
default = "leaf";
|
||||
description = "display mode of the preview on the right section";
|
||||
description = "The display mode of the preview on the right section.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -317,13 +335,13 @@ in {
|
|||
auto_attach = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to attach to LSP server manually";
|
||||
description = "Whether to attach to LSP server manually.";
|
||||
};
|
||||
|
||||
preference = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = "list of lsp server names in order of preference";
|
||||
description = "The preference list ranking LSP servers.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -331,25 +349,25 @@ in {
|
|||
followNode = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "keep the current node in focus on the source buffer";
|
||||
description = "Whether to keep the current node in focus in the source buffer.";
|
||||
};
|
||||
|
||||
highlight = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "highlight the currently focused node";
|
||||
description = "Whether to highlight the currently focused node in the source buffer.";
|
||||
};
|
||||
|
||||
reorient = mkOption {
|
||||
type = enum ["smart" "top" "mid" "none"];
|
||||
default = "smart";
|
||||
description = "reorient buffer after changing nodes";
|
||||
description = "The mode for reorienting the source buffer after moving nodes.";
|
||||
};
|
||||
|
||||
scrolloff = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = "scrolloff value when navbuddy is open";
|
||||
description = "The scrolloff value in the source buffer when Navbuddy is open.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ in {
|
|||
${cfg.navbuddy.mappings.moveDown} = mkLuaInline "actions.move_down()";
|
||||
${cfg.navbuddy.mappings.moveUp} = mkLuaInline "actions.move_up()";
|
||||
|
||||
${cfg.navbuddy.mappings.togglePreview} = mkLuaInline "actions.toggle_preview()";
|
||||
|
||||
${cfg.navbuddy.mappings.vsplit} = mkLuaInline "actions.vsplit()";
|
||||
${cfg.navbuddy.mappings.hsplit} = mkLuaInline "actions.hsplit()";
|
||||
|
||||
${cfg.navbuddy.mappings.telescope} = mkLuaInline ''
|
||||
actions.telescope({
|
||||
layout_strategy = "horizontal",
|
||||
|
|
|
|||
|
|
@ -102,11 +102,7 @@ in {
|
|||
|
||||
setupOpts = mkPluginSetupOption "colorizer" {
|
||||
filetypes = mkOption {
|
||||
description = ''
|
||||
Filetypes to enable on and their option overrides.
|
||||
|
||||
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
|
||||
'';
|
||||
type = attrsOf settingSubmodule;
|
||||
default = {};
|
||||
example = {
|
||||
"*" = {};
|
||||
|
|
@ -115,13 +111,21 @@ in {
|
|||
AARRGGBB = false;
|
||||
};
|
||||
};
|
||||
type = attrsOf settingSubmodule;
|
||||
description = ''
|
||||
Filetypes to enable on and their option overrides.
|
||||
|
||||
`"*"` means enable on all filetypes. Filetypes prefixed with `"!"` are disabled.
|
||||
'';
|
||||
};
|
||||
|
||||
user_default_options = mkOption {
|
||||
description = "Default options";
|
||||
default = {};
|
||||
type = settingSubmodule;
|
||||
default = {};
|
||||
description = ''
|
||||
`user_default_options` is the second parameter to nvim-colorizer's setup function.
|
||||
|
||||
Anything set here is the inverse of the previous setup configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ in {
|
|||
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||
filetypes_denylist = mkOption {
|
||||
type = listOf str;
|
||||
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
|
||||
default = ["dirvish" "fugitive" "help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
|
||||
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hardtime.nix
|
||||
./config.nix
|
||||
./lsplines.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" {};
|
||||
};
|
||||
}
|
||||
|
|
@ -15,8 +15,11 @@
|
|||
./multicursors
|
||||
./new-file-template
|
||||
./nix-develop
|
||||
./oil-nvim
|
||||
./outline
|
||||
./preview
|
||||
./sleuth
|
||||
./snacks-nvim
|
||||
./surround
|
||||
./telescope
|
||||
./wakatime
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.types) nullOr enum;
|
||||
inherit (lib.types) enum str;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||
in {
|
||||
options.vim.fzf-lua = {
|
||||
enable = mkEnableOption "fzf-lua";
|
||||
setupOpts = mkPluginSetupOption "fzf-lua" {
|
||||
fzf_bin = mkOption {
|
||||
type = str;
|
||||
default = "${lib.getExe pkgs.fzf}";
|
||||
description = "Path to fzf executable";
|
||||
};
|
||||
winopts.border = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./flash
|
||||
./hop
|
||||
./leap
|
||||
./precognition
|
||||
|
|
|
|||
34
modules/plugins/utility/motion/flash/config.nix
Normal file
34
modules/plugins/utility/motion/flash/config.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.motion.flash-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
lazy.plugins = {
|
||||
"flash-nvim" = {
|
||||
package = "flash-nvim";
|
||||
setupModule = "flash";
|
||||
setupOpts = cfg.setupOpts;
|
||||
|
||||
lazy = true;
|
||||
|
||||
keys = [
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.jump "<cmd>lua require(\"flash\").jump()<cr>" {desc = "Flash";})
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.treesitter "<cmd>lua require(\"flash\").treesitter()<cr>" {desc = "Flash Treesitter";})
|
||||
(mkKeymap "o" cfg.mappings.remote "<cmd>lua require(\"flash\").remote()<cr>" {desc = "Remote Flash";})
|
||||
(mkKeymap ["o" "x"] cfg.mappings.treesitter_search "<cmd>lua require(\"flash\").treesitter_search()<cr>" {desc = "Treesitter Search";})
|
||||
(mkKeymap "c" cfg.mappings.toggle "<cmd>lua require(\"flash\").toggle()<cr>" {desc = "Toggle Flash Search";})
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/motion/flash/default.nix
Normal file
6
modules/plugins/utility/motion/flash/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./flash.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
38
modules/plugins/utility/motion/flash/flash.nix
Normal file
38
modules/plugins/utility/motion/flash/flash.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) nullOr str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.motion.flash-nvim = {
|
||||
enable = mkEnableOption "enhanced code navigation with flash.nvim";
|
||||
setupOpts = mkPluginSetupOption "flash-nvim" {};
|
||||
|
||||
mappings = {
|
||||
jump = mkOption {
|
||||
type = nullOr str;
|
||||
default = "s";
|
||||
description = "Jump";
|
||||
};
|
||||
treesitter = mkOption {
|
||||
type = nullOr str;
|
||||
default = "S";
|
||||
description = "Treesitter";
|
||||
};
|
||||
remote = mkOption {
|
||||
type = nullOr str;
|
||||
default = "r";
|
||||
description = "Remote Flash";
|
||||
};
|
||||
treesitter_search = mkOption {
|
||||
type = nullOr str;
|
||||
default = "R";
|
||||
description = "Treesitter Search";
|
||||
};
|
||||
toggle = mkOption {
|
||||
type = nullOr str;
|
||||
default = "<c-s>";
|
||||
description = "Toggle Flash Search";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
20
modules/plugins/utility/oil-nvim/config.nix
Normal file
20
modules/plugins/utility/oil-nvim/config.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.oil-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["oil-nvim"];
|
||||
pluginRC.oil-nvim = entryAnywhere ''
|
||||
require("oil").setup(${toLuaObject cfg.setupOpts});
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/oil-nvim/default.nix
Normal file
6
modules/plugins/utility/oil-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./oil-nvim.nix
|
||||
];
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue