Merge branch 'NotAShelf:v0.7' into v0.7

This commit is contained in:
DamitusThyYeetus123 2024-12-03 09:13:34 +11:00 committed by GitHub
commit 234ad31909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
101 changed files with 1973 additions and 2115 deletions

View file

@ -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)" {})

View file

@ -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 = {

View file

@ -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;})
];
};
};

View file

@ -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;

View file

@ -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.

View file

@ -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;
};

View file

@ -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;})
];
};

View file

@ -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.";

View file

@ -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,
})
'');
};
};
}

View file

@ -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";
};
};
};
};
}

View file

@ -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")''}

View file

@ -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 = {

View 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;
})
]);
}

View 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;
})
]);
}

View file

@ -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()

View file

@ -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" {

View file

@ -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

View file

@ -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 {

View file

@ -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 {

View file

@ -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";
};
};
};

View file

@ -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";
};
};
};

View file

@ -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

View file

@ -0,0 +1,5 @@
{
imports = [
./run-nvim
];
}

View 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";
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./run-nvim.nix
./config.nix
];
}

View 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";
};
};
};
}

View file

@ -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 {

View file

@ -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";

View file

@ -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;
};

View file

@ -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

View file

@ -10,7 +10,7 @@
multilineThreshold = "multiline_threshold";
trimScope = "trim_scope";
mode = "mode";
seperator = "separator";
separator = "separator";
zindex = "z_index";
};

View file

@ -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)";

View file

@ -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 = ''

View file

@ -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 {

View file

@ -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";