mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-14 09:25:30 +00:00
Merge branch 'NotAShelf:v0.7' into v0.7
This commit is contained in:
commit
234ad31909
101 changed files with 1973 additions and 2115 deletions
|
|
@ -1,58 +1,93 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||
inherit (lib.lists) concatLists;
|
||||
inherit (lib.nvim.config) batchRenameOptions;
|
||||
|
||||
renamedVimOpts = batchRenameOptions ["vim"] ["vim" "options"] {
|
||||
colourTerm = "termguicolors";
|
||||
mouseSupport = "mouse";
|
||||
cmdHeight = "cmdheight";
|
||||
updateTime = "updatetime";
|
||||
mapTimeout = "tm";
|
||||
cursorlineOpt = "cursorlineopt";
|
||||
splitBelow = "splitbelow";
|
||||
splitRight = "splitright";
|
||||
autoIndent = "autoindent";
|
||||
wordWrap = "wrap";
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
# 2024-06-06
|
||||
(mkRemovedOptionModule ["vim" "tidal"] ''
|
||||
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
|
||||
you depended on this functionality, please open an issue.
|
||||
'')
|
||||
imports = concatLists [
|
||||
[
|
||||
# 2024-06-06
|
||||
(mkRemovedOptionModule ["vim" "tidal"] ''
|
||||
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
|
||||
you depended on this functionality, please open an issue.
|
||||
'')
|
||||
|
||||
# 2024-07-20
|
||||
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
|
||||
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
|
||||
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
'')
|
||||
# 2024-07-20
|
||||
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
|
||||
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
|
||||
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
'')
|
||||
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "enable"] ''
|
||||
vim.autopairs.enable has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "type"] ''
|
||||
vim.autopairs.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "enable"] ''
|
||||
vim.autocomplete.enable has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "type"] ''
|
||||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
|
||||
vim.autocomplete.sources has been removed in favor of per-plugin modules.
|
||||
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
|
||||
instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||
'')
|
||||
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "enable"] ''
|
||||
vim.autopairs.enable has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "type"] ''
|
||||
vim.autopairs.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "enable"] ''
|
||||
vim.autocomplete.enable has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "type"] ''
|
||||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
|
||||
vim.autocomplete.sources has been removed in favor of per-plugin modules.
|
||||
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
|
||||
instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||
'')
|
||||
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||
|
||||
# 2024-10-14
|
||||
(mkRemovedOptionModule ["vim" "configRC"] ''
|
||||
Please migrate your configRC sections to Neovim's Lua format, and
|
||||
add them to `vim.luaConfigRC`.
|
||||
# 2024-10-14
|
||||
(mkRemovedOptionModule ["vim" "configRC"] ''
|
||||
Please migrate your configRC sections to Neovim's Lua format, and
|
||||
add them to `vim.luaConfigRC`.
|
||||
|
||||
See the v0.7 release notes for more information on why and how to
|
||||
migrate your existing configurations to the new format.
|
||||
'')
|
||||
See the v0.7 release notes for more information on why and how to
|
||||
migrate your existing configurations to the new format.
|
||||
'')
|
||||
|
||||
(mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] ''
|
||||
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
||||
(accidental) leaking of user configuration.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] ''
|
||||
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
||||
(accidental) leaking of user configuration.
|
||||
'')
|
||||
|
||||
(mkRemovedOptionModule ["vim" "lsp" "trouble" "mappings" "toggle"] ''
|
||||
With Trouble having so many different modes, and breaking changes
|
||||
upstream, it no longer makes sense, nor works, to toggle only Trouble.
|
||||
'')
|
||||
|
||||
# 2024-11-30
|
||||
(mkRenamedOptionModule ["vim" "leaderKey"] ["vim" "globals" "mapleader"])
|
||||
|
||||
(mkRemovedOptionModule ["vim" "tabWidth"] ''
|
||||
Previous behaviour of this option was confusing and undocumented. Please set
|
||||
`tabstop` and `shiftwidth` manually in `vim.options` or per-filetype in a
|
||||
`ftplugin` directory added to your runtime path.
|
||||
'')
|
||||
]
|
||||
|
||||
# 2024-12-1
|
||||
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
||||
renamedVimOpts
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
"notes"
|
||||
"projects"
|
||||
"rich-presence"
|
||||
"runner"
|
||||
"session"
|
||||
"snippets"
|
||||
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
||||
|
|
|
|||
|
|
@ -3,29 +3,18 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) enum bool str int 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;
|
||||
in {
|
||||
options.vim = {
|
||||
leaderKey = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The leader key used for `<leader>` mappings";
|
||||
};
|
||||
|
||||
colourTerm = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Set terminal up for 256 colours";
|
||||
};
|
||||
|
||||
disableArrows = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
|
|
@ -44,12 +33,6 @@ in {
|
|||
description = "Start scrolling this number of lines from the top or bottom of the page.";
|
||||
};
|
||||
|
||||
wordWrap = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable word wrapping.";
|
||||
};
|
||||
|
||||
syntaxHighlighting = mkOption {
|
||||
type = bool;
|
||||
default = !config.vim.treesitter.highlight.enable;
|
||||
|
|
@ -62,24 +45,10 @@ in {
|
|||
description = "Make use of the clipboard for default yank and paste operations. Don't use * and +";
|
||||
};
|
||||
|
||||
mouseSupport = mkOption {
|
||||
type = enum ["a" "n" "v" "i" "c"];
|
||||
default = "a";
|
||||
description = ''
|
||||
Set modes for mouse support.
|
||||
|
||||
* a - all
|
||||
* n - normal
|
||||
* v - visual
|
||||
* i - insert
|
||||
* c - command
|
||||
'';
|
||||
};
|
||||
|
||||
lineNumberMode = mkOption {
|
||||
type = enum ["relative" "number" "relNumber" "none"];
|
||||
default = "relNumber";
|
||||
example = literalExpression "none";
|
||||
example = "none";
|
||||
description = "How line numbers are displayed.";
|
||||
};
|
||||
|
||||
|
|
@ -89,30 +58,6 @@ in {
|
|||
description = "Prevent swapfile and backupfile from being created";
|
||||
};
|
||||
|
||||
tabWidth = mkOption {
|
||||
type = int;
|
||||
default = 4;
|
||||
description = "Set the width of tabs";
|
||||
};
|
||||
|
||||
autoIndent = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable auto indent";
|
||||
};
|
||||
|
||||
cmdHeight = mkOption {
|
||||
type = int;
|
||||
default = 1;
|
||||
description = "Height of the command pane";
|
||||
};
|
||||
|
||||
updateTime = mkOption {
|
||||
type = int;
|
||||
default = 300;
|
||||
description = "The number of milliseconds till Cursor Hold event is fired";
|
||||
};
|
||||
|
||||
showSignColumn = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
|
|
@ -125,36 +70,12 @@ in {
|
|||
description = "Set how bells are handled. Options: on, visual or none";
|
||||
};
|
||||
|
||||
mapTimeout = mkOption {
|
||||
type = int;
|
||||
default = 500;
|
||||
description = "Timeout in ms that neovim will wait for mapped action to complete";
|
||||
};
|
||||
|
||||
splitBelow = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "New splits will open below instead of on top";
|
||||
};
|
||||
|
||||
splitRight = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "New splits will open to the right";
|
||||
};
|
||||
|
||||
enableEditorconfig = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Follow editorconfig rules in current directory";
|
||||
};
|
||||
|
||||
cursorlineOpt = mkOption {
|
||||
type = enum ["line" "screenline" "number" "both"];
|
||||
default = "line";
|
||||
description = "Highlight the text line of the cursor with CursorLine hl-CursorLine";
|
||||
};
|
||||
|
||||
searchCase = mkOption {
|
||||
type = enum ["ignore" "smart" "sensitive"];
|
||||
default = "sensitive";
|
||||
|
|
@ -181,46 +102,35 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||
config.vim = {
|
||||
# Set options that were previously interpolated in 'luaConfigRC.basic' as vim.options (vim.o)
|
||||
# and 'vim.globals' (vim.g). Future options, if possible, should be added here instead of the
|
||||
# luaConfigRC section below.
|
||||
options = pushDownDefault {
|
||||
encoding = "utf-8";
|
||||
hidden = true;
|
||||
expandtab = true;
|
||||
};
|
||||
|
||||
globals = pushDownDefault {
|
||||
editorconfig = cfg.enableEditorconfig;
|
||||
};
|
||||
|
||||
# Options that are more difficult to set through 'vim.options'. Fear not, though
|
||||
# as the Lua DAG is still as powerful as it could be.
|
||||
luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||
-- Settings that are set for everything
|
||||
vim.o.encoding = "utf-8"
|
||||
vim.o.hidden = true
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.o.expandtab = true
|
||||
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
||||
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
||||
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
||||
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||
|
||||
${optionalString cfg.undoFile.enable ''
|
||||
vim.o.undofile = true
|
||||
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitBelow ''
|
||||
vim.o.splitbelow = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitRight ''
|
||||
vim.o.splitright = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.showSignColumn ''
|
||||
vim.o.signcolumn = "yes"
|
||||
''}
|
||||
|
||||
${optionalString cfg.autoIndent ''
|
||||
vim.o.autoindent = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.preventJunkFiles ''
|
||||
vim.o.swapfile = false
|
||||
vim.o.backup = false
|
||||
|
|
@ -261,23 +171,11 @@ in {
|
|||
vim.cmd("syntax on")
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.wordWrap) ''
|
||||
vim.o.wrap = false
|
||||
''}
|
||||
|
||||
${optionalString cfg.hideSearchHighlight ''
|
||||
vim.o.hlsearch = false
|
||||
vim.o.incsearch = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.colourTerm ''
|
||||
vim.o.termguicolors = true
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.enableEditorconfig) ''
|
||||
vim.g.editorconfig = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "ignore") ''
|
||||
vim.o.smartcase = false
|
||||
vim.o.ignorecase = true
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ in {
|
|||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||
keys = [
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Accept suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Accept suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Accept suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Next panel suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Previous panel suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Refresh suggestion" {})
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.open (wrapPanelBinding ''
|
||||
function() require("copilot.panel").open({ position = "${cfg.setupOpts.panel.layout.position}", ratio = ${toString cfg.setupOpts.panel.layout.ratio}, }) end
|
||||
''
|
||||
cfg.mappings.panel.open) "[copilot] Accept suggestion" {})
|
||||
cfg.mappings.panel.open) "[copilot] Open Panel" {})
|
||||
|
||||
(mkLuaKeymap ["i"] cfg.mappings.suggestion.accept "function() require('copilot.suggestion').accept() end" "[copilot] Accept suggestion" {})
|
||||
(mkLuaKeymap ["i"] cfg.mappings.suggestion.acceptLine "function() require('copilot.suggestion').accept_line() end" "[copilot] Accept suggestion (line)" {})
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
imports = [
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "nvim-compe"] "nvim-compe is deprecated and no longer suported.")
|
||||
(mkRemovedOptionModule ["vim" "autopairs" "nvim-compe"] "nvim-compe is deprecated and no longer supported.")
|
||||
];
|
||||
|
||||
options.vim.autopairs.nvim-autopairs = {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkLznExprBinding mkLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.comments.comment-nvim;
|
||||
self = import ./comment-nvim.nix {inherit lib;};
|
||||
inherit (self.options.vim.comments.comment-nvim) mappings;
|
||||
inherit (options.vim.comments.comment-nvim) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.lazy.plugins.comment-nvim = {
|
||||
|
|
@ -16,24 +16,28 @@ in {
|
|||
setupModule = "Comment";
|
||||
inherit (cfg) setupOpts;
|
||||
keys = [
|
||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderBlock "<Plug>(comment_toggle_blockwise)" mappings.toggleOpLeaderBlock.description)
|
||||
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentLine ''
|
||||
(mkKeymap "n" cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" {desc = mappings.toggleOpLeaderLine.description;})
|
||||
(mkKeymap "n" cfg.mappings.toggleOpLeaderBlock "<Plug>(comment_toggle_blockwise)" {desc = mappings.toggleOpLeaderBlock.description;})
|
||||
(mkKeymap "n" cfg.mappings.toggleCurrentLine ''
|
||||
function()
|
||||
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_linewise_current)'
|
||||
or '<Plug>(comment_toggle_linewise_count)'
|
||||
end
|
||||
''
|
||||
mappings.toggleCurrentLine.description)
|
||||
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentBlock ''
|
||||
'' {
|
||||
expr = true;
|
||||
desc = mappings.toggleCurrentLine.description;
|
||||
})
|
||||
(mkKeymap ["n"] cfg.mappings.toggleCurrentBlock ''
|
||||
function()
|
||||
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_blockwise_current)'
|
||||
or '<Plug>(comment_toggle_blockwise_count)'
|
||||
end
|
||||
''
|
||||
mappings.toggleCurrentBlock.description)
|
||||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
||||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
||||
'' {
|
||||
expr = true;
|
||||
desc = mappings.toggleCurrentBlock.description;
|
||||
})
|
||||
(mkKeymap "x" cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" {desc = mappings.toggleSelectedLine.description;})
|
||||
(mkKeymap "x" cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" {desc = mappings.toggleSelectedBlock.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
|
||||
|
||||
borders = config.vim.ui.borders.plugins.nvim-cmp;
|
||||
|
||||
cfg = config.vim.autocomplete.nvim-cmp;
|
||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||
getPluginName = plugin:
|
||||
|
|
@ -81,10 +83,9 @@ in {
|
|||
setupOpts = {
|
||||
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
||||
|
||||
# TODO: try to get nvim-cmp to follow global border style
|
||||
window = mkIf config.vim.ui.borders.enable {
|
||||
completion = mkLuaInline "cmp.config.window.bordered()";
|
||||
documentation = mkLuaInline "cmp.config.window.bordered()";
|
||||
window = mkIf borders.enable {
|
||||
completion.border = borders.style;
|
||||
documentation.border = borders.style;
|
||||
};
|
||||
|
||||
formatting.format = cfg.format;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ in {
|
|||
|
||||
A `deprio` function and a `kinds`
|
||||
(`require("cmp.types").lsp.CompletionItemKind`) variable is provided
|
||||
above `setupOpts`. By passing a type to the funcion, the returned
|
||||
above `setupOpts`. By passing a type to the function, the returned
|
||||
function will be a comparator that always ranks the specified kind the
|
||||
lowest.
|
||||
'';
|
||||
|
|
@ -72,7 +72,7 @@ in {
|
|||
};
|
||||
|
||||
format = mkOption {
|
||||
type = luaInline;
|
||||
type = nullOr luaInline;
|
||||
default = mkLuaInline ''
|
||||
function(entry, vim_item)
|
||||
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
||||
|
|
@ -88,7 +88,7 @@ in {
|
|||
```
|
||||
'';
|
||||
description = ''
|
||||
The function used to customize the completion menu entires. This is
|
||||
The function used to customize the completion menu entries. This is
|
||||
outside of `setupOpts` to allow for an easier integration with
|
||||
lspkind.nvim.
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ in {
|
|||
|
||||
customIndices = mkOption {
|
||||
default = [];
|
||||
description = "Specify a list of default charecters to use instead of numbers";
|
||||
description = "Specify a list of default characters to use instead of numbers";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
|
|
@ -6,13 +7,11 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding mkSetLuaLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
||||
|
||||
cfg = config.vim.debugger.nvim-dap;
|
||||
self = import ./nvim-dap.nix {inherit lib;};
|
||||
mappingDefinitions = self.options.vim.debugger.nvim-dap.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
inherit (options.vim.debugger.nvim-dap) mappings;
|
||||
in {
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
|
|
@ -29,24 +28,24 @@ in {
|
|||
}
|
||||
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
||||
|
||||
maps.normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
||||
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
||||
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
||||
(mkSetLuaBinding mappings.runLast "require('dap').run_last")
|
||||
keymaps = [
|
||||
(mkKeymap "n" cfg.mappings.continue "require('dap').continue" {desc = mappings.continue.description;})
|
||||
(mkKeymap "n" cfg.mappings.restart "require('dap').restart" {desc = mappings.restart.description;})
|
||||
(mkKeymap "n" cfg.mappings.terminate "require('dap').terminate" {desc = mappings.terminate.description;})
|
||||
(mkKeymap "n" cfg.mappings.runLast "require('dap').run_last" {desc = mappings.runLast.description;})
|
||||
|
||||
(mkSetLuaBinding mappings.toggleRepl "require('dap').repl.toggle")
|
||||
(mkSetLuaBinding mappings.hover "require('dap.ui.widgets').hover")
|
||||
(mkSetLuaBinding mappings.toggleBreakpoint "require('dap').toggle_breakpoint")
|
||||
(mkKeymap "n" cfg.mappings.toggleRepl "require('dap').repl.toggle" {desc = mappings.toggleRepl.description;})
|
||||
(mkKeymap "n" cfg.mappings.hover "require('dap.ui.widgets').hover" {desc = mappings.hover.description;})
|
||||
(mkKeymap "n" cfg.mappings.toggleBreakpoint "require('dap').toggle_breakpoint" {desc = mappings.toggleBreakpoint.description;})
|
||||
|
||||
(mkSetLuaBinding mappings.runToCursor "require('dap').run_to_cursor")
|
||||
(mkSetLuaBinding mappings.stepInto "require('dap').step_into")
|
||||
(mkSetLuaBinding mappings.stepOut "require('dap').step_out")
|
||||
(mkSetLuaBinding mappings.stepOver "require('dap').step_over")
|
||||
(mkSetLuaBinding mappings.stepBack "require('dap').step_back")
|
||||
(mkKeymap "n" cfg.mappings.runToCursor "require('dap').run_to_cursor" {desc = mappings.runToCursor.description;})
|
||||
(mkKeymap "n" cfg.mappings.stepInto "require('dap').step_into" {desc = mappings.stepInto.description;})
|
||||
(mkKeymap "n" cfg.mappings.stepOut "require('dap').step_out" {desc = mappings.stepOut.description;})
|
||||
(mkKeymap "n" cfg.mappings.stepOver "require('dap').step_over" {desc = mappings.stepOver.description;})
|
||||
(mkKeymap "n" cfg.mappings.stepBack "require('dap').step_back" {desc = mappings.stepBack.description;})
|
||||
|
||||
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
||||
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
||||
(mkKeymap "n" cfg.mappings.goUp "require('dap').up" {desc = mappings.goUp.description;})
|
||||
(mkKeymap "n" cfg.mappings.goDown "require('dap').down" {desc = mappings.goDown.description;})
|
||||
];
|
||||
};
|
||||
})
|
||||
|
|
@ -60,7 +59,7 @@ in {
|
|||
inherit (cfg.ui) setupOpts;
|
||||
|
||||
keys = [
|
||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||
(mkKeymap "n" cfg.mappings.toggleDapUI "function() require('dapui').toggle() end" {desc = mappings.toggleDapUI.description;})
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ in {
|
|||
};
|
||||
|
||||
mappings = {
|
||||
continue = mkMappingOption "Contiue" "<leader>dc";
|
||||
continue = mkMappingOption "Continue" "<leader>dc";
|
||||
restart = mkMappingOption "Restart" "<leader>dR";
|
||||
terminate = mkMappingOption "Terminate" "<leader>dq";
|
||||
runLast = mkMappingOption "Re-run Last Debug Session" "<leader>d.";
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.filetree.neo-tree;
|
||||
in {
|
||||
|
|
@ -25,6 +26,26 @@ in {
|
|||
};
|
||||
|
||||
visuals.nvim-web-devicons.enable = true;
|
||||
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||
pluginRC.neo-tree =
|
||||
mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable)
|
||||
(entryAnywhere ''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||
desc = "Loads neo-tree when opening a directory",
|
||||
callback = function(args)
|
||||
local stats = vim.uv.fs_stat(args.file)
|
||||
|
||||
if not stats or stats.type ~= "directory" then
|
||||
return
|
||||
end
|
||||
|
||||
require("lz.n").trigger_load("neo-tree-nvim")
|
||||
|
||||
return true
|
||||
end,
|
||||
})
|
||||
'');
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.types) bool str int submodule enum either listOf;
|
||||
inherit (lib.types) bool str enum either listOf;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
@ -150,6 +150,14 @@ in {
|
|||
A list of filetypes that should not be replaced when opening a file
|
||||
'';
|
||||
};
|
||||
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = mkOption {
|
||||
type = enum ["disabled" "open_default" "open_current"];
|
||||
default = "open_default";
|
||||
description = "Hijack Netrw behavior";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}: let
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
|
||||
|
|
@ -24,16 +24,17 @@ in {
|
|||
package = "nvim-tree-lua";
|
||||
setupModule = "nvim-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||
keys = [
|
||||
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
(mkKeymap "n" cfg.mappings.toggle ":NvimTreeToggle<cr>" {desc = mappings.toggle.description;})
|
||||
(mkKeymap "n" cfg.mappings.refresh ":NvimTreeRefresh<cr>" {desc = mappings.refresh.description;})
|
||||
(mkKeymap "n" cfg.mappings.findFile ":NvimTreeFindFile<cr>" {desc = mappings.findFile.description;})
|
||||
(mkKeymap "n" cfg.mappings.focus ":NvimTreeFocus<cr>" {desc = mappings.focus.description;})
|
||||
];
|
||||
};
|
||||
|
||||
pluginRC.nvimtreelua = entryAnywhere ''
|
||||
pluginRC.nvim-tree = entryAnywhere ''
|
||||
${
|
||||
optionalString cfg.setupOpts.disable_netrw ''
|
||||
-- disable netrew completely
|
||||
|
|
@ -42,6 +43,24 @@ in {
|
|||
''
|
||||
}
|
||||
|
||||
${optionalString (config.vim.lazy.enable && cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
|
||||
desc = "Loads nvim-tree when opening a directory",
|
||||
callback = function(args)
|
||||
local stats = vim.uv.fs_stat(args.file)
|
||||
|
||||
if not stats or stats.type ~= "directory" then
|
||||
return
|
||||
end
|
||||
|
||||
require("lz.n").trigger_load("nvim-tree-lua")
|
||||
|
||||
return true
|
||||
end,
|
||||
})
|
||||
''}
|
||||
|
||||
${
|
||||
optionalString cfg.openOnSetup ''
|
||||
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ in {
|
|||
./css.nix
|
||||
./elixir.nix
|
||||
./go.nix
|
||||
./hcl.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./java.nix
|
||||
|
|
@ -32,6 +33,7 @@ in {
|
|||
./zig.nix
|
||||
./csharp.nix
|
||||
./julia.nix
|
||||
./nu.nix
|
||||
];
|
||||
|
||||
options.vim.languages = {
|
||||
|
|
|
|||
117
modules/plugins/languages/hcl.nix
Normal file
117
modules/plugins/languages/hcl.nix
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package bool enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.hcl;
|
||||
|
||||
defaultServer = "terraform-ls";
|
||||
servers = {
|
||||
terraform-ls = {
|
||||
package = pkgs.terraform-ls;
|
||||
lspConfig = ''
|
||||
lspconfig.terraformls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach=default_on_attach,
|
||||
cmd = {"${lib.getExe cfg.lsp.package}", "serve"},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = "hclfmt";
|
||||
formats = {
|
||||
hclfmt = {
|
||||
package = pkgs.hclfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.hclfmt.with({
|
||||
command = "${lib.getExe cfg.format.package}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.hcl = {
|
||||
enable = mkEnableOption "HCL support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "HCL treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "hcl";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
|
||||
# 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;
|
||||
default = servers.${defaultServer}.package;
|
||||
description = "HCL language server package (terraform-ls)";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableFormat;
|
||||
description = "Enable HCL formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "HCL formatter to use";
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "HCL formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
# hcl style official: https://developer.hashicorp.com/terraform/language/style#code-formatting
|
||||
vim.pluginRC.hcl = ''
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "hcl",
|
||||
callback = function(opts)
|
||||
local bo = vim.bo[opts.buf]
|
||||
bo.tabstop = 2
|
||||
bo.shiftwidth = 2
|
||||
bo.softtabstop = 2
|
||||
end
|
||||
})
|
||||
|
||||
local ft = require('Comment.ft')
|
||||
ft
|
||||
.set('hcl', '#%s')
|
||||
'';
|
||||
}
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources = lib.optionalAttrs (! config.vim.languages.terraform.lsp.enable) {
|
||||
terraform-ls = servers.${cfg.lsp.server}.lspConfig;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
70
modules/plugins/languages/nu.nix
Normal file
70
modules/plugins/languages/nu.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) str either package listOf;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (builtins) isList;
|
||||
|
||||
defaultServer = "nushell";
|
||||
servers = {
|
||||
nushell = {
|
||||
package = pkgs.nushell;
|
||||
lspConfig = ''
|
||||
lspconfig.nushell.setup{
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/nu", "--no-config-file", "--lsp"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.vim.languages.nu;
|
||||
in {
|
||||
options.vim.languages.nu = {
|
||||
enable = mkEnableOption "Nu language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Nu treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "nu";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
server = mkOption {
|
||||
type = str;
|
||||
default = defaultServer;
|
||||
description = "Nu LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
example = ''[(lib.getExe pkgs.nushell) "--lsp"]'';
|
||||
description = "Nu LSP server package, or the command to run as a list of strings";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.nu-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ in {
|
|||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "lldb pacakge";
|
||||
description = "lldb package";
|
||||
type = package;
|
||||
default = pkgs.lldb;
|
||||
};
|
||||
|
|
@ -145,13 +145,13 @@ in {
|
|||
on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
|
||||
vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
|
||||
vim.keymap.set("n", "<localleader>rr", ":RustLsp runnables<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rp", ":RustLsp parentModule<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rc", ":RustLsp openCargo", opts)
|
||||
vim.keymap.set("n", "<localleader>rg", ":RustLsp crateGraph x11", opts)
|
||||
${optionalString cfg.dap.enable ''
|
||||
vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
|
||||
vim.keymap.set("n", "<localleader>rd", ":RustLsp debuggables<cr>", opts)
|
||||
vim.keymap.set(
|
||||
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||
function()
|
||||
|
|
|
|||
|
|
@ -181,8 +181,10 @@ in {
|
|||
extensions = {
|
||||
ts-error-translator = {
|
||||
enable = mkEnableOption ''
|
||||
Typescript error translation with
|
||||
[ts-error-translator.nvim](github.com/dmmulroy/ts-error-translator.nvim)
|
||||
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
||||
|
||||
Typescript error translation with [ts-error-translator.nvim]
|
||||
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "ts-error-translator" {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@
|
|||
lspConfig = ''
|
||||
lspconfig.typst_lsp.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
on_attach = function(client, bufnr)
|
||||
-- Disable semantic tokens as a workaround for a semantic token error when using non-english characters
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
|
|
@ -35,7 +38,11 @@
|
|||
lspConfig = ''
|
||||
lspconfig.tinymist.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach,
|
||||
single_file_support = true,
|
||||
on_attach = function(client, bufnr)
|
||||
-- Disable semantic tokens as a workaround for a semantic token error when using non-english characters
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ in {
|
|||
default_timeout = mkOption {
|
||||
type = int;
|
||||
default = 5000;
|
||||
description = "Default timeout value, in miliseconds";
|
||||
description = "Default timeout value, in milliseconds";
|
||||
};
|
||||
|
||||
sources = mkOption {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ in {
|
|||
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 stting the filetype
|
||||
executed without setting the filetype
|
||||
'';
|
||||
};
|
||||
write_to_disk = mkOption {
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
||||
inherit (lib.nvim.binds) mkKeymap pushDownDefault;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
mappingDefinitions = options.vim.lsp.trouble.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
|
||||
inherit (options.vim.lsp.trouble) mappings;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||
vim = {
|
||||
|
|
@ -21,19 +20,18 @@ in {
|
|||
|
||||
cmd = "Trouble";
|
||||
keys = [
|
||||
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||
(mkKeymap "n" cfg.trouble.mappings.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>" {desc = mappings.workspaceDiagnostics.description;})
|
||||
(mkKeymap "n" cfg.trouble.mappings.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>" {desc = mappings.documentDiagnostics.description;})
|
||||
(mkKeymap "n" cfg.trouble.mappings.lspReferences "<cmd>Trouble toggle lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
||||
(mkKeymap "n" cfg.trouble.mappings.quickfix "<cmd>Trouble toggle quickfix<CR>" {desc = mappings.quickfix.description;})
|
||||
(mkKeymap "n" cfg.trouble.mappings.locList "<cmd>Trouble toggle loclist<CR>" {desc = mappings.locList.description;})
|
||||
(mkKeymap "n" cfg.trouble.mappings.symbols "<cmd>Trouble toggle symbols<CR>" {desc = mappings.symbols.description;})
|
||||
];
|
||||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>l" = "Trouble";
|
||||
"<leader>x" = "+Trouble";
|
||||
"<leader>lw" = "Workspace";
|
||||
"<leader>lw" = "+Workspace";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ in {
|
|||
setupOpts = mkPluginSetupOption "Trouble" {};
|
||||
|
||||
mappings = {
|
||||
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
|
||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
||||
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
||||
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
||||
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
||||
symbols = mkMappingOption "Symbols [trouble]" "<leader>xs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ in {
|
|||
migration is required.
|
||||
|
||||
Please see neocord documentation and options page on the **nvf** manual
|
||||
for mor einformation
|
||||
for more information
|
||||
'')
|
||||
]
|
||||
++ (map
|
||||
|
|
|
|||
5
modules/plugins/runner/default.nix
Normal file
5
modules/plugins/runner/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./run-nvim
|
||||
];
|
||||
}
|
||||
38
modules/plugins/runner/run-nvim/config.nix
Normal file
38
modules/plugins/runner/run-nvim/config.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding mkSetLuaLznBinding;
|
||||
|
||||
cfg = config.vim.runner.run-nvim;
|
||||
mappingDefinitions = options.vim.runner.run-nvim.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
lazy.plugins.run-nvim = {
|
||||
package = "run-nvim";
|
||||
setupModule = "run";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = "Run";
|
||||
|
||||
keys = [
|
||||
(mkSetLznBinding "n" mappings.run "<cmd>Run<CR>")
|
||||
(mkSetLznBinding "n" mappings.runOverride "<cmd>Run!<CR>")
|
||||
(mkSetLuaLznBinding "n" mappings.runCommand ''
|
||||
function()
|
||||
local input = vim.fn.input("Run command: ")
|
||||
if input ~= "" then require("run").run(input, false) end
|
||||
end
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
binds.whichKey.register."<leader>r" = mkDefault "+Run";
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/runner/run-nvim/default.nix
Normal file
6
modules/plugins/runner/run-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./run-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
18
modules/plugins/runner/run-nvim/run-nvim.nix
Normal file
18
modules/plugins/runner/run-nvim/run-nvim.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options = {
|
||||
vim.runner.run-nvim = {
|
||||
enable = mkEnableOption "run.nvim";
|
||||
setupOpts = mkPluginSetupOption "run.nvim" {};
|
||||
|
||||
mappings = {
|
||||
run = mkMappingOption "Run cached" "<leader>ri";
|
||||
runOverride = mkMappingOption "Run and override" "<leader>ro";
|
||||
runCommand = mkMappingOption "Run prompt" "<leader>rc";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ in {
|
|||
autosave_ignore_buftypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "All buffers of these bufer types will be closed before the session is saved";
|
||||
description = "All buffers of these buffer types will be closed before the session is saved";
|
||||
};
|
||||
|
||||
autosave_only_in_session = mkOption {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ in {
|
|||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to allow highlight groups to be overriden.
|
||||
Whether or not to allow highlight groups to be overridden.
|
||||
|
||||
While false, bufferline.nvim sets highlights as default.
|
||||
'';
|
||||
|
|
@ -101,7 +101,7 @@ in {
|
|||
The indicatotor icon to use for the current buffer.
|
||||
|
||||
::: {.warning}
|
||||
This **must** be ommitted while style is not `icon`
|
||||
This **must** be omitted while style is not `icon`
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
|
@ -338,17 +338,6 @@ in {
|
|||
description = "Whether or not the move command \"wraps\" at the first or last position";
|
||||
};
|
||||
|
||||
seperator_style = mkOption {
|
||||
type = either (enum ["thick" "thin" "slope" "slant"]) (listOf str);
|
||||
default = [" " " "];
|
||||
description = ''
|
||||
Style of the buffer separator.
|
||||
|
||||
Can be either one of the suspported values, or a list containing
|
||||
**at most** two elements for `focused` and `unfocused` respectively.
|
||||
'';
|
||||
};
|
||||
|
||||
separator_style = mkOption {
|
||||
type = nullOr (either (enum ["slant" "padded_slant" "slope" "padded_slope" "thick" "thin"]) (listOf str));
|
||||
default = "thin";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
inherit (lib.lists) optional;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.terminal.toggleterm;
|
||||
|
|
@ -19,9 +19,10 @@ in {
|
|||
package = "toggleterm-nvim";
|
||||
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
|
||||
keys =
|
||||
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
||||
[(mkKeymap "n" cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" {desc = "Toggle terminal";})]
|
||||
++ optional cfg.lazygit.enable {
|
||||
key = cfg.lazygit.mappings.open;
|
||||
mode = "n";
|
||||
desc = lazygitMapDesc;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ in {
|
|||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
...
|
||||
}: let
|
||||
style' =
|
||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||
|
|
@ -117,6 +118,7 @@ in {
|
|||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
-- Gruvbox theme
|
||||
require("gruvbox").setup({
|
||||
|
|
@ -152,6 +154,7 @@ in {
|
|||
setup = {
|
||||
style ? "main",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
require("rose-pine").setup({
|
||||
dark_variant = "${style}", -- main, moon, or dawn
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
multilineThreshold = "multiline_threshold";
|
||||
trimScope = "trim_scope";
|
||||
mode = "mode";
|
||||
seperator = "separator";
|
||||
separator = "separator";
|
||||
zindex = "z_index";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
in {
|
||||
options.vim.utility.motion.hop = {
|
||||
mappings = {
|
||||
hop = mkMappingOption "Jump to occurences [hop.nvim]" "<leader>h";
|
||||
hop = mkMappingOption "Jump to occurrences [hop.nvim]" "<leader>h";
|
||||
};
|
||||
|
||||
enable = mkEnableOption "Hop.nvim plugin (easy motion)";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.utility.motion.leap;
|
||||
in {
|
||||
|
|
@ -14,11 +14,11 @@ in {
|
|||
lazy.plugins.leap-nvim = {
|
||||
package = "leap-nvim";
|
||||
keys = [
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" {desc = "Leap forward to";})
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" {desc = "Leap backward to";})
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" {desc = "Leap forward till";})
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" {desc = "Leap backward till";})
|
||||
(mkKeymap ["n" "o" "x"] cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" {desc = "Leap from window";})
|
||||
];
|
||||
|
||||
after = ''
|
||||
|
|
|
|||
|
|
@ -5,15 +5,14 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.nvim.binds) pushDownDefault mkSetLznBinding;
|
||||
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||
|
||||
cfg = config.vim.telescope;
|
||||
mappingDefinitions = options.vim.telescope.mappings;
|
||||
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
keys = cfg.mappings;
|
||||
inherit (options.vim.telescope) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
|
@ -34,38 +33,35 @@ in {
|
|||
|
||||
keys =
|
||||
[
|
||||
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
||||
(mkKeymap "n" keys.findFiles "<cmd>Telescope find_files<CR>" {desc = mappings.findFiles.description;})
|
||||
(mkKeymap "n" keys.liveGrep "<cmd>Telescope live_grep<CR>" {desc = mappings.liveGrep.description;})
|
||||
(mkKeymap "n" keys.buffers "<cmd>Telescope buffers<CR>" {desc = mappings.buffers.description;})
|
||||
(mkKeymap "n" keys.helpTags "<cmd>Telescope help_tags<CR>" {desc = mappings.helpTags.description;})
|
||||
(mkKeymap "n" keys.open "<cmd>Telescope<CR>" {desc = mappings.open.description;})
|
||||
(mkKeymap "n" keys.resume "<cmd>Telescope resume<CR>" {desc = mappings.resume.description;})
|
||||
|
||||
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||
(mkKeymap "n" keys.gitCommits "<cmd>Telescope git_commits<CR>" {desc = mappings.gitCommits.description;})
|
||||
(mkKeymap "n" keys.gitBufferCommits "<cmd>Telescope git_bcommits<CR>" {desc = mappings.gitBufferCommits.description;})
|
||||
(mkKeymap "n" keys.gitBranches "<cmd>Telescope git_branches<CR>" {desc = mappings.gitBranches.description;})
|
||||
(mkKeymap "n" keys.gitStatus "<cmd>Telescope git_status<CR>" {desc = mappings.gitStatus.description;})
|
||||
(mkKeymap "n" keys.gitStash "<cmd>Telescope git_stash<CR>" {desc = mappings.gitStash.description;})
|
||||
]
|
||||
++ (optionals config.vim.lsp.enable [
|
||||
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||
(mkKeymap "n" keys.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>" {desc = mappings.lspDocumentSymbols.description;})
|
||||
(mkKeymap "n" keys.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>" {desc = mappings.lspWorkspaceSymbols.description;})
|
||||
|
||||
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||
(mkKeymap "n" keys.lspReferences "<cmd>Telescope lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
||||
(mkKeymap "n" keys.lspImplementations "<cmd>Telescope lsp_implementations<CR>" {desc = mappings.lspImplementations.description;})
|
||||
(mkKeymap "n" keys.lspDefinitions "<cmd>Telescope lsp_definitions<CR>" {desc = mappings.lspDefinitions.description;})
|
||||
(mkKeymap "n" keys.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>" {desc = mappings.lspTypeDefinitions.description;})
|
||||
(mkKeymap "n" keys.diagnostics "<cmd>Telescope diagnostics<CR>" {desc = mappings.diagnostics.description;})
|
||||
])
|
||||
++ (
|
||||
optionals config.vim.treesitter.enable [
|
||||
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||
]
|
||||
)
|
||||
++ (
|
||||
optionals config.vim.projects.project-nvim.enable [
|
||||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||
]
|
||||
);
|
||||
++ optionals config.vim.treesitter.enable [
|
||||
(mkKeymap "n" keys.treesitter "<cmd>Telescope treesitter<CR>" {desc = mappings.treesitter.description;})
|
||||
]
|
||||
++ optionals config.vim.projects.project-nvim.enable [
|
||||
(mkKeymap "n" keys.findProjects "<cmd>Telescope projects<CR>" {desc = mappings.findProjects.description;})
|
||||
];
|
||||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
default = ["absolute"];
|
||||
};
|
||||
set_env = mkOption {
|
||||
description = "Set an envrionment for term_previewer";
|
||||
description = "Set an environment for term_previewer";
|
||||
type = attrsOf str;
|
||||
default = {
|
||||
COLORTERM = "truecolor";
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep;
|
||||
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep tryEval;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryBefore entryAfter;
|
||||
cfg = config.vim.lazy;
|
||||
|
||||
toLuaLznKeySpec = keySpec:
|
||||
|
|
@ -22,10 +21,45 @@
|
|||
else keySpec.action;
|
||||
};
|
||||
|
||||
toLuaLznSpec = name: spec:
|
||||
toLuaLznSpec = name: spec: let
|
||||
packageName =
|
||||
if typeOf spec.package == "string"
|
||||
then spec.package
|
||||
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
||||
then spec.package.pname
|
||||
else spec.package.name;
|
||||
in
|
||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||
// {
|
||||
"@1" = name;
|
||||
"@1" =
|
||||
if spec.package != null && packageName != name && spec.load == null
|
||||
then
|
||||
abort ''
|
||||
vim.lazy.plugins.${name} does not match the package name ${packageName}.
|
||||
|
||||
Please either:
|
||||
- rename it to vim.lazy.plugins.${packageName}, or
|
||||
- if you intend to use a custom loader, specify a
|
||||
vim.lazy.plugins.${name}.load function.
|
||||
''
|
||||
else if spec.package == null && spec.load == null
|
||||
then
|
||||
abort ''
|
||||
vim.lazy.plugins.${name} has null package but no load function given.
|
||||
|
||||
Please either specify a package, or (if you know what you're doing) provide a
|
||||
custom load function.
|
||||
''
|
||||
else name;
|
||||
beforeAll =
|
||||
if spec.beforeAll != null
|
||||
then
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${spec.beforeAll}
|
||||
end
|
||||
''
|
||||
else null;
|
||||
before =
|
||||
if spec.before != null
|
||||
then
|
||||
|
|
@ -50,6 +84,16 @@
|
|||
end
|
||||
'';
|
||||
|
||||
load =
|
||||
if spec.load != null
|
||||
then
|
||||
mkLuaInline ''
|
||||
function(name)
|
||||
${spec.load}
|
||||
end
|
||||
''
|
||||
else null;
|
||||
|
||||
keys =
|
||||
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
||||
|
|
@ -58,7 +102,7 @@
|
|||
};
|
||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||
|
||||
pluginPackages = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||
pluginPackages = filter (x: x != null) (mapAttrsToList (_: plugin: plugin.package) cfg.plugins);
|
||||
|
||||
specToNotLazyConfig = _: spec: ''
|
||||
do
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@
|
|||
'';
|
||||
|
||||
desc = mkOption {
|
||||
description = "Description of the key map";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Description of the key map";
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "TBD";
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = "TBD";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
description = "Modes to bind in";
|
||||
type = either str (listOf str);
|
||||
default = ["n" "x" "s" "o"];
|
||||
example = ["n" "x" "o"];
|
||||
description = "Modes to bind in";
|
||||
};
|
||||
|
||||
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||
|
|
@ -48,93 +48,95 @@
|
|||
};
|
||||
};
|
||||
|
||||
lznEvent = submodule {
|
||||
options = {
|
||||
event = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
example = "BufEnter";
|
||||
description = "Exact event name";
|
||||
};
|
||||
pattern = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
example = "BufEnter *.lua";
|
||||
description = "Event pattern";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lznPluginType = submodule {
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = "Plugin package";
|
||||
type = nullOr pluginType;
|
||||
description = ''
|
||||
Plugin package.
|
||||
|
||||
If null, a custom load function must be provided
|
||||
'';
|
||||
};
|
||||
|
||||
setupModule = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua module to run setup function on.";
|
||||
default = null;
|
||||
description = "Lua module to run setup function on.";
|
||||
};
|
||||
|
||||
setupOpts = mkOption {
|
||||
type = attrsOf anything;
|
||||
description = "Options to pass to the setup function";
|
||||
default = {};
|
||||
description = "Options to pass to the setup function";
|
||||
};
|
||||
|
||||
# lz.n options
|
||||
|
||||
enabled = mkOption {
|
||||
type = nullOr (either bool str);
|
||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||
default = null;
|
||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||
};
|
||||
|
||||
beforeAll = mkOption {
|
||||
type = nullOr lines;
|
||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||
};
|
||||
|
||||
before = mkOption {
|
||||
type = nullOr lines;
|
||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||
};
|
||||
|
||||
after = mkOption {
|
||||
type = nullOr lines;
|
||||
default = null;
|
||||
description = ''
|
||||
Lua code to run after plugin is loaded. This will be wrapped in a function.
|
||||
|
||||
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
event = mkOption {
|
||||
description = "Lazy-load on event";
|
||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
||||
default = null;
|
||||
type = let
|
||||
event = submodule {
|
||||
options = {
|
||||
event = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Exact event name";
|
||||
example = "BufEnter";
|
||||
};
|
||||
pattern = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Event pattern";
|
||||
example = "BufEnter *.lua";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
nullOr (oneOf [str (listOf str) event]);
|
||||
description = "Lazy-load on event";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
description = "Lazy-load on command";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
description = "Lazy-load on command";
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "Lazy-load on filetype";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
description = "Lazy-load on filetype";
|
||||
};
|
||||
|
||||
keys = mkOption {
|
||||
description = "Lazy-load on key mapping";
|
||||
default = null;
|
||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||
default = null;
|
||||
example = ''
|
||||
keys = [
|
||||
{
|
||||
|
|
@ -152,20 +154,21 @@
|
|||
}
|
||||
]
|
||||
'';
|
||||
description = "Lazy-load on key mapping";
|
||||
};
|
||||
|
||||
colorscheme = mkOption {
|
||||
description = "Lazy-load on colorscheme.";
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
description = "Lazy-load on colorscheme.";
|
||||
};
|
||||
|
||||
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
||||
|
||||
priority = mkOption {
|
||||
type = nullOr int;
|
||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||
default = null;
|
||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||
};
|
||||
|
||||
load = mkOption {
|
||||
|
|
@ -174,7 +177,7 @@
|
|||
description = ''
|
||||
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
||||
|
||||
This will be wrapped in a function.
|
||||
This will be wrapped in a `function(name) ... end`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
@ -183,20 +186,14 @@ in {
|
|||
options.vim.lazy = {
|
||||
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
|
||||
loader = mkOption {
|
||||
description = "Lazy loader to use";
|
||||
type = enum ["lz.n"];
|
||||
default = "lz.n";
|
||||
description = "Lazy loader to use";
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
default = {};
|
||||
type = attrsOf lznPluginType;
|
||||
description = ''
|
||||
Plugins to lazy load.
|
||||
|
||||
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
|
||||
function this should be either the `package.pname` or `package.name`.
|
||||
'';
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
toggleterm-nvim = {
|
||||
|
|
@ -214,15 +211,21 @@ in {
|
|||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Plugins to lazy load.
|
||||
|
||||
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
|
||||
function this should be either the `package.pname` or `package.name`.
|
||||
'';
|
||||
};
|
||||
|
||||
enableLznAutoRequire = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
|
||||
off for debugging.
|
||||
'';
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
builtLazyConfig = mkOption {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) str attrs lines listOf either path;
|
||||
inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything;
|
||||
inherit (lib.nvim.types) dagOf;
|
||||
inherit (lib.nvim.lua) listToLuaTable;
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ in {
|
|||
|
||||
::: {.warning}
|
||||
All paths passed to this option must be valid. If Neovim cannot
|
||||
resolve the path you are attempting to sourcee, then your configuration
|
||||
resolve the path you are attempting to source, then your configuration
|
||||
will error, and Neovim will not start. Please ensure that all paths
|
||||
are correct before using this option.
|
||||
:::
|
||||
|
|
@ -100,8 +100,24 @@ in {
|
|||
};
|
||||
|
||||
globals = mkOption {
|
||||
type = attrs;
|
||||
default = {};
|
||||
type = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = {
|
||||
mapleader = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The key used for `<leader>` mappings";
|
||||
};
|
||||
|
||||
maplocalleader = mkOption {
|
||||
type = str;
|
||||
default = ",";
|
||||
description = "The key used for `<localleader>` mappings";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
example = {"some_variable" = 42;};
|
||||
description = ''
|
||||
An attribute set containing global variable values
|
||||
|
|
@ -119,8 +135,80 @@ in {
|
|||
};
|
||||
|
||||
options = mkOption {
|
||||
type = attrs;
|
||||
default = {};
|
||||
type = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = {
|
||||
termguicolors = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Set terminal up for 256 colours";
|
||||
};
|
||||
|
||||
mouse = mkOption {
|
||||
type = enum ["a" "n" "v" "i" "c"];
|
||||
default = "a";
|
||||
description = ''
|
||||
Set modes for mouse support.
|
||||
|
||||
* a - all
|
||||
* n - normal
|
||||
* v - visual
|
||||
* i - insert
|
||||
* c - command
|
||||
'';
|
||||
};
|
||||
|
||||
cmdheight = mkOption {
|
||||
type = int;
|
||||
default = 1;
|
||||
description = "Height of the command pane";
|
||||
};
|
||||
|
||||
updatetime = mkOption {
|
||||
type = int;
|
||||
default = 300;
|
||||
description = "The number of milliseconds till Cursor Hold event is fired";
|
||||
};
|
||||
|
||||
tm = mkOption {
|
||||
type = int;
|
||||
default = 500;
|
||||
description = "Timeout in ms that Neovim will wait for mapped action to complete";
|
||||
};
|
||||
|
||||
cursorlineopt = mkOption {
|
||||
type = enum ["line" "screenline" "number" "both"];
|
||||
default = "line";
|
||||
description = "Highlight the text line of the cursor with CursorLine hl-CursorLine";
|
||||
};
|
||||
|
||||
splitbelow = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "New splits will open below instead of on top";
|
||||
};
|
||||
|
||||
splitright = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "New splits will open to the right";
|
||||
};
|
||||
|
||||
autoindent = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable auto indent";
|
||||
};
|
||||
|
||||
wrap = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Enable word wrapping.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
example = {visualbell = true;};
|
||||
description = ''
|
||||
An attribute set containing vim options to be set
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue