1
Fork 0

Migrate more neovim plugins from lua to nix

This commit is contained in:
Matei Adriel 2023-12-16 19:40:08 +01:00
parent 82c60dbf67
commit 40e0a096e8
No known key found for this signature in database
20 changed files with 481 additions and 538 deletions

View file

@ -1,7 +1,7 @@
{ {
"LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" },
"alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" }, "alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" },
"catppuccin": { "branch": "main", "commit": "64dc309bc157779691be38bbfc5123584e0a4a85" }, "catppuccin": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" },
"clipboard-image": { "branch": "main", "commit": "485de5493d196154db30f85665f8ac480ce116a2" }, "clipboard-image": { "branch": "main", "commit": "485de5493d196154db30f85665f8ac480ce116a2" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
@ -24,17 +24,15 @@
"haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" }, "haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" },
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
"hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" }, "hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" },
"idris2-nvim": { "branch": "main", "commit": "8bff02984a33264437e70fd9fff4359679d910da" }, "idris": { "branch": "main", "commit": "8bff02984a33264437e70fd9fff4359679d910da" },
"inc-rename.nvim": { "branch": "main", "commit": "a48c7cec5c4f00d7438dce5fadb55f4d715ef9f2" }, "inc-rename.nvim": { "branch": "main", "commit": "a48c7cec5c4f00d7438dce5fadb55f4d715ef9f2" },
"indent-blankline": { "branch": "master", "commit": "7206c77cb931f79885fc47f88ae18f99148392eb" }, "indent-blankline": { "branch": "master", "commit": "7206c77cb931f79885fc47f88ae18f99148392eb" },
"iron.nvim": { "branch": "master", "commit": "7f876ee3e1f4ea1e5284b1b697cdad5b256e8046" },
"kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" }, "kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" },
"kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" },
"lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lean.nvim": { "branch": "main", "commit": "360908674890f3bd92eb41c5b362510dca8fc4cb" }, "lean": { "branch": "main", "commit": "a5daac8ebccb93af25ace2a2041b503f18ff3dcb" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" },
"mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" }, "mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" },
"mini.files": { "branch": "main", "commit": "173d73f5d0b2a9abbb2d6533a3770fdbbd0c4dcc" }, "mini.files": { "branch": "main", "commit": "173d73f5d0b2a9abbb2d6533a3770fdbbd0c4dcc" },
"mini.operators": { "branch": "main", "commit": "7a97e2528a4c274e9da8953d3ba22f493c360a9f" }, "mini.operators": { "branch": "main", "commit": "7a97e2528a4c274e9da8953d3ba22f493c360a9f" },
@ -45,6 +43,7 @@
"neodev.nvim": { "branch": "main", "commit": "c4ce017bd4bacf60bf59330cec9e93c5d5e104a6" }, "neodev.nvim": { "branch": "main", "commit": "c4ce017bd4bacf60bf59330cec9e93c5d5e104a6" },
"neogit": { "branch": "master", "commit": "761e9be2aa7cc4c8ca87f10c8c37108a687b928e" }, "neogit": { "branch": "master", "commit": "761e9be2aa7cc4c8ca87f10c8c37108a687b928e" },
"nui": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, "nui": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
@ -65,17 +64,12 @@
"scrap.nvim": { "branch": "main", "commit": "0f833d8dccaabe49c1ed7a2b24cfd887d9d5003f" }, "scrap.nvim": { "branch": "main", "commit": "0f833d8dccaabe49c1ed7a2b24cfd887d9d5003f" },
"smart-splits.nvim": { "branch": "master", "commit": "c970c7a3cc7ba635fd73d43c81b40f04c00f5058" }, "smart-splits.nvim": { "branch": "master", "commit": "c970c7a3cc7ba635fd73d43c81b40f04c00f5058" },
"ssr": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" }, "ssr": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"typst.vim": { "branch": "main", "commit": "5b11b42de1703838ca1bb31dc66e73c002698e49" }, "typst.vim": { "branch": "main", "commit": "5b11b42de1703838ca1bb31dc66e73c002698e49" },
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
"venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
"vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" }, "vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" },
"vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" },
"vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" },
"wakatime": { "branch": "master", "commit": "8c8856327815a077cbebeba8c7456312a3d2c39c" }, "wakatime": { "branch": "master", "commit": "8c8856327815a077cbebeba8c7456312a3d2c39c" },
"web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, "web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
"winbar": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" }, "winbar": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" },
"yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" } "yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }
} }

View file

@ -0,0 +1,99 @@
local M = {
"echasnovski/mini.clue",
lazy = false,
}
function M.config()
local miniclue = require("mini.clue")
miniclue.setup({
triggers = {
-- Leader triggers
{ mode = "n", keys = "<leader>" },
{ mode = "x", keys = "<leader>" },
{ mode = "v", keys = "<leader>" },
},
clues = {
-- Enhance this by adding descriptions for <Leader> mapping groups
miniclue.gen_clues.builtin_completion(),
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
{
mode = "n",
keys = "<leader>f",
desc = "[F]iles",
},
{
mode = "n",
keys = "<leader>g",
desc = "[G]o to",
},
{
mode = "n",
keys = "<leader>r",
desc = "[R]ename / [R]eplace / [R]eload",
},
{
mode = "n",
keys = "<leader>l",
desc = "[L]ocal",
},
{
mode = "n",
keys = "<leader>w",
desc = "[W]orkspace",
},
{
mode = "n",
keys = "<leader>y",
desc = "[Y]ank",
},
{
mode = "n",
keys = "<leader>s",
desc = "[S]ettings",
},
{
mode = "n",
keys = "<leader>v",
desc = "[V]imux",
},
{
mode = "n",
keys = "<leader>h",
desc = "git [h]hunks",
},
{
mode = "n",
keys = "<leader>VH",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VJ",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VK",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VL",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>Vf",
postkeys = "<leader>V",
},
},
})
require("my.keymaps").nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
end
return {}

View file

@ -6,7 +6,6 @@ local M = {
cond = env.firenvim.not_active() and env.vscode.not_active(), cond = env.firenvim.not_active() and env.vscode.not_active(),
opts = { opts = {
on_attach = function(bufnr) on_attach = function(bufnr)
local wk = require("which-key")
local gs = package.loaded.gitsigns local gs = package.loaded.gitsigns
-- {{{ Helpers -- {{{ Helpers
@ -51,9 +50,9 @@ local M = {
-- {{{ Actions -- {{{ Actions
local prefix = "<leader>h" local prefix = "<leader>h"
wk.register({ -- require("which-key").register({
["<leader>"] = { h = { name = "gitsigns" } }, -- ["<leader>"] = { h = { name = "gitsigns" } },
}) -- })
-- {{{ Normal mode -- {{{ Normal mode
map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk") map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk")

View file

@ -1,44 +0,0 @@
local env = require("my.helpers.env")
local lspconfig = require("my.plugins.lspconfig")
local M = {
"ShinKage/idris2-nvim",
dependencies = {"nui.nvim", "nvim-lspconfig"},
ft = { "idris2", "lidris2", "ipkg" },
cond = env.vscode.not_active(),
}
function M.config()
local idris2 = require("idris2")
idris2.setup({
server = {
on_attach = function(client, bufnr)
lspconfig.on_attach(client, bufnr)
local function nmap(from, to, desc)
vim.keymap.set("n", "<leader>I" .. from, function()
require("idris2.code_action")[to]()
end, { desc = desc, bufnr = true })
end
nmap("C", "make_case", "Make [c]ase")
nmap("L", "make_lemma", "Make [l]emma")
nmap("c", "add_clause", "Add [c]lause")
nmap("e", "expr_search", "[E]xpression search")
nmap("d", "generate_def", "Generate [d]efinition")
nmap("s", "case_split", "Case [s]plit")
nmap("h", "refine_hole", "Refine [h]ole")
local status, wk = pcall(require, "which-key")
if status then
wk.register({ ["<leader>I"] = { name = "[I]dris", buffer = bufnr } })
end
end,
},
client = { hover = { use_split = true } },
})
end
return M

View file

@ -1,63 +0,0 @@
local env = require("my.helpers.env")
local M = {
"hkupty/iron.nvim", -- repl support
cond = env.vscode.not_active(),
cmd = "IronRepl",
}
function M.init()
-- iron also has a list of commands, see :h iron-commands for all available commands
vim.keymap.set("n", "<space>iss", "<cmd>IronRepl<cr>")
vim.keymap.set("n", "<space>ir", "<cmd>IronRestart<cr>")
vim.keymap.set("n", "<space>if", "<cmd>IronFocus<cr>")
vim.keymap.set("n", "<space>ih", "<cmd>IronHide<cr>")
local status, wk = pcall(require, "which-key")
if status then
wk.register({
["<leader>i"] = {
name = "[I]ron repl",
s = { name = "[s]end" },
m = { name = "[m]ark" },
},
})
end
end
function M.config()
local iron = require("iron.core")
iron.setup({
config = {
-- Your repl definitions come here
repl_definition = {},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require("iron.view").right(40),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
keymaps = {
send_motion = "<space>isc",
visual_send = "<space>is",
send_file = "<space>isf",
send_line = "<space>isl",
send_mark = "<space>ism",
mark_motion = "<space>imc",
mark_visual = "<space>imc",
remove_mark = "<space>imd",
cr = "<space>is<cr>",
interrupt = "<space>is<space>",
exit = "<space>isq",
clear = "<space>isr",
},
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
highlight = { italic = true },
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
})
end
return M

View file

@ -1,26 +0,0 @@
local env = require("my.helpers.env")
local lspconfig = require("my.plugins.lspconfig")
local M = {
"Julian/lean.nvim", -- lean support
dependencies = {
"neovim/nvim-lspconfig",
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
},
ft = "lean",
config = function()
require("lean").setup({
abbreviations = { builtin = true, cmp = true },
lsp = {
on_attach = lspconfig.on_attach,
capabilities = lspconfig.capabilities(),
},
lsp3 = false,
mappings = true,
})
end,
cond = env.vscode.not_active(),
}
return M

View file

@ -39,8 +39,8 @@ function M.on_attach(client, bufnr)
-- }}} -- }}}
-- {{{ Go to declaration / references / implementation -- {{{ Go to declaration / references / implementation
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition") nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation") nmap("<leader>gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences") nmap("<leader>gr", vim.lsp.buf.references, "[G]o to [r]eferences")
-- }}} -- }}}
-- {{{ Hover -- {{{ Hover
-- Note: diagnostics are already covered in keymaps.lua -- Note: diagnostics are already covered in keymaps.lua

View file

@ -1,61 +0,0 @@
local M = {
"dccsillag/magma-nvim",
cmd = "MagmaInit",
config = function()
local prefix = "<leader>M"
local status, wk = pcall(require, "which-key")
if status then
wk.register({
[prefix] = {
desc = "[M]agma",
},
})
end
vim.keymap.set(
"n",
prefix .. "e",
"<cmd>MagmaEvaluateOperator<cr>",
{ expr = true, silent = true, desc = "[E]valuate motion" }
)
vim.keymap.set(
"n",
prefix .. "ee",
"<cmd>MagmaEvaluateLine<cr>",
{ silent = true, desc = "[E]valuate line" }
)
vim.keymap.set(
"n",
prefix .. "r",
"<cmd>MagmaReevaluateCell<cr>",
{ silent = true, desc = "[R]e-evaluate cell" }
)
vim.keymap.set(
"n",
prefix .. "d",
"<cmd>MagmaDelete<cr>",
{ silent = true, desc = "[D]elete cell" }
)
vim.keymap.set(
"n",
prefix .. "o",
"<cmd>MagmaShowOutput<cr>",
{ silent = true, desc = "Show [o]utput" }
)
vim.keymap.set(
"v",
prefix .. "e",
"<cmd><C-u>MagmaEvaluateVisual<cr>",
{ silent = true, desc = "[E]vluate visual selection" }
)
end,
}
return M

View file

@ -1,30 +0,0 @@
local K = require("my.keymaps")
local env = require("my.helpers.env")
local M = {
"echasnovski/mini.files",
keys = { "<C-S-F>" },
cond = env.vscode.not_active() and env.firenvim.not_active(),
}
function M.config()
local files = require("mini.files")
files.setup({
windows = {
preview = false,
},
mappings = {
go_in_plus = "l",
},
})
K.nmap("<C-S-F>", function()
if not files.close() then
files.open(vim.api.nvim_buf_get_name(0))
files.reveal_cwd()
end
end, "[S]earch [F]iles")
end
return M

View file

@ -1,7 +0,0 @@
local M = {
"echasnovski/mini.operators",
event = "BufReadPost",
config = true,
}
return M

View file

@ -1,42 +0,0 @@
local M = {
"echasnovski/mini.surround",
event = "BufReadPost",
}
function M.config()
require("mini.surround").setup({
mappings = {
add = "<tab>s", -- Add surrounding in Normal and Visul modes
delete = "<tab>d", -- Delete surrounding
find = "<tab>f", -- Find surrounding (to the right)
find_left = "<tab>F", -- Find surrounding (to the left)
highlight = "<tab>h", -- Highlight surrounding
replace = "<tab>r", -- Replace surrounding
update_n_lines = "", -- Update `n_lines`
},
custom_surroundings = {
["b"] = {
input = { "%b()", "^.%s*().-()%s*.$" },
output = { left = "(", right = ")" },
},
["B"] = {
input = { "%b{}", "^.%s*().-()%s*.$" },
output = { left = "{", right = "}" },
},
["r"] = {
input = { "%b[]", "^.%s*().-()%s*.$" },
output = { left = "[", right = "]" },
},
["q"] = {
input = { '".-"', "^.().*().$" },
output = { left = '"', right = '"' },
},
["a"] = {
input = { "'.-'", "^.().*().$" },
output = { left = "'", right = "'" },
},
},
})
end
return M

View file

@ -1,26 +0,0 @@
local env = require("my.helpers.env")
local M = {
"TimUntersberger/neogit",
dependencies = { "nvim-lua/plenary.nvim" },
cmd = "Neogit",
cond = env.firenvim.not_active() and env.vscode.not_active(),
init = function()
vim.keymap.set("n", "<C-g>", "<cmd>Neogit<cr>", { desc = "Open neo[g]it" })
end,
config = function()
require("neogit").setup({})
-- {{{ Disable folds inside neogit
vim.api.nvim_create_autocmd("FileType", {
pattern = { "NeogitStatus" },
group = vim.api.nvim_create_augroup("NeogitStatusOptions", {}),
callback = function()
vim.opt.foldenable = false
end,
})
-- }}}
end,
}
return M

View file

@ -1,76 +0,0 @@
local env = require("my.helpers.env")
local telescope = {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
dependencies = {
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-lua/plenary.nvim",
},
version = "0.1.x",
cond = env.vscode.not_active(),
}
local M = telescope
local function find_files_by_extension(extension)
return "find_files find_command=rg,--files,--glob=**/*." .. extension
end
local function with_theme(base, theme)
return base .. " theme=" .. theme
end
local defaultTheme = "ivy"
local keybinds = {
{ "<C-P>", "find_files", "Find files" },
{ "<Leader>ft", find_files_by_extension("tex"), "[F]ind [t]ex files" },
{ "<Leader>fl", find_files_by_extension("lua"), "[F]ind [l]ua files" },
{ "<Leader>fn", find_files_by_extension("nix"), "[F]ind [n]ix files" },
{
"<Leader>fp",
find_files_by_extension("purs"),
"[F]ind [p]urescript files",
},
{ "<Leader>d", "diagnostics", "[D]iagnostics" },
{ "<C-F>", "live_grep", "[F]ind in project" },
{ "<Leader>t", "builtin", "[T]elescope pickers" },
}
local function mkAction(action)
if not string.find(action, "theme=") then
action = with_theme(action, defaultTheme)
end
if not string.find(action, "winblend=") and env.neovide.active() then
action = action .. " winblend=45"
end
return "<cmd>Telescope " .. action .. "<cr>"
end
function telescope.init()
for _, mapping in pairs(keybinds) do
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
end
end
function telescope.config()
local settings = {
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
pickers = { find_files = { hidden = true } },
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
},
},
}
require("telescope").setup(settings)
require("telescope").load_extension("fzf")
end
return M

View file

@ -28,39 +28,46 @@ local venn_hint = H.concat_many_h({
}, 3).value }, 3).value
function M.config() function M.config()
local Hydra = require("hydra") local r = "<leader>V"
vim.keymap.set("n", r .. "H", "<C-v>h:VBox<CR>", { desc = "left" })
vim.keymap.set("n", r .. "J", "<C-v>j:VBox<CR>", { desc = "down" })
vim.keymap.set("n", r .. "K", "<C-v>k:VBox<CR>", { desc = "up" })
vim.keymap.set("n", r .. "L", "<C-v>l:VBox<CR>", { desc = "right" })
vim.keymap.set("v", r .. "f", ":VBox<CR>", { desc = "box" })
Hydra({ -- local Hydra = require("hydra")
name = "Draw Diagram", --
hint = venn_hint, -- Hydra({
config = { -- name = "Draw Diagram",
color = "pink", -- hint = venn_hint,
invoke_on_body = true, -- config = {
hint = { -- color = "pink",
border = "single", -- invoke_on_body = true,
}, -- hint = {
on_enter = function() -- border = "single",
vim.o.virtualedit = "all" -- },
end, -- on_enter = function()
}, -- vim.o.virtualedit = "all"
mode = "n", -- end,
desc = "[V]enn mode", -- },
body = "<leader>V", -- mode = "n",
heads = { -- desc = "[V]enn mode",
{ "H", "<C-v>h:VBox<CR>" }, -- body = "<leader>V",
{ "J", "<C-v>j:VBox<CR>" }, -- heads = {
{ "K", "<C-v>k:VBox<CR>" }, -- { "H", "<C-v>h:VBox<CR>" },
{ "L", "<C-v>l:VBox<CR>" }, -- { "J", "<C-v>j:VBox<CR>" },
{ "f", ":VBox<CR>", { mode = "v" } }, -- { "K", "<C-v>k:VBox<CR>" },
{ "<Esc>", nil, { exit = true } }, -- { "L", "<C-v>l:VBox<CR>" },
}, -- { "f", ":VBox<CR>", { mode = "v" } },
}) -- { "<Esc>", nil, { exit = true } },
-- },
-- })
end end
function M.init() -- function M.init()
require("which-key").register({ -- require("which-key").register({
["<leader>V"] = { name = "[V]enn mode" }, -- ["<leader>V"] = { name = "[V]enn mode" },
}) -- })
end -- end
return M return {}

View file

@ -1,40 +0,0 @@
local K = require("my.keymaps")
local env = require("my.helpers.env")
local M = {
"preservim/vimux", -- interact with tmux from within vim
cmd = { "VimuxPromptCommand", "VimuxRunCommand", "VimuxRunLastCommand" },
-- TODO: only enable when actually inside tmux
cond = env.vscode.not_active()
-- and env.neovide.not_active()
and env.firenvim.not_active(),
}
function M.init()
--{{{ Register keybinds
K.nmap(
"<leader>vp",
":VimuxPromptCommand<CR>",
"[V]imux: [p]rompt for command"
)
K.nmap("<leader>vc", ':VimuxRunCommand "clear"<CR>', "[V]imux: [c]lear pane")
K.nmap(
"<leader>vl",
":VimuxRunLastCommand<CR>",
"[V]imux: rerun [l]ast command"
)
--}}}
--{{{ Register which-key docs
local status, wk = pcall(require, "which-key")
if status then
wk.register({
["<leader>v"] = {
name = "[V]imux",
},
})
end
--}}}
end
return M

View file

@ -28,4 +28,4 @@ function M.config()
}) })
end end
return M return {}

View file

@ -47,13 +47,13 @@ end
function M.create_autocmd(opts) function M.create_autocmd(opts)
local callback local callback
if type(opts.callback) == "function" then if type(opts.action) == "function" then
callback = opts.callback callback = opts.action
end end
if type(opts.callback) == "table" then if type(opts.action) == "table" then
callback = function(event) callback = function(event)
M.configure(opts.callback, event) M.configure(opts.action, event)
end end
end end
@ -115,9 +115,9 @@ function M.configure(opts, context)
if if
type(context) == "table" type(context) == "table"
and context.lazy ~= nil
and context.opts ~= nil and context.opts ~= nil
and vim.inspect(context.opts) ~= "{}" and vim.inspect(context.opts) ~= "{}"
and context.lazy ~= nil
then then
-- This is a terrible way to do it :/ -- This is a terrible way to do it :/
local status, module = pcall(require, context.lazy.name) local status, module = pcall(require, context.lazy.name)

View file

@ -9,23 +9,13 @@ let
rnix-lsp # nix rnix-lsp # nix
nil # nix nil # nix
inputs.nixd.packages.${system}.nixd # nix inputs.nixd.packages.${system}.nixd # nix
# haskell-language-server # haskell
# REASON: marked as broken
# dhall-lsp-server # dhall
# tectonic # something related to latex (?)
texlab # latex texlab # latex
nodePackages_latest.vscode-langservers-extracted # web stuff nodePackages_latest.vscode-langservers-extracted # web stuff
# python310Packages.python-lsp-server # python
# pyright # python
rust-analyzer # rust
typst-lsp # typst typst-lsp # typst
# haskell-language-server # haskell
# Formatters # Formatters
# luaformatter # Lua
stylua # Lua stylua # Lua
# black # Python
# yapf # Python
# isort # Reorder python imports
nodePackages_latest.purs-tidy # Purescript nodePackages_latest.purs-tidy # Purescript
nodePackages_latest.prettier # Js & friends nodePackages_latest.prettier # Js & friends
nodePackages_latest.prettier_d_slim # Js & friends nodePackages_latest.prettier_d_slim # Js & friends
@ -33,45 +23,20 @@ let
# Linters # Linters
ruff # Python linter ruff # Python linter
# mypy # Python typechecking
# Languages # Languages
nodePackages.typescript # typescript nodePackages.typescript # typescript
lua # For repls and whatnot lua # For repls and whatnot
wakatime # time tracking
rustfmt
# Others # Others
fd # file finder fd # file finder
ripgrep # Grep rewrite
update-nix-fetchgit # Useful for nix stuff update-nix-fetchgit # Useful for nix stuff
tree-sitter # Syntax highlighting tree-sitter # Syntax highlighting
libstdcxx5 # Required by treesitter aparently libstdcxx5 # Required by treesitter aparently
# python310Packages.jupytext # Convert between jupyter notebooks and python files
# graphviz # For rust crate graph
# haskellPackages.hoogle # For haskell search
# Preview
# zathura # Pdf reader
# xdotool # For zathura reverse search or whatever it's called
# glow # Md preview in terminal
# pandoc # Md processing
# libsForQt5.falkon # Needed for one of the md preview plugins I tried
# Latex setup # Latex setup
# texlive.combined.scheme-full # Latex stuff # texlive.combined.scheme-full # Latex stuff
# python38Packages.pygments # required for latex syntax highlighting # python38Packages.pygments # required for latex syntax highlighting
# sage
# sagetex # sage in latex
# required for the telescope fzf extension
gnumake
cmake
gcc
# Required by magma-nvim:
# python310Packages.pynvim
# python310Packages.jupyter
] ++ config.satellite.neovim.generated.dependencies; ] ++ config.satellite.neovim.generated.dependencies;
# }}} # }}}
# {{{ extraRuntime # {{{ extraRuntime
@ -83,7 +48,7 @@ let
) )
# Experimental nix module generation # Experimental nix module generation
config.satellite.neovim.generated.all config.satellite.neovim.generated.lazySingleFile
]; ];
extraRuntimeJoinedPaths = pkgs.symlinkJoin { extraRuntimeJoinedPaths = pkgs.symlinkJoin {
@ -282,6 +247,29 @@ in
''; '';
}; };
# }}} # }}}
# {{{ mini.files
satellite.neovim.lazy.mini-files = {
package = "echasnovski/mini.files";
name = "mini.files";
dependencies.lua = [ lazy.web-devicons.package ];
env.blacklist = [ "vscode" "firenvim" ];
keys = {
mapping = "<c-s-f>";
desc = "[S]earch [F]iles";
action = nlib.thunk /* lua */ ''
local files = require("mini.files")
if not files.close() then
files.open(vim.api.nvim_buf_get_name(0))
files.reveal_cwd()
end
'';
};
opts.windows.preview = false;
opts.mappings.go_in_plus = "l";
};
# }}}
# {{{ winbar # {{{ winbar
satellite.neovim.lazy.winbar = { satellite.neovim.lazy.winbar = {
package = "fgheng/winbar.nvim"; package = "fgheng/winbar.nvim";
@ -329,6 +317,102 @@ in
]; ];
}; };
# }}} # }}}
# {{{ neogit
satellite.neovim.lazy.neogit = {
package = "TimUntersberger/neogit";
dependencies.lua = [ lazy.plenary.package ];
env.blacklist = [ "vscode" "firenvim" ];
keys = {
mapping = "<c-g>";
action = "<cmd>Neogit<cr>";
desc = "Open neo[g]it";
};
opts = true; # Here so the tempest runtime will call .setup
setup.autocmds = {
event = "FileType";
pattern = "NeogitStatus";
group = "NeogitStatusDisableFolds";
action.vim.opt.foldenable = false;
};
};
# }}}
# {{{ telescope
satellite.neovim.lazy.telescope = {
package = "nvim-telescope/telescope.nvim";
version = "0.1.x";
env.blacklist = [ "vscode" ];
# {{{ Dependencies
dependencies = {
nix = [ pkgs.ripgrep ];
lua = [
lazy.plenary.package
{
# We want a prebuilt version of this plugin
dir = pkgs.vimPlugins.telescope-fzf-native-nvim;
name = "telescope-fzf-native";
}
];
};
# }}}
# {{{ Keymaps
keys =
let
keymap = mapping: action: desc: {
inherit mapping desc;
action = "<cmd>Telescope ${action} theme=ivy<cr>";
};
findFilesByExtension = mapping: extension: tag:
keymap
"<leader>f${mapping}"
"find_files find_command=rg,--files,--glob=**/*.${extension}"
"Find ${tag} files";
in
[
(keymap "<c-p>" "find_files" "Find files")
(keymap "<leader>d" "diagnostics" "Diagnostics")
(keymap "<c-f>" "live_grep" "[F]ind in project")
(keymap "<leader>t" "builtin" "[T]elescope pickers")
# {{{ Files by extension
(findFilesByExtension "tx" "tex" "[t]ex")
(findFilesByExtension "ts" "ts" "[t]ypescript")
(findFilesByExtension "ty" "typst" "[t]ypst")
(findFilesByExtension "l" "lua" "[l]ua")
(findFilesByExtension "n" "nix" "[n]ua")
(findFilesByExtension "p" "purs" "[p]urescript")
(findFilesByExtension "h" "hs" "[h]askell")
(findFilesByExtension "e" "elm" "[e]lm")
(findFilesByExtension "r" "rs" "[r]ust")
# }}}
];
# }}}
# {{{ Disable folds in telescope windows
setup.autocmds = {
event = "FileType";
pattern = "TelescopeResults";
group = "TelescopeResultsDisableFolds";
action.vim.opt.foldenable = false;
};
# }}}
# {{{ Load fzf extension
setup.callback = nlib.thunkString /* lua */ ''
require("telescope").load_extension("fzf")
'';
# }}}
# {{{ Options
opts.defaults.mappings.i."<C-h>" = "which_key";
opts.pickers.find_files.hidden = true;
opts.extensions.fzf = {
fuzzy = true;
override_generic_sorter = true;
override_file_sorter = true;
};
# }}}
};
# }}}
# }}} # }}}
# {{{ visual # {{{ visual
# The line between `ui` and `visual` is a bit rought. I currenlty mostly judge # The line between `ui` and `visual` is a bit rought. I currenlty mostly judge
@ -464,10 +548,74 @@ in
setup = true; setup = true;
keys = [ keys = [
{ mapping = "gc"; mode = "nxv"; } { mapping = "gc"; mode = "nxv"; }
{ mapping = "gcc"; } "gcc"
]; ];
}; };
# }}} # }}}
# {{{ mini.surround
satellite.neovim.lazy.mini-surround = {
package = "echasnovski/mini.surround";
name = "mini.surround";
keys = lib.flatten [
# ^ doing the whole `flatten` thing to lie to my formatter
{ mapping = "<tab>s"; mode = "nv"; }
[ "<tab>d" "<tab>f" "<tab>F" "<tab>h" "<tab>r" ]
];
# {{{ Keymaps
opts.mappings = {
add = "<tab>s"; # Add surrounding in Normal and Visul modes
delete = "<tab>d"; # Delete surrounding
find = "<tab>f"; # Find surrounding (to the right)
find_left = "<tab>F"; # Find surrounding (to the left)
highlight = "<tab>h"; # Highlight surrounding
replace = "<tab>r"; # Replace surrounding
update_n_lines = ""; # Update `n_lines`
};
# }}}
# {{{ Custom surroundings
opts.custom_surroundings =
let mk = balanced: input: left: right: {
input = [
input
(if balanced
then "^.%s*().-()%s*.$"
else "^.().*().$")
];
output = { inherit left right; };
};
in
{
b = mk true "%b()" "(" ")";
B = mk true "%b{}" "{" "}";
r = mk true "%b[]" "[" "]";
q = mk false "\".-\"" "\"" "\"";
a = mk false "'.-'" "'" "'";
};
# }}}
};
# }}}
# {{{ mini.operators
satellite.neovim.lazy.mini-operators = {
package = "echasnovski/mini.operators";
name = "mini.operators";
setup = true;
keys =
let operator = key: [
{ mapping = "g${key}"; mode = "nv"; }
"g${key}${key}"
];
in
lib.flatten [
(operator "=")
(operator "x")
(operator "r")
(operator "s")
];
};
# }}}
# }}} # }}}
# {{{ ide # {{{ ide
# {{{ conform # {{{ conform
@ -538,6 +686,7 @@ in
# {{{ rust-tools # {{{ rust-tools
satellite.neovim.lazy.rust-tools = { satellite.neovim.lazy.rust-tools = {
package = "simrat39/rust-tools.nvim"; package = "simrat39/rust-tools.nvim";
dependencies.nix = [ pkgs.rust-analyzer pkgs.rustfmt ];
env.blacklist = [ "vscode" ]; env.blacklist = [ "vscode" ];
ft = "rust"; ft = "rust";
@ -572,7 +721,7 @@ in
event = "InsertEnter"; event = "InsertEnter";
group = "CargoCmpSource"; group = "CargoCmpSource";
pattern = "Cargo.toml"; pattern = "Cargo.toml";
callback = nlib.thunkString /* lua */ '' action = nlib.thunkString /* lua */ ''
require("cmp").setup.buffer({ sources = { { name = "crates" } } }) require("cmp").setup.buffer({ sources = { { name = "crates" } } })
''; '';
} }
@ -582,18 +731,18 @@ in
event = "BufReadPost"; event = "BufReadPost";
group = "CargoKeybinds"; group = "CargoKeybinds";
pattern = "Cargo.toml"; pattern = "Cargo.toml";
# {{{ Register which-key info # # {{{ Register which-key info
callback.callback = nlib.contextThunk /* lua */ '' # callback.callback = nlib.contextThunk /* lua */ ''
require("which-key").register({ # require("which-key").register({
["<leader>lc"] = { # ["<leader>lc"] = {
name = "[l]ocal [c]rates", # name = "[l]ocal [c]rates",
bufnr = context.bufnr # bufnr = context.bufnr
}, # },
}) # })
''; # '';
# }}} # }}}
callback.keys = action.keys =
let let
# {{{ Keymap helpers # {{{ Keymap helpers
keymap = mapping: action: desc: { keymap = mapping: action: desc: {
@ -626,16 +775,83 @@ in
}; };
# }}} # }}}
# }}} # }}}
# {{{ lean
satellite.neovim.lazy.lean = {
package = "Julian/lean.nvim";
name = "lean";
dependencies.lua = [
lazy.plenary.package
"neovim/nvim-lspconfig"
"hrsh7th/nvim-cmp"
];
env.blacklist = [ "vscode" ];
ft = "lean";
opts = {
abbreviations = {
builtin = true;
cmp = true;
};
lsp = {
on_attach = nlib.lua /* lua */ ''require("my.plugins.lspconfig").on_attach'';
capabilites = nlib.lua /* lua */ ''require("my.plugins.lspconfig").capabilities'';
};
lsp3 = false; # We don't want the lean 3 language server!
mappings = true;
};
};
# }}}
# {{{ idris
satellite.neovim.lazy.idris = {
package = "ShinKage/idris2-nvim";
name = "idris";
dependencies.lua = [
lazy.nui.package
"neovim/nvim-lspconfig"
];
env.blacklist = [ "vscode" ];
ft = [ "idris2" "lidris2" "ipkg" ];
opts = {
client.hover.use_split = true;
serve.on_attach = nlib.languageServerOnAttach {
# {{{ Keymaps
keys =
let keymap = mapping: action: desc: {
inherit desc;
mapping = "<leader>i${mapping}";
action = nlib.lua /* lua */ ''require("idris2.code_action").${action}'';
};
in
[
(keymap "C" "make_case" "Make [c]ase")
(keymap "L" "make_lemma" "Make [l]emma")
(keymap "c" "add_clause" "Add [c]lause")
(keymap "e" "expr_search" "[E]xpression search")
(keymap "d" "generate_def" "Generate [d]efinition")
(keymap "s" "case_split" "Case [s]plit")
(keymap "h" "refine_hole" "Refine [h]ole")
];
# }}}
};
};
};
# }}}
# }}} # }}}
# {{{ external # {{{ external
# These plugins integrate neovim with external services # These plugins integrate neovim with external services
# {{{ wakatime # {{{ wakatime
satellite.neovim.lazy.wakatime = { satellite.neovim.lazy.wakatime = {
package = "wakatime/vim-wakatime"; package = "wakatime/vim-wakatime";
dependencies.nix = [ pkgs.wakatime ];
env.blacklist = [ "vscode" "firenvim" ]; env.blacklist = [ "vscode" "firenvim" ];
event = "BufReadPost"; event = "BufReadPost";
}; };
# }}} # }}}
# {{{ discord rich presence # {{{ discord rich presence
satellite.neovim.lazy.discord-rich-presence = { satellite.neovim.lazy.discord-rich-presence = {

View file

@ -112,13 +112,20 @@ let
(luaEncoders.oneOrMany encoder); (luaEncoders.oneOrMany encoder);
# }}} # }}}
# {{{ Attrsets # {{{ Attrsets
attrName = s:
let forbiddenChars = lib.stringToCharacters "<>'\".,;"; # This list *is* incomplete
in
if lib.any (c: lib.hasInfix c s) forbiddenChars then
"[${luaEncoders.string s}]"
else s;
attrsetOf = encoder: object: attrsetOf = encoder: object:
luaEncoders.mkRawLuaObject (lib.mapAttrsToList luaEncoders.mkRawLuaObject (lib.mapAttrsToList
(name: value: (name: value:
let result = encoder value; let result = encoder value;
in in
lib.optionalString (result != "nil") lib.optionalString (result != "nil")
"${name} = ${result}" "${luaEncoders.attrName name} = ${result}"
) )
object object
); );
@ -150,7 +157,7 @@ let
let result = encoder (attrset.${attr} or null); let result = encoder (attrset.${attr} or null);
in in
lib.optionalString (!(lib.elem attr listOrder) && shouldKeep result) lib.optionalString (!(lib.elem attr listOrder) && shouldKeep result)
"${attr} = ${result}" "${luaEncoders.attrName attr} = ${result}"
) )
spec; spec;
in in
@ -184,7 +191,10 @@ in
writeFile = path: name: text: writeFile = path: name: text:
let let
destination = "${path}/${name}.lua"; destination = "${path}/${name}.lua";
unformatted = pkgs.writeText "raw-lua-${name}" text; unformatted = pkgs.writeText "raw-lua-${name}" ''
-- This file was generated using nix ^~^
${text}
'';
in in
pkgs.runCommand "formatted-lua-${name}" { } '' pkgs.runCommand "formatted-lua-${name}" { } ''
mkdir -p $out/${path} mkdir -p $out/${path}

View file

@ -155,7 +155,7 @@ let
description = "Name of the group to create and assign autocmd to"; description = "Name of the group to create and assign autocmd to";
}; };
callback = lib.mkOption { action = lib.mkOption {
example.vim.opt.cmdheight = 1; example.vim.opt.cmdheight = 1;
type = types.oneOf [ type = types.oneOf [
myTypes.tempestConfiguration myTypes.tempestConfiguration
@ -219,14 +219,18 @@ let
lazyModule = lib.fix (lazyModule: types.submodule ({ name ? null, ... }: { lazyModule = lib.fix (lazyModule: types.submodule ({ name ? null, ... }: {
options = { options = {
package = lib.mkOption { package = lib.mkOption {
type = types.oneOf [ default = null;
types.package type = types.nullOr types.str;
types.str
];
description = "Package to configure the module around"; description = "Package to configure the module around";
example = "nvim-telescope/telescope.nvim"; example = "nvim-telescope/telescope.nvim";
}; };
dir = lib.mkOption {
default = null;
type = types.nullOr types.path;
description = "Path to install pacakge from";
};
name = lib.mkOption { name = lib.mkOption {
default = name; default = name;
type = types.nullOr types.str; type = types.nullOr types.str;
@ -377,6 +381,11 @@ in
description = "Derivation building all the given nix modules"; description = "Derivation building all the given nix modules";
}; };
lazySingleFile = lib.mkOption {
type = types.package;
description = "Derivation building all the given nix modules in a single file";
};
dependencies = lib.mkOption { dependencies = lib.mkOption {
default = [ ]; default = [ ];
type = types.listOf types.package; type = types.listOf types.package;
@ -426,7 +435,7 @@ in
event = e.oneOrMany e.string; event = e.oneOrMany e.string;
pattern = e.oneOrMany e.string; pattern = e.oneOrMany e.string;
group = e.string; group = e.string;
callback = e.conditional lib.isAttrs action = e.conditional lib.isAttrs
cfg.lib.encodeTempestConfiguration cfg.lib.encodeTempestConfiguration
e.luaString; e.luaString;
}); });
@ -520,14 +529,21 @@ in
}); });
# }}} # }}}
# {{{ Lazy spec encoder # {{{ Lazy spec encoder
xor = a: b: (a || b) && (!a || !b);
implies = a: b: !a || b;
hasProp = obj: p: (obj.${p} or null) != null;
propXor = a: b: obj: xor (hasProp obj a) (hasProp obj b);
propImplies = a: b: obj: implies (hasProp obj a) (hasProp obj b);
lazyObjectEncoder = e.bind lazyObjectEncoder = e.bind
(opts: e.attrset true [ "package" ] (opts: e.attrset true [ "package" ]
{ {
package = e.string; package = e.nullOr e.string;
dir = assert propXor "package" "dir" opts; e.nullOr e.string;
tag = assert propImplies "tag" "package" opts; e.nullOr e.string;
version = assert propImplies "tag" "package" opts; e.nullOr e.string;
name = e.nullOr e.string; name = e.nullOr e.string;
main = e.nullOr e.string; main = e.nullOr e.string;
tag = e.nullOr e.string;
version = e.nullOr e.string;
dependencies = e.map (d: d.lua) (e.tryNonemptyList (e.stringOr lazyObjectEncoder)); dependencies = e.map (d: d.lua) (e.tryNonemptyList (e.stringOr lazyObjectEncoder));
lazy = e.nullOr e.bool; lazy = e.nullOr e.bool;
cond = e.conjunction cond = e.conjunction
@ -559,19 +575,36 @@ in
opts = e.anything; opts = e.anything;
}); });
# }}} # }}}
makeLazyScript = opts: ''
-- This file was generated using nix ^~^
return ${lazyObjectEncoder opts}
'';
in in
lib.attrsets.mapAttrs lib.attrsets.mapAttrs
(name: opts: rec { (name: opts: rec {
raw = makeLazyScript opts; raw = lazyObjectEncoder opts;
module = config.satellite.lib.lua.writeFile "lua/nix/plugins" name raw; module = config.satellite.lib.lua.writeFile "lua/nix/plugins" name raw;
}) })
cfg.lazy; cfg.lazy;
config.satellite.neovim.generated.lazySingleFile =
let
makeFold = name: m: ''
-- {{{ ${name}
${m.raw},
-- }}}'';
mkReturnList = objects: ''
return {
${objects}
}'';
script = lib.pipe cfg.generated.lazy [
(lib.attrsets.mapAttrsToList makeFold)
(lib.concatStringsSep "\n")
mkReturnList
];
in
config.satellite.lib.lua.writeFile
"lua/nix/plugins" "init"
script;
config.satellite.neovim.generated.all = config.satellite.neovim.generated.all =
pkgs.symlinkJoin { pkgs.symlinkJoin {
name = "lazy-nvim-modules"; name = "lazy-nvim-modules";