mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-25 17:06:11 +00:00
Merge branch 'main' into colorful-menu
This commit is contained in:
commit
b4dac8d635
264 changed files with 5007 additions and 1795 deletions
341
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
341
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.types) int str enum nullOr attrs bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.assistant = {
|
||||
avante-nvim = {
|
||||
enable = mkEnableOption "complementary Neovim plugin for avante.nvim";
|
||||
setupOpts = mkPluginSetupOption "avante-nvim" {
|
||||
provider = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "The provider used in Aider mode or in the planning phase of Cursor Planning Mode.";
|
||||
};
|
||||
|
||||
providers = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define settings for builtin and custom providers.";
|
||||
example = literalMD ''
|
||||
```nix
|
||||
openai = {
|
||||
endpoint = "https://api.openai.com/v1";
|
||||
model = "gpt-4o"; # your desired model (or use gpt-4o, etc.)
|
||||
timeout = 30000; # Timeout in milliseconds, increase this for reasoning models
|
||||
extra_request_body = {
|
||||
temperature = 0;
|
||||
max_completion_tokens = 8192; # Increase this to include reasoning tokens (for reasoning models)
|
||||
reasoning_effort = "medium"; # low|medium|high, only used for reasoning models
|
||||
};
|
||||
};
|
||||
ollama = {
|
||||
endpoint = "http://127.0.0.1:11434";
|
||||
timeout = 30000; # Timeout in milliseconds
|
||||
extra_request_body = {
|
||||
options = {
|
||||
temperature = 0.75;
|
||||
num_ctx = 20480;
|
||||
keep_alive = "5m";
|
||||
};
|
||||
};
|
||||
};
|
||||
groq = {
|
||||
__inherited_from = "openai";
|
||||
api_key_name = "GROQ_API_KEY";
|
||||
endpoint = "https://api.groq.com/openai/v1/";
|
||||
model = "llama-3.3-70b-versatile";
|
||||
disable_tools = true;
|
||||
extra_request_body = {
|
||||
temperature = 1;
|
||||
max_tokens = 32768; # remember to increase this value, otherwise it will stop generating halfway
|
||||
};
|
||||
};
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
auto_suggestions_provider = mkOption {
|
||||
type = str;
|
||||
default = "claude";
|
||||
description = ''
|
||||
Since auto-suggestions are a high-frequency operation and therefore expensive,
|
||||
currently designating it as `copilot` provider is dangerous because:
|
||||
https://github.com/yetone/avante.nvim/issues/1048
|
||||
Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
|
||||
'';
|
||||
};
|
||||
|
||||
cursor_applying_provider = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The provider used in the applying phase of Cursor Planning Mode, defaults to `nil`,
|
||||
Config.provider will be used as the provider for the applying phase when `nil`.
|
||||
'';
|
||||
};
|
||||
|
||||
dual_boost = {
|
||||
enabled = mkEnableOption "dual_boost mode.";
|
||||
|
||||
first_provider = mkOption {
|
||||
type = str;
|
||||
default = "openai";
|
||||
description = "The first provider to generate response.";
|
||||
};
|
||||
|
||||
second_provider = mkOption {
|
||||
type = str;
|
||||
default = "claude";
|
||||
description = "The second provider to generate response.";
|
||||
};
|
||||
|
||||
prompt = mkOption {
|
||||
type = str;
|
||||
default = ''
|
||||
Based on the two reference outputs below, generate a response that incorporates
|
||||
elements from both but reflects your own judgment and unique perspective.
|
||||
Do not provide any explanation, just give the response directly. Reference Output 1:
|
||||
[{{provider1_output}}], Reference Output 2: [{{provider2_output}}'';
|
||||
description = "The prompt to generate response based on the two reference outputs.";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = int;
|
||||
default = 60000;
|
||||
description = "Timeout in milliseconds.";
|
||||
};
|
||||
};
|
||||
|
||||
behaviour = {
|
||||
auto_suggestions =
|
||||
mkEnableOption "auto suggestions.";
|
||||
|
||||
auto_set_highlight_group =
|
||||
mkEnableOption "automatically set the highlight group for the current line."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
auto_set_keymaps =
|
||||
mkEnableOption "automatically set the keymap for the current line."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
auto_apply_diff_after_generation =
|
||||
mkEnableOption "automatically apply diff after LLM response.";
|
||||
|
||||
support_paste_from_clipboard = mkEnableOption ''
|
||||
pasting image from clipboard.
|
||||
This will be determined automatically based whether img-clip is available or not.
|
||||
'';
|
||||
|
||||
minimize_diff =
|
||||
mkEnableOption "remove unchanged lines when applying a code block."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enable_token_counting =
|
||||
mkEnableOption "token counting."
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enable_cursor_planning_mode =
|
||||
mkEnableOption "Cursor Planning Mode.";
|
||||
|
||||
enable_claude_text_editor_tool_mode =
|
||||
mkEnableOption "Claude Text Editor Tool Mode.";
|
||||
};
|
||||
|
||||
mappings = {
|
||||
diff = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for diff.";
|
||||
};
|
||||
|
||||
suggestion = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for suggestion actions.";
|
||||
};
|
||||
|
||||
jump = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for jump actions.";
|
||||
};
|
||||
|
||||
submit = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for submit actions.";
|
||||
};
|
||||
|
||||
cancel = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for cancel actions.";
|
||||
};
|
||||
|
||||
sidebar = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define or override the default keymaps for sidebar actions.";
|
||||
};
|
||||
};
|
||||
|
||||
hints.enabled =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable hints.
|
||||
'';
|
||||
};
|
||||
|
||||
windows = {
|
||||
position = mkOption {
|
||||
type = enum ["right" "left" "top" "bottom"];
|
||||
default = "right";
|
||||
description = "The position of the sidebar.";
|
||||
};
|
||||
|
||||
wrap =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
similar to vim.o.wrap.
|
||||
'';
|
||||
};
|
||||
|
||||
width = mkOption {
|
||||
type = int;
|
||||
default = 30;
|
||||
description = "Default % based on available width.";
|
||||
};
|
||||
|
||||
sidebar_header = {
|
||||
enabled = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "enable/disable the header.";
|
||||
};
|
||||
|
||||
align = mkOption {
|
||||
type = enum ["right" "center" "left"];
|
||||
default = "center";
|
||||
description = "Position of the title.";
|
||||
};
|
||||
|
||||
rounded = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable rounded sidebar header";
|
||||
};
|
||||
};
|
||||
|
||||
input = {
|
||||
prefix = mkOption {
|
||||
type = str;
|
||||
default = "> ";
|
||||
description = "The prefix used on the user input.";
|
||||
};
|
||||
|
||||
height = mkOption {
|
||||
type = int;
|
||||
default = 8;
|
||||
description = ''
|
||||
Height of the input window in vertical layout.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
edit = {
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = "rounded";
|
||||
description = "The border type on the edit window.";
|
||||
};
|
||||
|
||||
start_insert = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Start insert mode when opening the edit window.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
ask = {
|
||||
floating = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open the 'AvanteAsk' prompt in a floating window.
|
||||
'';
|
||||
};
|
||||
|
||||
start_insert = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Start insert mode when opening the ask window.
|
||||
'';
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = "rounded";
|
||||
description = "The border type on the ask window.";
|
||||
};
|
||||
|
||||
focus_on_apply = mkOption {
|
||||
type = enum ["ours" "theirs"];
|
||||
default = "ours";
|
||||
description = "Which diff to focus after applying.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
diff = {
|
||||
autojump =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Automatically jumps to the next change.";
|
||||
};
|
||||
|
||||
override_timeoutlen = mkOption {
|
||||
type = int;
|
||||
default = 500;
|
||||
example = -1;
|
||||
description = ''
|
||||
Override the 'timeoutlen' setting while hovering over a diff (see {command}`:help timeoutlen`).
|
||||
Helps to avoid entering operator-pending mode with diff mappings starting with `c`.
|
||||
Disable by setting to -1.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
suggestion = {
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
default = 600;
|
||||
description = "Suggestion debounce in milliseconds.";
|
||||
};
|
||||
|
||||
throttle = mkOption {
|
||||
type = int;
|
||||
default = 600;
|
||||
description = "Suggestion throttle in milliseconds.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
41
modules/plugins/assistant/avante/config.nix
Normal file
41
modules/plugins/assistant/avante/config.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optionals;
|
||||
|
||||
cfg = config.vim.assistant.avante-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins =
|
||||
[
|
||||
"nvim-treesitter"
|
||||
"plenary-nvim"
|
||||
"dressing-nvim"
|
||||
"nui-nvim"
|
||||
]
|
||||
++ (optionals config.vim.mini.pick.enable ["mini-pick"])
|
||||
++ (optionals config.vim.telescope.enable ["telescope"])
|
||||
++ (optionals config.vim.autocomplete.nvim-cmp.enable ["nvim-cmp"])
|
||||
++ (optionals config.vim.fzf-lua.enable ["fzf-lua"])
|
||||
++ (optionals config.vim.visuals.nvim-web-devicons.enable ["nvim-web-devicons"])
|
||||
++ (optionals config.vim.utility.images.img-clip.enable ["img-clip"]);
|
||||
|
||||
lazy.plugins = {
|
||||
avante-nvim = {
|
||||
package = "avante-nvim";
|
||||
setupModule = "avante";
|
||||
inherit (cfg) setupOpts;
|
||||
event = ["DeferredUIEnter"];
|
||||
};
|
||||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
|
||||
languages.markdown.extensions.render-markdown-nvim.setupOpts.file_types = lib.mkAfter ["Avante"];
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/assistant/avante/default.nix
Normal file
6
modules/plugins/assistant/avante/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./avante-nvim.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -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})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@ in {
|
|||
|
||||
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||
opts = {
|
||||
send_code = mkEnableOption "code from being sent to the LLM.";
|
||||
send_code =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable code being sent to the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||
|
|
@ -30,7 +37,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "a diff view to see the changes made by the LLM.";
|
||||
description = ''
|
||||
Whether to enable a diff view
|
||||
to see the changes made by the LLM.
|
||||
'';
|
||||
};
|
||||
|
||||
close_chat_at = mkOption {
|
||||
|
|
@ -64,7 +74,12 @@ in {
|
|||
};
|
||||
|
||||
chat = {
|
||||
auto_scroll = mkEnableOption "automatic page scrolling.";
|
||||
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.
|
||||
|
|
@ -85,14 +100,18 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "references in the chat buffer.";
|
||||
description = ''
|
||||
Whether to enable references in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
show_token_count =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "the token count for each response.";
|
||||
description = ''
|
||||
Whether to enable the token count for each response.
|
||||
'';
|
||||
};
|
||||
|
||||
intro_message = mkOption {
|
||||
|
|
@ -155,7 +174,10 @@ in {
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "showing default actions in the action palette.";
|
||||
description = ''
|
||||
Whether to enable showing default
|
||||
actions in the action palette.
|
||||
'';
|
||||
};
|
||||
|
||||
show_default_prompt_library =
|
||||
|
|
@ -163,7 +185,8 @@ in {
|
|||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
showing default prompt library in the action palette.
|
||||
Whether to enable showing default
|
||||
prompt library in the action palette.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,22 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
treesitter.enable = true;
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
# Codecompanion depends on the YAML grammar being added. Below is
|
||||
# an easy way of adding an user-configurable grammar package exposed
|
||||
# by the YAML language module *without* enabling the whole YAML language
|
||||
# module. The package is defined even when the module is disabled.
|
||||
grammars = [
|
||||
config.vim.languages.yaml.treesitter.package
|
||||
];
|
||||
};
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
sourcePlugins = ["codecompanion-nvim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
|
||||
cfg = config.vim.assistant.copilot;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@
|
|||
./chatgpt
|
||||
./copilot
|
||||
./codecompanion
|
||||
./supermaven-nvim
|
||||
./avante
|
||||
];
|
||||
}
|
||||
|
|
|
|||
17
modules/plugins/assistant/supermaven-nvim/config.nix
Normal file
17
modules/plugins/assistant/supermaven-nvim/config.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.vim.assistant.supermaven-nvim;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
vim.lazy.plugins = {
|
||||
supermaven-nvim = {
|
||||
package = "supermaven-nvim";
|
||||
setupModule = "supermaven-nvim";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/assistant/supermaven-nvim/default.nix
Normal file
6
modules/plugins/assistant/supermaven-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./supermaven-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
{lib, ...}: let
|
||||
inherit
|
||||
(lib.types)
|
||||
nullOr
|
||||
str
|
||||
bool
|
||||
attrsOf
|
||||
ints
|
||||
enum
|
||||
;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
in {
|
||||
options.vim.assistant.supermaven-nvim = {
|
||||
enable = mkEnableOption "Supermaven AI assistant";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Supermaven" {
|
||||
keymaps = {
|
||||
accept_suggestion = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "<Tab>";
|
||||
description = "The key to accept a suggestion";
|
||||
};
|
||||
clear_suggestion = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "<C-]>";
|
||||
description = "The key to clear a suggestion";
|
||||
};
|
||||
accept_word = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "<C-j>";
|
||||
description = "The key to accept a word";
|
||||
};
|
||||
};
|
||||
ignore_file = mkOption {
|
||||
type = nullOr (attrsOf bool);
|
||||
default = null;
|
||||
example = {
|
||||
markdown = true;
|
||||
};
|
||||
description = "List of fileto ignore";
|
||||
};
|
||||
color = {
|
||||
suggestion_color = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "#ffffff";
|
||||
description = "The hex color of the suggestion";
|
||||
};
|
||||
cterm = mkOption {
|
||||
type = nullOr ints.u8;
|
||||
default = null;
|
||||
example = 244;
|
||||
description = "The cterm color of the suggestion";
|
||||
};
|
||||
};
|
||||
log_level = mkOption {
|
||||
type = nullOr (enum [
|
||||
"off"
|
||||
"trace"
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
]);
|
||||
default = null;
|
||||
example = "info";
|
||||
description = "The log level. Set to `\"off\"` to disable completely";
|
||||
};
|
||||
disable_inline_completion = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Disable inline completion for use with cmp";
|
||||
};
|
||||
disable_keymaps = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Disable built-in keymaps for more manual control";
|
||||
};
|
||||
condition = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Condition function to check for stopping supermaven.
|
||||
|
||||
A returned `true` means to stop supermaven
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
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;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
|
@ -10,7 +9,7 @@
|
|||
freeformType = attrsOf (listOf (either str luaInline));
|
||||
options = {
|
||||
preset = mkOption {
|
||||
type = enum ["default" "none" "super-tab" "enter"];
|
||||
type = enum ["default" "none" "super-tab" "enter" "cmdline"];
|
||||
default = "none";
|
||||
description = "keymap presets";
|
||||
};
|
||||
|
|
@ -48,7 +47,7 @@ in {
|
|||
cmdline = {
|
||||
sources = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = [];
|
||||
default = null;
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -122,6 +122,21 @@ in {
|
|||
"fallback"
|
||||
];
|
||||
};
|
||||
|
||||
# cmdline is not enabled by default, we're just providing keymaps in
|
||||
# case the user enables them
|
||||
cmdline.keymap = {
|
||||
${mappings.complete} = ["show" "fallback"];
|
||||
${mappings.close} = ["hide" "fallback"];
|
||||
${mappings.scrollDocsUp} = ["scroll_documentation_up" "fallback"];
|
||||
${mappings.scrollDocsDown} = ["scroll_documentation_down" "fallback"];
|
||||
# NOTE: mappings.confirm is skipped because our default, <CR> would
|
||||
# lead to accidental triggers of blink.accept instead of executing
|
||||
# the cmd
|
||||
|
||||
${mappings.next} = ["select_next" "show" "fallback"];
|
||||
${mappings.previous} = ["select_prev" "fallback"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
|
||||
|
||||
borders = config.vim.ui.borders.plugins.nvim-cmp;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.types) str attrsOf nullOr either listOf;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.dashboard.alpha;
|
||||
|
|
|
|||
|
|
@ -3,46 +3,47 @@
|
|||
inherit (lib.types) listOf attrs bool enum str oneOf int;
|
||||
in {
|
||||
options.vim.dashboard.startify = {
|
||||
enable = mkEnableOption "dashboard via vim-startify";
|
||||
enable = mkEnableOption "fancy start screen for Vim [vim-startify]";
|
||||
|
||||
bookmarks = mkOption {
|
||||
default = [];
|
||||
description = ''List of book marks to disaply on start page'';
|
||||
type = listOf attrs;
|
||||
default = [];
|
||||
example = {"c" = "~/.vimrc";};
|
||||
description = "List of book marks to display on start page";
|
||||
};
|
||||
|
||||
changeToDir = mkOption {
|
||||
default = true;
|
||||
description = "Should vim change to the directory of the file you open";
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether Vim should change to the directory of the file you open";
|
||||
};
|
||||
|
||||
changeToVCRoot = mkOption {
|
||||
default = false;
|
||||
description = "Should vim change to the version control root when opening a file";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether Vim should change to the version control root when opening a file";
|
||||
};
|
||||
|
||||
changeDirCmd = mkOption {
|
||||
default = "lcd";
|
||||
description = "Command to change the current window with. Can be cd, lcd or tcd";
|
||||
type = enum ["cd" "lcd" "tcd"];
|
||||
default = "lcd";
|
||||
description = "Command to change the current window with.";
|
||||
};
|
||||
|
||||
customHeader = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Text to place in the header";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
customFooter = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Text to place in the footer";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
lists = mkOption {
|
||||
type = listOf attrs;
|
||||
default = [
|
||||
{
|
||||
type = "files";
|
||||
|
|
@ -66,121 +67,136 @@ in {
|
|||
}
|
||||
];
|
||||
description = "Specify the lists and in what order they are displayed on startify.";
|
||||
type = listOf attrs;
|
||||
};
|
||||
|
||||
skipList = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of regex patterns to exclude from MRU lists";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
updateOldFiles = mkOption {
|
||||
type = bool;
|
||||
|
||||
default = false;
|
||||
description = "Set if you want startify to always update and not just when neovim closes";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionAutoload = mkOption {
|
||||
default = false;
|
||||
description = "Make startify auto load Session.vim files from the current directory";
|
||||
type = bool;
|
||||
|
||||
default = false;
|
||||
description = "Make vim-startify auto load Session.vim files from the current directory";
|
||||
};
|
||||
|
||||
commands = mkOption {
|
||||
type = listOf (oneOf [str attrs (listOf str)]);
|
||||
default = [];
|
||||
description = "Commands that are presented to the user on startify page";
|
||||
type = listOf (oneOf [str attrs (listOf str)]);
|
||||
};
|
||||
|
||||
filesNumber = mkOption {
|
||||
type = int;
|
||||
default = 10;
|
||||
description = "How many files to list";
|
||||
type = int;
|
||||
};
|
||||
|
||||
customIndices = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Specify a list of default characters to use instead of numbers";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
disableOnStartup = mkOption {
|
||||
default = false;
|
||||
description = "Prevent startify from opening on startup but can be called with :Startify";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether vim-startify should be disabled on startup.
|
||||
|
||||
This will prevent startify from opening on startup, but it can still
|
||||
be called with `:Startify`
|
||||
'';
|
||||
};
|
||||
|
||||
unsafe = mkOption {
|
||||
default = false;
|
||||
description = "Turns on unsafe mode for Startify. Stops resolving links, checking files are readable and filtering bookmark list";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to turn on unsafe mode for Startify.
|
||||
|
||||
While enabld, vim-startify will stops resolving links, checking files
|
||||
are readable and filtering bookmark list
|
||||
'';
|
||||
};
|
||||
|
||||
paddingLeft = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
description = "Number of spaces used for left padding.";
|
||||
type = int;
|
||||
};
|
||||
|
||||
useEnv = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Show environment variables in path if name is shorter than value";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionBeforeSave = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Commands to run before saving a session";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionPersistence = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Persist session before leaving vim or switching session";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionDeleteBuffers = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Delete all buffers when loading or closing a session";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionDir = mkOption {
|
||||
type = str;
|
||||
default = "~/.vim/session";
|
||||
description = "Directory to save and load sessions from";
|
||||
type = str;
|
||||
};
|
||||
|
||||
skipListServer = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of vim servers to not load startify for";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionRemoveLines = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Patterns to remove from session files";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSavevars = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of variables to save into a session file.";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSavecmds = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of commands to run when loading a session.";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSort = mkOption {
|
||||
default = false;
|
||||
description = "Set if you want items sorted by date rather than alphabetically";
|
||||
type = bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
While true, sessions will be sorted by date rather than alphabetically.
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ in {
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
nvf_lint = ${toLuaObject cfg.lint_function}
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
|
@ -38,8 +40,8 @@ in {
|
|||
{
|
||||
event = ["BufWritePost"];
|
||||
callback = mkLuaInline ''
|
||||
function()
|
||||
require("lint").try_lint()
|
||||
function(args)
|
||||
nvf_lint(args.buf)
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
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 = {
|
||||
|
|
@ -69,6 +70,23 @@
|
|||
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 {
|
||||
|
|
@ -117,5 +135,53 @@ in {
|
|||
};
|
||||
|
||||
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 nullOr;
|
||||
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 = nullOr 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 = nullOr 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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@
|
|||
in {
|
||||
imports = [
|
||||
./gitsigns
|
||||
./hunk-nvim
|
||||
./vim-fugitive
|
||||
./git-conflict
|
||||
./gitlinker-nvim
|
||||
./neogit
|
||||
];
|
||||
|
||||
options.vim.git = {
|
||||
|
|
@ -12,9 +15,12 @@ in {
|
|||
git integration suite.
|
||||
|
||||
Enabling this option will enable the following plugins:
|
||||
|
||||
* gitsigns
|
||||
* hunk-nvim
|
||||
* 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" {};
|
||||
};
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ in {
|
|||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>g" = "+Gitsigns";
|
||||
"<leader>h" = "+Gitsigns";
|
||||
};
|
||||
|
||||
pluginRC.gitsigns = entryAnywhere ''
|
||||
|
|
@ -81,9 +81,11 @@ in {
|
|||
(mkIf cfg.codeActions.enable {
|
||||
vim.lsp.null-ls = {
|
||||
enable = true;
|
||||
setupOpts.sources.gitsigns-ca = mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'';
|
||||
setupOpts.sources = [
|
||||
(mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'')
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
27
modules/plugins/git/hunk-nvim/config.nix
Normal file
27
modules/plugins/git/hunk-nvim/config.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.git.hunk-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
# dependencies
|
||||
"nui-nvim" # ui library
|
||||
"nvim-web-devicons" # glyphs
|
||||
];
|
||||
|
||||
lazy.plugins = {
|
||||
"hunk-nvim" = {
|
||||
package = "hunk-nvim";
|
||||
setupModule = "hunk";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/git/hunk-nvim/default.nix
Normal file
6
modules/plugins/git/hunk-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hunk-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
13
modules/plugins/git/hunk-nvim/hunk-nvim.nix
Normal file
13
modules/plugins/git/hunk-nvim/hunk-nvim.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.git.hunk-nvim = {
|
||||
enable = mkEnableOption "tool for splitting diffs in Neovim [hunk-nvim]" // {default = config.vim.git.enable;};
|
||||
setupOpts = mkPluginSetupOption "hunk-nvim" {};
|
||||
};
|
||||
}
|
||||
39
modules/plugins/git/neogit/config.nix
Normal file
39
modules/plugins/git/neogit/config.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||
|
||||
cfg = config.vim.git.neogit;
|
||||
|
||||
keys = cfg.mappings;
|
||||
inherit (options.vim.git.neogit) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["plenary-nvim"];
|
||||
|
||||
lazy.plugins.neogit = {
|
||||
package = "neogit";
|
||||
setupModule = "neogit";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = ["Neogit"];
|
||||
|
||||
keys = [
|
||||
(mkKeymap "n" keys.open "<Cmd>Neogit<CR>" {desc = mappings.open.description;})
|
||||
(mkKeymap "n" keys.commit "<Cmd>Neogit commit<CR>" {desc = mappings.commit.description;})
|
||||
(mkKeymap "n" keys.pull "<Cmd>Neogit pull<CR>" {desc = mappings.pull.description;})
|
||||
(mkKeymap "n" keys.push "<Cmd>Neogit push<CR>" {desc = mappings.push.description;})
|
||||
];
|
||||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>g" = "+Git";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./lsplines.nix
|
||||
./neogit.nix
|
||||
];
|
||||
}
|
||||
17
modules/plugins/git/neogit/neogit.nix
Normal file
17
modules/plugins/git/neogit/neogit.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.git.neogit = {
|
||||
enable = mkEnableOption "An Interactive and powerful Git interface [Neogit]";
|
||||
setupOpts = mkPluginSetupOption "neogit" {};
|
||||
|
||||
mappings = {
|
||||
open = mkMappingOption "Git Status [Neogit]" "<leader>gs";
|
||||
commit = mkMappingOption "Git Commit [Neogit]" "<leader>gc";
|
||||
pull = mkMappingOption "Git pull [Neogit]" "<leader>gp";
|
||||
push = mkMappingOption "Git push [Neogit]" "<leader>gP";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -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,7 +10,6 @@
|
|||
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.types) mkGrammarOption diagnostics;
|
||||
|
||||
|
|
@ -22,7 +21,7 @@
|
|||
package = pkgs.astro-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.astro.setup {
|
||||
capabilities = capabilities;
|
||||
capabilities = capabilities,
|
||||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
|
|
@ -38,7 +37,11 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
};
|
||||
|
||||
biome = {
|
||||
|
|
@ -49,24 +52,20 @@
|
|||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -81,19 +80,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";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -149,16 +148,9 @@ in {
|
|||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (
|
||||
name: {
|
||||
${name} =
|
||||
diagnosticsProviders.${name}.config
|
||||
// {
|
||||
cmd = getExe diagnosticsProviders.${name}.package;
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.extraDiagnostics.types);
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -56,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";
|
||||
|
|
@ -66,7 +66,7 @@ in {
|
|||
|
||||
package = mkOption {
|
||||
description = "bash-language-server package, or the command to run as a list of strings";
|
||||
example = literalExpression ''[lib.getExe pkgs.nodePackages.bash-language-server "start"]'';
|
||||
example = literalExpression ''[lib.getExe pkgs.bash-language-server "start"]'';
|
||||
type = either package (listOf str);
|
||||
default = pkgs.bash-language-server;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
56
modules/plugins/languages/clojure.nix
Normal file
56
modules/plugins/languages/clojure.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
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.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.clojure;
|
||||
in {
|
||||
options.vim.languages.clojure = {
|
||||
enable = mkEnableOption "Clojure language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Clojure treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "clojure";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Clojure LSP support" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = pkgs.clojure-lsp;
|
||||
description = "Clojure LSP";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.clojure-lsp = ''
|
||||
lspconfig.clojure_lsp.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${getExe cfg.lsp.package}"}''
|
||||
};
|
||||
}
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
@ -80,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";
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "CUE LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
|
|
|
|||
|
|
@ -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,4 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
|
|
@ -8,6 +9,7 @@ in {
|
|||
./cue.nix
|
||||
./dart.nix
|
||||
./clang.nix
|
||||
./clojure.nix
|
||||
./css.nix
|
||||
./elixir.nix
|
||||
./fsharp.nix
|
||||
|
|
@ -44,10 +46,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";
|
||||
|
|
|
|||
|
|
@ -53,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";
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "F# LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -67,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";
|
||||
|
|
@ -84,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";
|
||||
|
|
|
|||
|
|
@ -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" ]'';
|
||||
|
|
|
|||
|
|
@ -43,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;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Helm LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Helm LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Helm LSP server to use";
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -30,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";
|
||||
|
|
|
|||
|
|
@ -43,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";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either package listOf str;
|
||||
inherit (lib.types) bool enum either package listOf str nullOr;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
|
@ -67,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);
|
||||
|
|
@ -114,18 +114,34 @@ 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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
markview-nvim = {
|
||||
enable =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
description = ''
|
||||
[markview.nvim]: https://github.com/OXY2DEV/markview.nvim
|
||||
|
||||
[markview.nvim] - a hackable markdown, Typst, latex, html(inline) & YAML previewer
|
||||
'';
|
||||
};
|
||||
setupOpts = mkPluginSetupOption "markview-nvim" {};
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
|
@ -171,6 +187,13 @@ in {
|
|||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.extensions.markview-nvim.enable {
|
||||
vim.startPlugins = ["markview-nvim"];
|
||||
vim.pluginRC.markview-nvim = entryAnywhere ''
|
||||
require("markview").setup(${toLuaObject cfg.extensions.markview-nvim.setupOpts})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
}: 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;
|
||||
|
|
@ -54,7 +53,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;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -49,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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -95,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;
|
||||
|
|
@ -99,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
|
||||
|
|
@ -128,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";
|
||||
|
||||
|
|
@ -169,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";
|
||||
|
|
|
|||
|
|
@ -79,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";
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) either listOf package str enum;
|
||||
|
||||
cfg = config.vim.languages.ruby;
|
||||
|
|
@ -24,7 +26,25 @@
|
|||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
cmd = { "${pkgs.solargraph}/bin/solargraph", "stdio" }
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{ "${cfg.lsp.package}/bin/solargraph", "stdio" }''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
rubylsp = {
|
||||
package = pkgs.ruby-lsp;
|
||||
lspConfig = ''
|
||||
lspconfig.ruby_lsp.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{ "${cfg.lsp.package}/bin/ruby-lsp" }''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
|
@ -57,7 +77,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);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.lists) isList;
|
||||
|
|
@ -43,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"]'';
|
||||
|
|
@ -68,7 +68,14 @@ in {
|
|||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;};
|
||||
enable =
|
||||
mkEnableOption "Rust formatting"
|
||||
// {
|
||||
default = !cfg.lsp.enable && config.vim.languages.enableFormat;
|
||||
defaultText = literalMD ''
|
||||
Disabled if Rust LSP is enabled, otherwise follows {option}`vim.languages.enableFormat`
|
||||
'';
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
description = "Rust formatter to use";
|
||||
|
|
|
|||
|
|
@ -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"];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,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";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
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.types) mkGrammarOption diagnostics;
|
||||
|
|
@ -19,7 +18,7 @@
|
|||
defaultServer = "svelte";
|
||||
servers = {
|
||||
svelte = {
|
||||
package = pkgs.nodePackages.svelte-language-server;
|
||||
package = pkgs.svelte-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.svelte.setup {
|
||||
capabilities = capabilities;
|
||||
|
|
@ -38,7 +37,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
biome = {
|
||||
|
|
@ -55,21 +54,14 @@
|
|||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -84,7 +76,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";
|
||||
|
|
|
|||
|
|
@ -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,7 +9,6 @@
|
|||
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;
|
||||
|
|
@ -76,7 +75,7 @@
|
|||
defaultFormat = "prettier";
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
package = pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
|
@ -91,27 +90,21 @@
|
|||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
config = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr, cwd)
|
||||
local markers = { "eslint.config.js", "eslint.config.mjs",
|
||||
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
|
||||
for _, filename in ipairs(markers) do
|
||||
local path = vim.fs.join(cwd, filename)
|
||||
if vim.loop.fs_stat(path) then
|
||||
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
|
||||
end
|
||||
end
|
||||
|
||||
return {}
|
||||
end
|
||||
'';
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.cjs"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -127,7 +120,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";
|
||||
|
|
@ -204,9 +197,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.typescript = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
@ -215,11 +212,11 @@ in {
|
|||
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}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -76,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";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else "{'${cfg.lsp.package}/bin/wgsl_analyzer'}"
|
||||
else "{'${cfg.lsp.package}/bin/wgsl-analyzer'}"
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
defaultServer = "yaml-language-server";
|
||||
servers = {
|
||||
yaml-language-server = {
|
||||
package = pkgs.nodePackages.yaml-language-server;
|
||||
package = pkgs.yaml-language-server;
|
||||
lspConfig = ''
|
||||
|
||||
|
||||
|
|
@ -55,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]
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -6,6 +6,19 @@
|
|||
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"] ''
|
||||
|
|
@ -21,12 +34,14 @@ in {
|
|||
options.vim.lsp.lspsaga = {
|
||||
enable = mkEnableOption "LSP Saga";
|
||||
|
||||
setupOpts = mkPluginSetupOption "lspsaga" {
|
||||
border_style = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "Border type, see {command}`:help nvim_open_win`";
|
||||
};
|
||||
};
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf str int nullOr;
|
||||
inherit (lib.types) listOf str int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||
inherit (lib.nvim.config) batchRenameOptions;
|
||||
|
|
@ -70,7 +70,7 @@ in {
|
|||
};
|
||||
|
||||
sources = mkOption {
|
||||
type = nullOr (attrsOf luaInline);
|
||||
type = nullOr (listOf luaInline);
|
||||
default = null;
|
||||
description = "Sources for null-ls to register";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,13 +15,6 @@
|
|||
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||
warnings = [
|
||||
# TODO: remove warning when we update to nvim 0.11
|
||||
(mkIf config.vim.utility.ccc.enable ''
|
||||
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
|
||||
In the meantime, otter handles it by throwing a warning, but both plugins will work.
|
||||
'')
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["otter-nvim"];
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,6 @@ in {
|
|||
};
|
||||
};
|
||||
buffers = {
|
||||
set_filetype = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
if set to true, the filetype of the otterbuffers will be set. Other wide only
|
||||
the autocommand of lspconfig that attaches the language server will be
|
||||
executed without setting the filetype
|
||||
'';
|
||||
};
|
||||
write_to_disk = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.mini.colors = {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
|
|||
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