Remove rarely used neovim plugins
This commit is contained in:
parent
c13e628cd7
commit
d560d0bf84
8 changed files with 28 additions and 647 deletions
home/features/neovim/config/lua/my/plugins
|
@ -13,7 +13,7 @@ local header = runtime.helpers.split(header_string, "\n")
|
|||
|
||||
local M = {
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
dependencies = { "web-devicons" },
|
||||
config = function()
|
||||
local theme = require("alpha.themes.dashboard")
|
||||
theme.opts.width = 70
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
local runtime = require("my.tempest")
|
||||
local K = require("my.keymaps")
|
||||
|
||||
local M = {
|
||||
"glacambre/firenvim", -- vim inside chrome
|
||||
lazy = false,
|
||||
cond = runtime.whitelist("firenvim"),
|
||||
}
|
||||
|
||||
M.localSettings = {}
|
||||
|
||||
local function make_url_regex(url)
|
||||
return "https?:\\/\\/(?:www\\.)?" .. url .. ".*"
|
||||
end
|
||||
|
||||
local function blacklist(url)
|
||||
M.localSettings[make_url_regex(url)] = { takeover = "never", priority = 0 }
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- {{{ Filename
|
||||
M.localSettings[".*"] = {
|
||||
filename = "/tmp/firenvim_{hostname}_{pathname}_{selector}_{timestamp}.{extension}",
|
||||
}
|
||||
-- }}}
|
||||
-- {{{ Ctrl-z to expand window
|
||||
K.nmap("<C-z>", function()
|
||||
vim.opt.lines = 25
|
||||
end, "Expand the neovim window!")
|
||||
-- }}}
|
||||
-- {{{ Filetype detection
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "firenvim_localhost_notebooks*.txt" },
|
||||
group = vim.api.nvim_create_augroup("JupyterMarkdownFiletype", {}),
|
||||
callback = function()
|
||||
vim.opt.filetype = "markdown"
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
-- {{{ Disable status line
|
||||
vim.opt.laststatus = 0
|
||||
-- }}}
|
||||
-- {{{ Blacklist websites
|
||||
blacklist("web\\.whatsapp\\.com")
|
||||
blacklist("twitter\\.com")
|
||||
blacklist("desmos\\.com\\/calculator")
|
||||
blacklist("geogebra\\.org\\/calculator")
|
||||
blacklist("google\\.com\\/search")
|
||||
blacklist("github\\.com\\/.*\\/blob")
|
||||
-- }}}
|
||||
-- {{{ Comitting our config changes
|
||||
vim.g.firenvim_config = { localSettings = M.localSettings }
|
||||
-- }}}
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,404 +0,0 @@
|
|||
local M = {
|
||||
-- keybinds where you only hit the head once
|
||||
"anuvyklack/hydra.nvim",
|
||||
dependencies = {
|
||||
"mrjones2014/smart-splits.nvim", -- the name says it all
|
||||
},
|
||||
keys = { "<C-S-w>" },
|
||||
}
|
||||
|
||||
-- {{{ Helpers
|
||||
local function identity(x)
|
||||
return x
|
||||
end
|
||||
|
||||
local function len(x)
|
||||
return #x
|
||||
end
|
||||
|
||||
local function box(value, w, h)
|
||||
return { value = value, width = w, height = h }
|
||||
end
|
||||
|
||||
local function min(l, r)
|
||||
if l < r then
|
||||
return l
|
||||
else
|
||||
return r
|
||||
end
|
||||
end
|
||||
|
||||
local function max(l, r)
|
||||
return -min(-l, -r)
|
||||
end
|
||||
|
||||
local function zip_with(l, r, f, default)
|
||||
local output = {}
|
||||
for i = 1, max(#l, #r), 1 do
|
||||
output[i] = f(l[i] or default, r[i] or default)
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
local function flatten_list(list)
|
||||
local output = {}
|
||||
|
||||
for i = 1, #list, 1 do
|
||||
for j = 1, #list[i], 1 do
|
||||
table.insert(output, list[i][j])
|
||||
end
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
local function map_list(list, f)
|
||||
local output = {}
|
||||
for i = 1, #list, 1 do
|
||||
output[i] = f(list[i])
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
local function l_repeat(v, times)
|
||||
if times == 0 then
|
||||
return {}
|
||||
end
|
||||
|
||||
local o = {}
|
||||
|
||||
for i = 1, times, 1 do
|
||||
o[i] = v
|
||||
end
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
local function s_repeat(text, times)
|
||||
local o = ""
|
||||
|
||||
for _ = 1, times, 1 do
|
||||
o = o .. text
|
||||
end
|
||||
|
||||
return o
|
||||
end
|
||||
local function string_split(text, sep)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local sep, fields = sep or ":", {}
|
||||
local pattern = string.format("([^%s]+)", sep)
|
||||
text:gsub(pattern, function(c)
|
||||
fields[#fields + 1] = c
|
||||
end)
|
||||
return fields
|
||||
end
|
||||
|
||||
local function table_max(list, f, default)
|
||||
if #list == 0 then
|
||||
return default
|
||||
end
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local f = f or identity
|
||||
local c_max = list[1]
|
||||
for i = 1, #list, 1 do
|
||||
if f(list[i]) >= f(c_max) then
|
||||
c_max = list[i]
|
||||
end
|
||||
end
|
||||
|
||||
return c_max
|
||||
end
|
||||
|
||||
local function string_value(t)
|
||||
if type(t) == "string" then
|
||||
return t
|
||||
end
|
||||
|
||||
return t.value
|
||||
end
|
||||
|
||||
local function lines(text)
|
||||
return string_split(string_value(text), "\n")
|
||||
end
|
||||
|
||||
local function unlines(text)
|
||||
return table.concat(text, "\n")
|
||||
end
|
||||
|
||||
local function map_lines(text, f)
|
||||
return unlines(map_list(lines(text), f))
|
||||
end
|
||||
|
||||
local function string_width(t)
|
||||
if type(t) == "string" then
|
||||
return #table_max(lines(t), len, "")
|
||||
end
|
||||
|
||||
return t.width
|
||||
end
|
||||
|
||||
local function string_height(t)
|
||||
if type(t) == "string" then
|
||||
return #lines(t)
|
||||
end
|
||||
|
||||
return t.height
|
||||
end
|
||||
|
||||
local function half_down(num)
|
||||
return math.floor(num / 2)
|
||||
end
|
||||
|
||||
local function half_up(num)
|
||||
return math.ceil(num / 2)
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Hint helpers
|
||||
local H = {}
|
||||
|
||||
function H.highlight(t)
|
||||
return box("_" .. t .. "_", string_width(t), 1)
|
||||
end
|
||||
|
||||
function H.spacing(amount)
|
||||
return s_repeat(" ", amount)
|
||||
end
|
||||
|
||||
function H.spacing_for(text)
|
||||
return H.spacing(string_width(text))
|
||||
end
|
||||
|
||||
function H.spacing_largest(values)
|
||||
return H.spacing_for(table_max(values))
|
||||
end
|
||||
|
||||
H.nojustify = { justify = "nojustify" }
|
||||
|
||||
function H.pad_left(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return H.spacing(spaces) .. line
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad_right(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return line .. H.spacing(spaces)
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad_around(text, length)
|
||||
local spaces = length - string_width(text)
|
||||
return box(
|
||||
map_lines(text, function(line)
|
||||
return H.spacing(half_up(spaces)) .. line .. H.spacing(half_down(spaces))
|
||||
end),
|
||||
length,
|
||||
string_height(text)
|
||||
)
|
||||
end
|
||||
|
||||
function H.pad(text, length, justify)
|
||||
if justify == "nojustify" then
|
||||
return text
|
||||
elseif justify == "center" then
|
||||
return H.pad_around(text, length)
|
||||
elseif justify == "right" then
|
||||
return H.pad_left(text, length)
|
||||
elseif justify == "left" then
|
||||
return H.pad_right(text, length)
|
||||
end
|
||||
|
||||
error("No justify provided")
|
||||
end
|
||||
|
||||
function H.directional(h, j, k, l, spacing_amount)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local spacing_amount = spacing_amount or 1
|
||||
|
||||
return H.concat_many_w({
|
||||
H.highlight(k),
|
||||
H.concat_many_h({
|
||||
H.highlight(h),
|
||||
H.spacing(spacing_amount),
|
||||
H.highlight(l),
|
||||
}),
|
||||
H.highlight(j),
|
||||
})
|
||||
end
|
||||
|
||||
function H.add_title(title, body)
|
||||
local width = max(string_width(title), string_width(body))
|
||||
|
||||
return H.concat_many_w({
|
||||
title,
|
||||
s_repeat("-", width),
|
||||
body,
|
||||
})
|
||||
end
|
||||
|
||||
function H.concat_h(left, right, spacing_amount)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local spacing_amount = spacing_amount or 0
|
||||
|
||||
return box(
|
||||
unlines(zip_with(lines(left), lines(right), function(l, r)
|
||||
return l .. H.spacing(spacing_amount) .. r
|
||||
end, "")),
|
||||
string_width(left) + string_width(right) + spacing_amount,
|
||||
max(string_height(left), string_height(right))
|
||||
)
|
||||
end
|
||||
|
||||
function H.concat_w(above, below, opts)
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local opts = opts or {}
|
||||
local spacing_amount = opts.spacing_amount or 0
|
||||
local justify = opts.justify or "center"
|
||||
local width = max(string_width(above), string_width(below))
|
||||
|
||||
return box(
|
||||
unlines(flatten_list({
|
||||
{ H.pad(above, width, justify).value },
|
||||
l_repeat(H.spacing(width), spacing_amount),
|
||||
{ H.pad(below, width, justify).value },
|
||||
})),
|
||||
width,
|
||||
spacing_amount + string_height(above) + string_height(below)
|
||||
)
|
||||
end
|
||||
|
||||
function H.concat_many_h(list, spacing_amount)
|
||||
local result = list[1]
|
||||
|
||||
for i = 2, #list, 1 do
|
||||
result = H.concat_h(result, list[i], spacing_amount)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function H.concat_many_w(list, opts)
|
||||
local result = list[1]
|
||||
|
||||
for i = 2, #list, 1 do
|
||||
result = H.concat_w(result, list[i], opts)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function H.pad_lengths_right(list)
|
||||
local max_length = table_max(list, string_width)
|
||||
return map_list(list, function(t)
|
||||
return H.concat_h(t, H.spacing(max_length - string_width(t)))
|
||||
end)
|
||||
end
|
||||
|
||||
M.hint = H
|
||||
-- }}}
|
||||
|
||||
local window_hint_old = [[
|
||||
^^^^^^ Move ^^^^^^ ^^ Size ^^ ^^ Split
|
||||
^^^^^^-------------^^^^^^ ^^-----------^^ ^^---------------
|
||||
^ ^ _k_ ^ ^ ^ ^ _K_ ^ ^ ^ _<C-k>_ ^ _s_: horizontally
|
||||
_h_ ^ ^ _l_ _H_ ^ ^ _L_ _<C-h>_ _<C-l>_ _v_: vertically
|
||||
^ ^ _j_ ^ ^ ^ ^ _J_ ^ ^ ^ _<C-j>_ ^ _q_: close
|
||||
^^^focus^^^ ^^^window^^^ ^_=_: equalize^ _o_: close remaining
|
||||
]]
|
||||
|
||||
local window_hint = H.concat_many_h({
|
||||
H.add_title(
|
||||
"Move",
|
||||
H.concat_h(
|
||||
H.concat_w(H.directional("h", "j", "k", "l", 3), "focus"),
|
||||
H.concat_w(
|
||||
H.directional("H", "J", "K", "L", 3),
|
||||
"window",
|
||||
{ justify = "left" }
|
||||
),
|
||||
2
|
||||
)
|
||||
),
|
||||
H.add_title(
|
||||
"Size",
|
||||
H.concat_w(
|
||||
H.directional("<C-h>", "<C-j>", "<C-k>", "<C-l>"),
|
||||
H.concat_many_h({
|
||||
H.highlight("="),
|
||||
": equalize",
|
||||
})
|
||||
)
|
||||
),
|
||||
H.add_title(
|
||||
"Split",
|
||||
H.concat_many_w({
|
||||
H.concat_h(H.highlight("s"), ": horizontally"),
|
||||
H.concat_h(H.highlight("v"), ": vertical"),
|
||||
H.concat_h(H.highlight("q"), ": close"),
|
||||
H.concat_h(H.highlight("o"), ": close remaining"),
|
||||
}, { justify = "left" })
|
||||
),
|
||||
}, 3).value
|
||||
|
||||
function M.config()
|
||||
local Hydra = require("hydra")
|
||||
local pcmd = require("hydra.keymap-util").pcmd
|
||||
local splits = require("smart-splits")
|
||||
|
||||
-- {{{ Windows
|
||||
local resize = function(direction)
|
||||
return function()
|
||||
splits["resize_" .. direction](2)
|
||||
end
|
||||
end
|
||||
|
||||
Hydra({
|
||||
name = "Windows",
|
||||
hint = window_hint,
|
||||
config = {
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "single",
|
||||
offset = -1, -- vertical offset (larger => higher up)
|
||||
},
|
||||
},
|
||||
mode = "n",
|
||||
body = "<C-S-w>",
|
||||
heads = {
|
||||
{ "h", "<C-w>h" },
|
||||
{ "j", "<C-w>j" },
|
||||
{ "k", "<C-w>k" },
|
||||
{ "l", "<C-w>l" },
|
||||
|
||||
{ "H", "<C-w>H" },
|
||||
{ "J", "<C-w>J" },
|
||||
{ "K", "<C-w>K" },
|
||||
{ "L", "<C-w>L" },
|
||||
|
||||
{ "<C-h>", resize("left") },
|
||||
{ "<C-j>", resize("down") },
|
||||
{ "<C-k>", resize("up") },
|
||||
{ "<C-l>", resize("right") },
|
||||
{ "=", "<C-w>=", { desc = "equalize" } },
|
||||
{ "s", pcmd("split", "E36") },
|
||||
{ "v", pcmd("vsplit", "E36") },
|
||||
{ "o", "<C-w>o", { exit = true, desc = "remain only" } },
|
||||
{ "q", pcmd("close", "E444"), { desc = "close window" } },
|
||||
},
|
||||
})
|
||||
-- }}}
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,79 +0,0 @@
|
|||
local M = {
|
||||
"jbyuki/venn.nvim", -- draw ascii diagrams
|
||||
dependencies = {
|
||||
"anuvyklack/hydra.nvim",
|
||||
},
|
||||
keys = { "<leader>V" },
|
||||
}
|
||||
|
||||
local venn_hint_old = [[
|
||||
^^^Draw arrow^^^ Select region with <C-v>
|
||||
^ ^ _K_ ^ ^ _f_: surround it with box
|
||||
_H_ ^ ^ _L_
|
||||
^ ^ _J_ ^ ^ _<Esc>_
|
||||
]]
|
||||
|
||||
local H = require("my.plugins.hydra").hint
|
||||
|
||||
local venn_hint = H.concat_many_h({
|
||||
H.add_title("Draw arrows", H.directional("H", "J", "K", "L", 3)),
|
||||
H.add_title(
|
||||
"Actions",
|
||||
H.concat_many_w({
|
||||
H.concat_h("<C-v>", ": select region"),
|
||||
H.concat_h(H.pad_right(H.highlight("f"), 5), ": surround with box"),
|
||||
H.concat_h(H.pad_right(H.highlight("<Esc>"), 5), ": quit"),
|
||||
}, { justify = "left" })
|
||||
),
|
||||
}, 3).value
|
||||
|
||||
function M.config()
|
||||
-- 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" })
|
||||
|
||||
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.opt.virtualedit = "all"
|
||||
vim.g.inside_venn = true
|
||||
end,
|
||||
on_exit = function()
|
||||
vim.opt.virtualedit = ""
|
||||
end,
|
||||
desc = "[V]enn mode",
|
||||
},
|
||||
mode = "n",
|
||||
body = "<leader>V",
|
||||
heads = {
|
||||
{ "H", "<C-v>h<esc><cmd>silent VBox<cr>", { silent = true } },
|
||||
{ "J", "<C-v>j<esc><cmd>silent VBox<cr>", { silent = true } },
|
||||
{ "K", "<C-v>k<esc><cmd>silent VBox<cr>", { silent = true } },
|
||||
{ "L", "<C-v>l<esc><cmd>silent VBox<cr>", { silent = true } },
|
||||
{ "f", "<cmd>VBox<cr>", { mode = "v" } },
|
||||
{ "<Esc>", nil, { exit = true } },
|
||||
},
|
||||
})
|
||||
|
||||
-- vim.keymap.set("n", "w", "<C-v>h:VBox<cr>", { silent = true })
|
||||
end
|
||||
|
||||
function M.init()
|
||||
-- require("which-key").register({
|
||||
-- ["<leader>V"] = { name = "[V]enn mode" },
|
||||
-- })
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue