1
Fork 0

Move more nvim modules to nix

This commit is contained in:
Matei Adriel 2023-12-02 12:16:33 +01:00
parent 91eb12343c
commit 445c5965c6
No known key found for this signature in database
6 changed files with 239 additions and 121 deletions
home/features/neovim

View file

@ -13,7 +13,7 @@
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
"dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" },
"flash": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
"github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
@ -31,7 +31,7 @@
"lean.nvim": { "branch": "main", "commit": "67580fab5bed73920fa3fdd712fc8e805c389c3d" },
"live-command.nvim": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"lualine": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" },
"mini.files": { "branch": "main", "commit": "dea80a8147aa4e3025c34d2e2aaa6f2aeb7b21dd" },
"mini.operators": { "branch": "main", "commit": "15f137f28412517e2248d39cf0663bd3a87aa24a" },
@ -72,5 +72,6 @@
"vim-wakatime": { "branch": "master", "commit": "018fa9a80c27ccf2a8967b9e27890372e5c2fb4f" },
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
"winbar": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" },
"yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }
}

View file

@ -2,7 +2,7 @@ local function makeEnv(cond)
return {
-- I am doing this to get type hints!
active = function()
return cond
return cond()
end,
not_active = function()
return not cond()
@ -20,7 +20,7 @@ local function makeEnv(cond)
}
end
return {
local M = {
vscode = makeEnv(function()
return vim.g.vscode ~= nil
end),
@ -41,3 +41,15 @@ return {
end)
end,
}
M.blacklist = function(list)
for _, key in pairs(list) do
if M[key].active() then
return false
end
end
return true
end
return M

View file

@ -1,36 +0,0 @@
local function keybind(keys, action, desc, modes)
if modes == nil then
modes = { "n", "x", "o" }
end
return {
keys,
mode = modes,
function()
require("flash")[action]()
end,
desc = desc,
}
end
local M = {
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {
modes = {
char = {
enabled = false,
},
},
},
keys = {
keybind("s", "jump", "Flash"),
keybind("S", "treesitter", "Flash Treesitter"),
keybind("r", "remote", "Remote Flash", { "o" }),
keybind("R", "treesitter_search", "Treesitter Search", { "o", "x" }),
keybind("<C-S>", "toggle", "Toggle Flash Search", { "c" }),
},
}
return M

View file

@ -1,32 +0,0 @@
local env = require("my.helpers.env")
local M = {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
cond = env.vscode.not_active() and env.firenvim.not_active(),
}
function M.config()
require("lualine").setup({
options = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
theme = "auto",
disabled_filetypes = {
"undotree",
},
},
sections = {
lualine_a = { "branch" },
lualine_b = { "filename" },
lualine_c = { "filetype" },
lualine_x = { "diagnostics" },
lualine_y = {},
lualine_z = {},
},
-- Integration with other plugins
extensions = { "nvim-tree" },
})
end
return M

View file

@ -144,6 +144,8 @@ let
extraArgs = "--set GIT_DISCOVERY_ACROSS_FILESYSTEM 1";
};
# }}}
nlib = config.satellite.neovim.lib;
in
{
# {{{ Basic config
@ -208,12 +210,82 @@ in
# }}}
# {{{ Custom module testing
satellite.neovim.styluaConfig = ../../../stylua.toml;
satellite.neovim.env.module = "my.helpers.env";
# {{{ Nvim-tree
satellite.neovim.lazy.nvim-tree = {
setup = true;
package = "kyazdani42/nvim-tree.lua";
setup = true;
keys.mapping = "<C-n>";
keys.desc = "Toggle [n]vim-tree";
keys.action = "<cmd>NvimTreeToggle<cr>";
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
};
# }}}
# {{{ Lualine
satellite.neovim.lazy.lualine = {
package = "nvim-lualine/lualine.nvim";
name = "lualine";
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
event = "VeryLazy";
opts = {
options = {
component_separators = { left = ""; right = ""; };
section_separators = { left = ""; right = ""; };
theme = "auto";
disabled_filetypes = [ "undotree" ];
};
sections = {
lualine_a = [ "branch" ];
lualine_b = [ "filename" ];
lualine_c = [ "filetype" ];
lualine_x = [ "diagnostics" "diff" ];
lualine_y = [ ];
lualine_z = [ ];
};
# Integration with other plugins
extensions = [ "nvim-tree" ];
};
};
# }}}
# {{{ Winbar
satellite.neovim.lazy.winbar = {
package = "fgheng/winbar.nvim";
name = "winbar";
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
event = "VeryLazy";
opts.enabled = true;
};
# }}}
# {{{ Flash
satellite.neovim.lazy.flash = {
package = "folke/flash.nvim";
name = "flash";
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
keys =
let keybind = mode: mapping: action: desc: {
inherit mapping desc mode;
action = nlib.lua ''function () require("flash").${action}() end'';
};
in
[
(keybind "nxo" "s" "jump" "Flash")
(keybind "nxo" "S" "treesitter" "Flash Treesitter")
(keybind "o" "r" "remote" "Remote Flash")
(keybind "ox" "R" "treesitter_search" "Treesitter Search")
(keybind "c" "<C-S>" "toggle" "Toggle Flash Search")
];
# Disable stuff like f/t/F/T
opts.modes.char.enabled = false;
};
# }}}
# }}}
}