mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
1 commit
a6ca5b7876
...
856e38513a
Author | SHA1 | Date | |
---|---|---|---|
856e38513a |
15 changed files with 102 additions and 138 deletions
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"mnw": {
|
||||
"locked": {
|
||||
"lastModified": 1731821965,
|
||||
"narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=",
|
||||
"lastModified": 1731182209,
|
||||
"narHash": "sha256-yftvwv8bHEKjmSKREdkGLWTDhf7vA2Ssvl/XMpykigg=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "mnw",
|
||||
"rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e",
|
||||
"rev": "0a5e50286ca9f1b70eb4fa29ce84304cad657700",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
16
flake.nix
16
flake.nix
|
@ -21,7 +21,6 @@
|
|||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
./flake/packages.nix
|
||||
./flake/develop.nix
|
||||
];
|
||||
|
||||
flake = {
|
||||
|
@ -53,7 +52,20 @@
|
|||
};
|
||||
};
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
perSystem = {
|
||||
self',
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||
lsp = pkgs.mkShell {
|
||||
packages = with pkgs; [nil statix deadnix alejandra];
|
||||
};
|
||||
};
|
||||
|
||||
# Provide the default formatter. `nix fmt` in project root
|
||||
# will format available files with the correct formatter.
|
||||
# P.S: Please do not format with nixfmt! It messes with many
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
{lib, ...}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
self',
|
||||
...
|
||||
}: {
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
|
||||
lsp = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [nil statix deadnix alejandra];
|
||||
};
|
||||
};
|
||||
|
||||
# This package exists to make development easier by providing the place and
|
||||
# boilerplate to build a test nvf configuration. Feel free to use this for
|
||||
# testing, but make sure to discard the changes before creating a pull
|
||||
# request.
|
||||
packages.dev = let
|
||||
configuration = {};
|
||||
|
||||
customNeovim = lib.nvim.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [configuration];
|
||||
};
|
||||
in
|
||||
customNeovim.neovim;
|
||||
};
|
||||
}
|
|
@ -79,14 +79,14 @@
|
|||
expr = true;
|
||||
};
|
||||
|
||||
mkSetLznBinding = mode: binding: action: {
|
||||
inherit action mode;
|
||||
mkSetLznBinding = binding: action: {
|
||||
inherit action;
|
||||
key = binding.value;
|
||||
desc = binding.description;
|
||||
};
|
||||
|
||||
mkSetLuaLznBinding = mode: binding: action: {
|
||||
inherit action mode;
|
||||
mkSetLuaLznBinding = binding: action: {
|
||||
inherit action;
|
||||
key = binding.value;
|
||||
lua = true;
|
||||
desc = binding.description;
|
||||
|
|
|
@ -54,10 +54,5 @@ in {
|
|||
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.
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
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:
|
||||
|
@ -83,9 +81,10 @@ in {
|
|||
setupOpts = {
|
||||
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
||||
|
||||
window = mkIf borders.enable {
|
||||
completion.border = borders.style;
|
||||
documentation.border = borders.style;
|
||||
# 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()";
|
||||
};
|
||||
|
||||
formatting.format = cfg.format;
|
||||
|
|
|
@ -72,7 +72,7 @@ in {
|
|||
};
|
||||
|
||||
format = mkOption {
|
||||
type = nullOr luaInline;
|
||||
type = luaInline;
|
||||
default = mkLuaInline ''
|
||||
function(entry, vim_item)
|
||||
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
||||
|
|
|
@ -60,7 +60,7 @@ in {
|
|||
inherit (cfg.ui) setupOpts;
|
||||
|
||||
keys = [
|
||||
(mkSetLuaLznBinding "n" mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -21,18 +21,19 @@ in {
|
|||
|
||||
cmd = "Trouble";
|
||||
keys = [
|
||||
(mkSetLznBinding "n" mappings.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>")
|
||||
(mkSetLznBinding "n" mappings.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>")
|
||||
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Trouble toggle lsp_references<CR>")
|
||||
(mkSetLznBinding "n" mappings.quickfix "<cmd>Trouble toggle quickfix<CR>")
|
||||
(mkSetLznBinding "n" mappings.locList "<cmd>Trouble toggle loclist<CR>")
|
||||
(mkSetLznBinding "n" mappings.symbols "<cmd>Trouble toggle symbols<CR>")
|
||||
(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>")
|
||||
];
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,7 +22,6 @@ in {
|
|||
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
||||
++ optional cfg.lazygit.enable {
|
||||
key = cfg.lazygit.mappings.open;
|
||||
mode = "n";
|
||||
desc = lazygitMapDesc;
|
||||
};
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ in {
|
|||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
...
|
||||
}: let
|
||||
style' =
|
||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||
|
@ -118,7 +117,6 @@ in {
|
|||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
-- Gruvbox theme
|
||||
require("gruvbox").setup({
|
||||
|
@ -154,7 +152,6 @@ in {
|
|||
setup = {
|
||||
style ? "main",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
require("rose-pine").setup({
|
||||
dark_variant = "${style}", -- main, moon, or dawn
|
||||
|
|
|
@ -34,37 +34,36 @@ in {
|
|||
|
||||
keys =
|
||||
[
|
||||
(mkSetLznBinding "n" mappings.findFiles "<cmd>Telescope find_files<CR>")
|
||||
(mkSetLznBinding "n" mappings.liveGrep "<cmd>Telescope live_grep<CR>")
|
||||
(mkSetLznBinding "n" mappings.buffers "<cmd>Telescope buffers<CR>")
|
||||
(mkSetLznBinding "n" mappings.helpTags "<cmd>Telescope help_tags<CR>")
|
||||
(mkSetLznBinding "n" mappings.open "<cmd>Telescope<CR>")
|
||||
(mkSetLznBinding "n" mappings.resume "<cmd>Telescope resume<CR>")
|
||||
(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>")
|
||||
|
||||
(mkSetLznBinding "n" mappings.gitCommits "<cmd>Telescope git_commits<CR>")
|
||||
(mkSetLznBinding "n" mappings.gitBufferCommits "<cmd>Telescope git_bcommits<CR>")
|
||||
(mkSetLznBinding "n" mappings.gitBranches "<cmd>Telescope git_branches<CR>")
|
||||
(mkSetLznBinding "n" mappings.gitStatus "<cmd>Telescope git_status<CR>")
|
||||
(mkSetLznBinding "n" mappings.gitStash "<cmd>Telescope git_stash<CR>")
|
||||
(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>")
|
||||
]
|
||||
++ (optionals config.vim.lsp.enable [
|
||||
(mkSetLznBinding "n" mappings.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>")
|
||||
(mkSetLznBinding "n" mappings.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>")
|
||||
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||
|
||||
(mkSetLznBinding "n" mappings.lspReferences "<cmd>Telescope lsp_references<CR>")
|
||||
(mkSetLznBinding "n" mappings.lspImplementations "<cmd>Telescope lsp_implementations<CR>")
|
||||
(mkSetLznBinding "n" mappings.lspDefinitions "<cmd>Telescope lsp_definitions<CR>")
|
||||
(mkSetLznBinding "n" mappings.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>")
|
||||
(mkSetLznBinding "n" mappings.diagnostics "<cmd>Telescope diagnostics<CR>")
|
||||
(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>")
|
||||
])
|
||||
++ (
|
||||
optionals config.vim.treesitter.enable [
|
||||
(mkSetLznBinding "n" mappings.treesitter "<cmd>Telescope treesitter<CR>")
|
||||
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||
]
|
||||
)
|
||||
++ (
|
||||
optionals config.vim.projects.project-nvim.enable [
|
||||
(mkSetLznBinding "n" mappings.findProjects "<cmd>Telescope projects<CR>")
|
||||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||
]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
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:
|
||||
|
@ -49,16 +50,6 @@
|
|||
end
|
||||
'';
|
||||
|
||||
load =
|
||||
if spec.load != null
|
||||
then
|
||||
mkLuaInline ''
|
||||
funcion()
|
||||
${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)
|
||||
|
|
|
@ -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 {
|
||||
type = either str (listOf str);
|
||||
example = ["n" "x" "o"];
|
||||
description = "Modes to bind in";
|
||||
type = either str (listOf str);
|
||||
default = ["n" "x" "s" "o"];
|
||||
};
|
||||
|
||||
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||
|
@ -48,21 +48,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
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 {
|
||||
|
@ -72,67 +57,84 @@
|
|||
|
||||
setupModule = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Lua module to run setup function on.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
setupOpts = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = {};
|
||||
description = "Options to pass to the setup function";
|
||||
default = {};
|
||||
};
|
||||
|
||||
# lz.n options
|
||||
|
||||
enabled = mkOption {
|
||||
type = nullOr (either bool str);
|
||||
default = null;
|
||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||
default = null;
|
||||
};
|
||||
|
||||
beforeAll = mkOption {
|
||||
type = nullOr lines;
|
||||
default = null;
|
||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
before = mkOption {
|
||||
type = nullOr lines;
|
||||
default = null;
|
||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
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 {
|
||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
||||
default = null;
|
||||
description = "Lazy-load on event";
|
||||
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]);
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
description = "Lazy-load on command";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
description = "Lazy-load on filetype";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
keys = mkOption {
|
||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||
description = "Lazy-load on key mapping";
|
||||
default = null;
|
||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||
example = ''
|
||||
keys = [
|
||||
{
|
||||
|
@ -150,21 +152,20 @@
|
|||
}
|
||||
]
|
||||
'';
|
||||
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;
|
||||
default = null;
|
||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
load = mkOption {
|
||||
|
@ -182,14 +183,20 @@ 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 {
|
||||
type = attrsOf lznPluginType;
|
||||
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`.
|
||||
'';
|
||||
example = ''
|
||||
{
|
||||
toggleterm-nvim = {
|
||||
|
@ -207,21 +214,15 @@ 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 {
|
||||
|
|
Loading…
Reference in a new issue