Migrate more neovim plugins from lua to nix
This commit is contained in:
parent
82c60dbf67
commit
40e0a096e8
20 changed files with 481 additions and 538 deletions
home/features/neovim/config/lua/my/plugins
99
home/features/neovim/config/lua/my/plugins/clue.lua
Normal file
99
home/features/neovim/config/lua/my/plugins/clue.lua
Normal 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 {}
|
|
@ -6,7 +6,6 @@ local M = {
|
|||
cond = env.firenvim.not_active() and env.vscode.not_active(),
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local wk = require("which-key")
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
-- {{{ Helpers
|
||||
|
@ -51,9 +50,9 @@ local M = {
|
|||
-- {{{ Actions
|
||||
local prefix = "<leader>h"
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = { h = { name = "gitsigns" } },
|
||||
})
|
||||
-- require("which-key").register({
|
||||
-- ["<leader>"] = { h = { name = "gitsigns" } },
|
||||
-- })
|
||||
|
||||
-- {{{ Normal mode
|
||||
map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk")
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -39,8 +39,8 @@ function M.on_attach(client, bufnr)
|
|||
-- }}}
|
||||
-- {{{ Go to declaration / references / implementation
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
|
||||
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
|
||||
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences")
|
||||
nmap("<leader>gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
|
||||
nmap("<leader>gr", vim.lsp.buf.references, "[G]o to [r]eferences")
|
||||
-- }}}
|
||||
-- {{{ Hover
|
||||
-- Note: diagnostics are already covered in keymaps.lua
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,7 +0,0 @@
|
|||
local M = {
|
||||
"echasnovski/mini.operators",
|
||||
event = "BufReadPost",
|
||||
config = true,
|
||||
}
|
||||
|
||||
return M
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -28,39 +28,46 @@ local venn_hint = H.concat_many_h({
|
|||
}, 3).value
|
||||
|
||||
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({
|
||||
name = "Draw Diagram",
|
||||
hint = venn_hint,
|
||||
config = {
|
||||
color = "pink",
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "single",
|
||||
},
|
||||
on_enter = function()
|
||||
vim.o.virtualedit = "all"
|
||||
end,
|
||||
},
|
||||
mode = "n",
|
||||
desc = "[V]enn mode",
|
||||
body = "<leader>V",
|
||||
heads = {
|
||||
{ "H", "<C-v>h:VBox<CR>" },
|
||||
{ "J", "<C-v>j:VBox<CR>" },
|
||||
{ "K", "<C-v>k:VBox<CR>" },
|
||||
{ "L", "<C-v>l:VBox<CR>" },
|
||||
{ "f", ":VBox<CR>", { mode = "v" } },
|
||||
{ "<Esc>", nil, { exit = true } },
|
||||
},
|
||||
})
|
||||
-- local Hydra = require("hydra")
|
||||
--
|
||||
-- Hydra({
|
||||
-- name = "Draw Diagram",
|
||||
-- hint = venn_hint,
|
||||
-- config = {
|
||||
-- color = "pink",
|
||||
-- invoke_on_body = true,
|
||||
-- hint = {
|
||||
-- border = "single",
|
||||
-- },
|
||||
-- on_enter = function()
|
||||
-- vim.o.virtualedit = "all"
|
||||
-- end,
|
||||
-- },
|
||||
-- mode = "n",
|
||||
-- desc = "[V]enn mode",
|
||||
-- body = "<leader>V",
|
||||
-- heads = {
|
||||
-- { "H", "<C-v>h:VBox<CR>" },
|
||||
-- { "J", "<C-v>j:VBox<CR>" },
|
||||
-- { "K", "<C-v>k:VBox<CR>" },
|
||||
-- { "L", "<C-v>l:VBox<CR>" },
|
||||
-- { "f", ":VBox<CR>", { mode = "v" } },
|
||||
-- { "<Esc>", nil, { exit = true } },
|
||||
-- },
|
||||
-- })
|
||||
end
|
||||
|
||||
function M.init()
|
||||
require("which-key").register({
|
||||
["<leader>V"] = { name = "[V]enn mode" },
|
||||
})
|
||||
end
|
||||
-- function M.init()
|
||||
-- require("which-key").register({
|
||||
-- ["<leader>V"] = { name = "[V]enn mode" },
|
||||
-- })
|
||||
-- end
|
||||
|
||||
return M
|
||||
return {}
|
||||
|
|
|
@ -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
|
|
@ -28,4 +28,4 @@ function M.config()
|
|||
})
|
||||
end
|
||||
|
||||
return M
|
||||
return {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue