mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
Merge branch 'main' into telescope-ext
This commit is contained in:
commit
2442f5107b
125 changed files with 2267 additions and 684 deletions
|
@ -18,7 +18,7 @@
|
|||
showSignColumn = "signcolumn";
|
||||
|
||||
# 2025-02-07
|
||||
scrollOff = "scrolloff";
|
||||
scrollOffset = "scrolloff";
|
||||
};
|
||||
in {
|
||||
imports = concatLists [
|
||||
|
@ -111,6 +111,15 @@ in {
|
|||
under the diagnostics module. Please consider using one of 'vim.diagnostics.config' or
|
||||
'vim.luaConfigRC' to configure LSP lines for Neovim through its own diagnostics API.
|
||||
'')
|
||||
|
||||
# 2025-05-04
|
||||
(mkRemovedOptionModule ["vim" "useSystemClipboard"] ''
|
||||
Clipboard behaviour should now be controlled through the new, more fine-grained module
|
||||
interface found in 'vim.clipboard'. To replicate previous behaviour, you may either
|
||||
add 'vim.opt.clipboard:append("unnamedplus")' in luaConfigRC, or preferably set it
|
||||
in 'vim.clipboard.registers'. Please see the documentation for the new module for more
|
||||
details, or open an issue if you are confused.
|
||||
'')
|
||||
]
|
||||
|
||||
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"minimap"
|
||||
"notes"
|
||||
"projects"
|
||||
"repl"
|
||||
"rich-presence"
|
||||
"runner"
|
||||
"session"
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.attrsets) optionalAttrs;
|
||||
inherit (lib.types) enum bool str int either;
|
||||
inherit (lib.types) enum bool str either;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
|
||||
cfg = config.vim;
|
||||
|
@ -22,24 +21,12 @@ in {
|
|||
description = "Hide search highlight so it doesn't stay highlighted";
|
||||
};
|
||||
|
||||
scrollOffset = mkOption {
|
||||
type = int;
|
||||
default = 8;
|
||||
description = "Start scrolling this number of lines from the top or bottom of the page.";
|
||||
};
|
||||
|
||||
syntaxHighlighting = mkOption {
|
||||
type = bool;
|
||||
default = !config.vim.treesitter.highlight.enable;
|
||||
description = "Enable syntax highlighting";
|
||||
};
|
||||
|
||||
useSystemClipboard = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Make use of the clipboard for default yank and paste operations. Don't use * and +";
|
||||
};
|
||||
|
||||
lineNumberMode = mkOption {
|
||||
type = enum ["relative" "number" "relNumber" "none"];
|
||||
default = "relNumber";
|
||||
|
@ -144,10 +131,6 @@ in {
|
|||
# to pre-set Neovim options. Fear not, though as the Lua DAG is still as powerful as it
|
||||
# could be.
|
||||
luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||
${optionalString cfg.useSystemClipboard ''
|
||||
vim.opt.clipboard:append("unnamedplus")
|
||||
''}
|
||||
|
||||
${optionalString cfg.syntaxHighlighting ''
|
||||
vim.cmd("syntax on")
|
||||
''}
|
||||
|
|
80
modules/neovim/init/clipboard.nix
Normal file
80
modules/neovim/init/clipboard.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
||||
inherit (lib.types) nullOr either str listOf submodule;
|
||||
inherit (lib.attrsets) mapAttrs mapAttrsToList filterAttrs;
|
||||
cfg = config.vim.clipboard;
|
||||
in {
|
||||
options = {
|
||||
vim = {
|
||||
clipboard = {
|
||||
enable = mkEnableOption ''
|
||||
clipboard management for Neovim. Users may still choose to manage their
|
||||
clipboard through [](#opt-vim.options) should they wish to avoid using
|
||||
this module.
|
||||
'';
|
||||
|
||||
registers = mkOption {
|
||||
type = either str (listOf str);
|
||||
default = "";
|
||||
example = "unnamedplus";
|
||||
description = ''
|
||||
The register to be used by the Neovim clipboard. Recognized types are:
|
||||
|
||||
* unnamed: Vim will use the clipboard register `"*"` for all yank, delete,
|
||||
change and put operations which would normally go to the unnamed register.
|
||||
|
||||
* unnamedplus: A variant of the "unnamed" flag which uses the clipboard register
|
||||
`"+"` ({command}`:h quoteplus`) instead of register `"*"` for all yank, delete,
|
||||
change and put operations which would normally go to the unnamed register.
|
||||
|
||||
When `unnamed` and `unnamedplus` is included simultaneously yank and delete
|
||||
operations (but not put) will additionally copy the text into register `"*"`.
|
||||
|
||||
Please see {command}`:h clipboard` for more details.
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
providers = mkOption {
|
||||
type = submodule {
|
||||
options = let
|
||||
clipboards = {
|
||||
# name = "package name";
|
||||
wl-copy = "wl-clipboard";
|
||||
xclip = "xclip";
|
||||
xsel = "xsel";
|
||||
};
|
||||
in
|
||||
mapAttrs (name: pname: {
|
||||
enable = mkEnableOption name;
|
||||
package = mkPackageOption pkgs pname {nullable = true;};
|
||||
})
|
||||
clipboards;
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Clipboard providers for which packages will be added to nvf's
|
||||
{option}`extraPackages`. The `package` field may be set to `null`
|
||||
if related packages are already found in system packages to
|
||||
potentially reduce closure sizes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
options.clipboard = cfg.registers;
|
||||
extraPackages = mapAttrsToList (_: v: v.package) (
|
||||
filterAttrs (_: v: v.enable && v.package != null) cfg.providers
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,9 +2,11 @@
|
|||
imports = [
|
||||
./autocmds.nix
|
||||
./basic.nix
|
||||
./clipboard.nix
|
||||
./debug.nix
|
||||
./diagnostics.nix
|
||||
./highlight.nix
|
||||
./lsp.nix
|
||||
./spellcheck.nix
|
||||
];
|
||||
}
|
||||
|
|
93
modules/neovim/init/lsp.nix
Normal file
93
modules/neovim/init/lsp.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf;
|
||||
inherit (lib.strings) concatLines;
|
||||
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.languages) lspOptions;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
lspConfigurations =
|
||||
mapAttrsToList (
|
||||
name: value: ''
|
||||
vim.lsp.config["${name}"] = ${toLuaObject value}
|
||||
''
|
||||
)
|
||||
cfg.servers;
|
||||
|
||||
enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
|
||||
in {
|
||||
options = {
|
||||
vim.lsp = {
|
||||
enable = mkEnableOption ''
|
||||
global LSP functionality for Neovim.
|
||||
|
||||
This option controls whether to enable LSP functionality within modules under
|
||||
{option}`vim.languages`. You do not need to set this to `true` for language
|
||||
servers defined in {option}`vim.lsp.servers` to take effect, since they are
|
||||
enabled automatically.
|
||||
'';
|
||||
|
||||
servers = mkOption {
|
||||
type = attrsOf lspOptions;
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
"*" = {
|
||||
root_markers = [".git"];
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
multilineTokenSupport = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"clangd" = {
|
||||
filetypes = ["c"];
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
LSP configurations that will be managed using `vim.lsp.config()` and related
|
||||
utilities added in Neovim 0.11. LSPs defined here will be added to the
|
||||
resulting {file}`init.lua` using `vim.lsp.config` and enabled through
|
||||
`vim.lsp.enable()` API from Neovim below the configuration table.
|
||||
|
||||
You may review the generated configuration by running {command}`nvf-print-config`
|
||||
in a shell. Please see {command}`:help lsp-config` for more details
|
||||
on the underlying API.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
vim.lsp.servers."*" = {
|
||||
capabilities = mkDefault (mkLuaInline "capabilities");
|
||||
on_attach = mkDefault (mkLuaInline "default_on_attach");
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf (cfg.servers != {}) {
|
||||
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
||||
-- Individual LSP configurations managed by nvf.
|
||||
${concatLines lspConfigurations}
|
||||
|
||||
-- Enable configured LSPs explicitly
|
||||
vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
325
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
325
modules/plugins/assistant/avante/avante-nvim.nix
Normal file
|
@ -0,0 +1,325 @@
|
|||
{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.";
|
||||
};
|
||||
|
||||
vendors = mkOption {
|
||||
type = nullOr attrs;
|
||||
default = null;
|
||||
description = "Define Your Custom providers.";
|
||||
example = literalMD ''
|
||||
```nix
|
||||
ollama = {
|
||||
__inherited_from = "openai";
|
||||
api_key_name = "";
|
||||
endpoint = "http://127.0.0.1:11434/v1";
|
||||
model = "qwen2.5u-coder:7b";
|
||||
max_tokens = 4096;
|
||||
disable_tools = true;
|
||||
};
|
||||
ollama_ds = {
|
||||
__inherited_from = "openai";
|
||||
api_key_name = "";
|
||||
endpoint = "http://127.0.0.1:11434/v1";
|
||||
model = "deepseek-r1u:7b";
|
||||
max_tokens = 4096;
|
||||
disable_tools = true;
|
||||
};
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
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
|
||||
];
|
||||
}
|
|
@ -21,7 +21,17 @@ 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]";};
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
./chatgpt
|
||||
./copilot
|
||||
./codecompanion
|
||||
./avante
|
||||
];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,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 +48,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"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
'')
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -81,7 +81,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -77,7 +77,7 @@ in {
|
|||
flutter-tools = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
default = config.vim.lsp.enable;
|
||||
description = "Enable flutter-tools for flutter support";
|
||||
};
|
||||
|
||||
|
@ -143,8 +143,6 @@ in {
|
|||
})
|
||||
|
||||
(mkIf ftcfg.enable {
|
||||
lsp.enable = true;
|
||||
|
||||
startPlugins = [
|
||||
(
|
||||
if ftcfg.enableNoResolvePatch
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
@ -130,6 +130,18 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
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 = {
|
||||
|
@ -175,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;
|
||||
|
|
|
@ -54,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;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
|
@ -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{
|
||||
|
@ -143,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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -77,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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.cjs"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
|
@ -120,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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: 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;
|
||||
|
@ -14,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:
|
||||
|
@ -29,24 +33,59 @@ in {
|
|||
sourcePlugins = ["cmp-nvim-lsp"];
|
||||
};
|
||||
|
||||
augroups = [{name = augroup;}];
|
||||
autocmds =
|
||||
if cfg.inlayHints.enable
|
||||
then [
|
||||
{
|
||||
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 })
|
||||
(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
|
||||
'';
|
||||
desc = "LSP on-attach enable inlay hints autocmd";
|
||||
event = ["LspAttach"];
|
||||
}
|
||||
]
|
||||
else [];
|
||||
''}
|
||||
|
||||
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};
|
||||
|
@ -74,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
|
||||
|
@ -138,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 = {
|
||||
|
|
|
@ -14,8 +14,6 @@ in {
|
|||
config = mkIf cfg.lspconfig.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
lsp.enable = true;
|
||||
|
||||
startPlugins = ["nvim-lspconfig"];
|
||||
|
||||
pluginRC.lspconfig = entryAfter ["lsp-setup"] ''
|
||||
|
|
|
@ -3,11 +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"
|
||||
|
|
19
modules/plugins/repl/conjure/conjure.nix
Normal file
19
modules/plugins/repl/conjure/conjure.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.repl.conjure;
|
||||
in {
|
||||
options.vim.repl.conjure = {
|
||||
enable = mkEnableOption "Conjure";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [pkgs.vimPlugins.conjure];
|
||||
};
|
||||
}
|
5
modules/plugins/repl/conjure/default.nix
Normal file
5
modules/plugins/repl/conjure/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./conjure.nix
|
||||
];
|
||||
}
|
5
modules/plugins/repl/default.nix
Normal file
5
modules/plugins/repl/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./conjure
|
||||
];
|
||||
}
|
|
@ -109,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`
|
||||
|
|
|
@ -21,9 +21,14 @@ in {
|
|||
'';
|
||||
};
|
||||
onedark = {
|
||||
setup = {style ? "dark", ...}: ''
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent,
|
||||
...
|
||||
}: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
transparent = ${boolToString transparent},
|
||||
style = "${style}"
|
||||
}
|
||||
require('onedark').load()
|
||||
|
@ -95,7 +100,7 @@ in {
|
|||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
'';
|
||||
styles = ["latte" "frappe" "macchiato" "mocha"];
|
||||
styles = ["auto" "latte" "frappe" "macchiato" "mocha"];
|
||||
};
|
||||
|
||||
oxocarbon = {
|
||||
|
@ -212,4 +217,17 @@ in {
|
|||
'';
|
||||
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
|
||||
};
|
||||
solarized-osaka = {
|
||||
setup = {transparent ? false, ...}: ''
|
||||
require("solarized-osaka").setup({
|
||||
transparent = ${boolToString transparent},
|
||||
styles = {
|
||||
comments = { italic = false },
|
||||
keywords = { italic = false },
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("solarized-osaka")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
imports = [
|
||||
# treesitter extras
|
||||
./ts-context
|
||||
./ts-textobjects
|
||||
|
||||
./treesitter.nix
|
||||
./config.nix
|
||||
|
|
23
modules/plugins/treesitter/ts-textobjects/config.nix
Normal file
23
modules/plugins/treesitter/ts-textobjects/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
inherit (config.vim) treesitter;
|
||||
cfg = treesitter.textobjects;
|
||||
in {
|
||||
config = mkIf (treesitter.enable && cfg.enable) {
|
||||
vim = {
|
||||
startPlugins = ["nvim-treesitter-textobjects"];
|
||||
|
||||
# set up treesitter-textobjects after Treesitter, whose config we're adding to.
|
||||
pluginRC.treesitter-textobjects = entryAfter ["treesitter"] ''
|
||||
require("nvim-treesitter.configs").setup({textobjects = ${toLuaObject cfg.setupOpts}})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/treesitter/ts-textobjects/default.nix
Normal file
6
modules/plugins/treesitter/ts-textobjects/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./textobjects.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
21
modules/plugins/treesitter/ts-textobjects/textobjects.nix
Normal file
21
modules/plugins/treesitter/ts-textobjects/textobjects.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.treesitter.textobjects = {
|
||||
enable = mkEnableOption "Treesitter textobjects";
|
||||
setupOpts =
|
||||
mkPluginSetupOption "treesitter-textobjects" {}
|
||||
// {
|
||||
example = {
|
||||
select = {
|
||||
enable = true;
|
||||
lookahead = true;
|
||||
keymaps = {
|
||||
af = "@function.outer";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -2,5 +2,6 @@ _: {
|
|||
imports = [
|
||||
./which-key
|
||||
./cheatsheet
|
||||
./hardtime
|
||||
];
|
||||
}
|
||||
|
|
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.binds.hardtime-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["hardtime-nvim"];
|
||||
|
||||
pluginRC.hardtime = entryAnywhere ''
|
||||
require("hardtime").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/binds/hardtime/default.nix
Normal file
6
modules/plugins/utility/binds/hardtime/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hardtime.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
10
modules/plugins/utility/binds/hardtime/hardtime.nix
Normal file
10
modules/plugins/utility/binds/hardtime/hardtime.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.binds.hardtime-nvim = {
|
||||
enable = mkEnableOption "hardtime helper for no repeat keybinds";
|
||||
|
||||
setupOpts = mkPluginSetupOption "hardtime-nvim" {};
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./image-nvim
|
||||
./img-clip
|
||||
];
|
||||
}
|
||||
|
|
23
modules/plugins/utility/images/img-clip/config.nix
Normal file
23
modules/plugins/utility/images/img-clip/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.utility.images.img-clip;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"img-clip"
|
||||
];
|
||||
|
||||
pluginRC.image-nvim = entryAnywhere ''
|
||||
require("img-clip").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/images/img-clip/default.nix
Normal file
6
modules/plugins/utility/images/img-clip/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./img-clip.nix
|
||||
];
|
||||
}
|
11
modules/plugins/utility/images/img-clip/img-clip.nix
Normal file
11
modules/plugins/utility/images/img-clip/img-clip.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.images.img-clip = {
|
||||
enable = mkEnableOption "img-clip to paste images into any markup language";
|
||||
|
||||
setupOpts = mkPluginSetupOption "img-clip" {};
|
||||
};
|
||||
}
|
|
@ -7,23 +7,20 @@
|
|||
}: let
|
||||
inherit (pkgs) vimPlugins;
|
||||
inherit (lib.trivial) flip;
|
||||
inherit (builtins) path filter isString;
|
||||
inherit (builtins) filter isString;
|
||||
|
||||
getPin = name: ((pkgs.callPackages ../../../npins/sources.nix {}) // config.vim.pluginOverrides).${name};
|
||||
|
||||
noBuildPlug = pname: let
|
||||
pin = getPin pname;
|
||||
version = pin.revision or "dirty";
|
||||
in {
|
||||
# vim.lazy.plugins relies on pname, so we only set that here
|
||||
# version isn't needed for anything, but inherit it anyway for correctness
|
||||
inherit pname version;
|
||||
outPath = path {
|
||||
name = "${pname}-0-unstable-${version}";
|
||||
path = pin.outPath;
|
||||
version = builtins.substring 0 8 pin.revision;
|
||||
in
|
||||
pin.outPath.overrideAttrs {
|
||||
inherit pname version;
|
||||
name = "${pname}-${version}";
|
||||
|
||||
passthru.vimPlugin = false;
|
||||
};
|
||||
passthru.vimPlugin = false;
|
||||
};
|
||||
|
||||
# build a vim plugin with the given name and arguments
|
||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||
|
@ -51,7 +48,7 @@
|
|||
doCheck = false;
|
||||
};
|
||||
|
||||
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp;
|
||||
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
|
||||
};
|
||||
|
||||
buildConfigPlugins = plugins:
|
||||
|
@ -62,17 +59,14 @@
|
|||
filter (f: f != null) plugins
|
||||
);
|
||||
|
||||
# built (or "normalized") plugins that are modified
|
||||
builtStartPlugins = buildConfigPlugins config.vim.startPlugins;
|
||||
builtOptPlugins = map (package: package // {optional = true;}) (
|
||||
buildConfigPlugins config.vim.optPlugins
|
||||
);
|
||||
|
||||
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||
# generate a wrapped Neovim package.
|
||||
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
||||
neovim-wrapped = inputs.mnw.lib.wrap {inherit pkgs;} {
|
||||
neovim = config.vim.package;
|
||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||
plugins = {
|
||||
start = buildConfigPlugins config.vim.startPlugins;
|
||||
opt = buildConfigPlugins config.vim.optPlugins;
|
||||
};
|
||||
appName = "nvf";
|
||||
extraBinPath = config.vim.extraPackages;
|
||||
initLua = config.vim.builtLuaConfigRC;
|
||||
|
|
|
@ -11,13 +11,14 @@ in {
|
|||
description = ''
|
||||
[official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||
|
||||
the experimental Lua module loader to speed up the start up process
|
||||
Whether to enable the experimental Lua module loader to speed up the start
|
||||
up process. If `true`, this will enable the experimental Lua module loader
|
||||
which:
|
||||
|
||||
If `true`, this will enable the experimental Lua module loader which:
|
||||
- overrides loadfile
|
||||
- adds the lua loader using the byte-compilation cache
|
||||
- adds the libs loader
|
||||
- removes the default Neovim loader
|
||||
* overrides loadfile
|
||||
* adds the lua loader using the byte-compilation cache
|
||||
* adds the libs loader
|
||||
* removes the default Neovim loader
|
||||
|
||||
::: {.note}
|
||||
The Lua module loader is *disabled* by default. Before setting this option, please
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue