1
Fork 0

Remove rarely used neovim plugins

This commit is contained in:
prescientmoon 2024-02-25 10:46:56 +01:00
parent c13e628cd7
commit d560d0bf84
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
8 changed files with 28 additions and 647 deletions

View file

@ -91,7 +91,6 @@ Here's some things you might want to check out:
- [Neovim](https://neovim.io/) — my editor
- [Neovide](https://neovide.dev/index.html) — neovim gui client
- [Vimclip](https://github.com/hrantzsch/vimclip) — vim anywhere!
- [Firenvim](https://github.com/glacambre/firenvim) — embed neovim in web browsers
- [Tmux](https://github.com/tmux/tmux/wiki) — terminal multiplexer
- [Fish](https://fishshell.com/) — user friendly shell
- [Starship](https://starship.rs/) — shell prompt
@ -122,6 +121,9 @@ Most services are served over [tailscale](https://tailscale.com/), using certifi
Includes links to stuff which used to be in the previous section but is not used anymore. Only created this section in June 2023, so stuff I used earlier might not be here. Sorted with the most recently dropped things at the top.
- [firenvim](https://glacambre/firenvim) - the concept is cool, but I found the whole thing pretty annoying at times
- [venn.nvim](https://jbyuki/venn.nvim) — the concept is cool, but I would use it about once a year
- [hydra.nvim](https://anuvyklack/hydra.nvim) — I was rarely using it, and it was taking up precious config space
- [winbar.nvim](https://github.com/fgheng/winbar.nvim) — I mostly had this here for the looks, so I moved the path it provided to my statusbar
- [treesitter-visual-context.nvim](https://github.com/haringsrob/nvim_context_vt) — felt like this was cluttering my screen more than anything
- [Paperplanes.nvim](https://rktjmp/paperplanes.nvim) — replaced by a single curl call

View file

@ -83,8 +83,6 @@ in
vimium-c # vim keybinds
youtube-shorts-block
]
# summons a nvim instance inside the browser
(optional config.satellite.toggles.neovim.enable firenvim)
];
# }}}
# {{{ Search engines

View file

@ -22,7 +22,6 @@
"gitsigns": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" },
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
"hyprland": { "branch": "main", "commit": "71760fe0cad972070657b0528f48456f7e0027b2" },
"idris": { "branch": "main", "commit": "8bff02984a33264437e70fd9fff4359679d910da" },
"inc-rename": { "branch": "main", "commit": "6f9b5f9cb237e12935144cdc535322b8c93c1b25" },
@ -45,21 +44,15 @@
"null-ls": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-lspconfig": { "branch": "master", "commit": "6b9f4bbe0aa1f351fd4845dc5fd4f3450b010f88" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" },
"nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" },
"paperlanes": { "branch": "master", "commit": "bd52c54c36ad2e9ac563ae1c6a4f6ed1f5faacd2" },
"plenary": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"rust-tools": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
"scrap": { "branch": "main", "commit": "cc8453ed613932c744c3d1ec42f379b78bd8b92c" },
"smart-splits.nvim": { "branch": "master", "commit": "e1e1e6ca3754bd8ef971fb69673cc17965eb9e37" },
"ssr": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
"telescope": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"treesitter": { "branch": "master", "commit": "19bf991be2403c10fa379fa0fb11b7de2560ac31" },
"treesitter-virtual-context": { "branch": "master", "commit": "8f7b6b46292e0819290b0d368abc3366b8a163fc" },
"typst": { "branch": "main", "commit": "e28d440c7ba4df2516d7d7f908c4fb664a8cf86c" },
"undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" },
"venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
"wakatime": { "branch": "master", "commit": "285c2e4e48fb0c63ced233c00fb10a2edb3b6c94" },
"web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
"winbar": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" }
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -2,12 +2,8 @@
let
korora = inputs.korora.lib;
nlib = import ../../../modules/common/korora-neovim.nix
{
inherit lib korora;
}
{
tempestModule = "my.tempest";
};
{ inherit lib korora; }
{ tempestModule = "my.tempest"; };
# {{{ Config helpers
# :p => expands path
@ -1354,36 +1350,30 @@ let
# {{{ extraPackages
extraPackages = with pkgs; [
# Language servers
nodePackages.typescript-language-server # typescript
# nodePackages_latest.purescript-language-server # purescript
lua-language-server # lua
rnix-lsp # nix
nil # nix
inputs.nixd.packages.${system}.nixd # nix
texlab # latex
nodePackages_latest.vscode-langservers-extracted # web stuff
# haskell-language-server # haskell
# Nix
rnix-lsp
nil
inputs.nixd.packages.${system}.nixd
# Formatters
stylua # Lua
# nodePackages_latest.purs-tidy # Purescript
nodePackages_latest.prettier # Js & friends
nodePackages_latest.prettier_d_slim # Js & friends
# Linters
# Python
ruff # Python linter
# Languages
nodePackages.typescript # typescript
# Web
nodePackages.typescript
nodePackages_latest.prettier
nodePackages_latest.prettier_d_slim
nodePackages_latest.vscode-langservers-extracted
nodePackages.typescript-language-server
# Latex
texlab
# texlive.combined.scheme-full
# Lua
lua-language-server
stylua
lua # For repls and whatnot
# Others
fd # file finder
# Latex setup
# texlive.combined.scheme-full # Latex stuff
# python38Packages.pygments # required for latex syntax highlighting
] ++ generated.dependencies;
# }}}
# {{{ extraRuntime
@ -1392,21 +1382,12 @@ let
"lua/nix" "init"
generated.lua);
extraRuntimePaths = [ generatedConfig ];
extraRuntimeJoinedPaths = pkgs.symlinkJoin
{
name = "nixified-neovim-lua-modules";
paths = extraRuntimePaths;
};
extraRuntime =
let snippets = config.satellite.dev.path
"home/features/neovim/snippets";
in
lib.concatStringsSep
","
[ extraRuntimeJoinedPaths snippets ];
lib.concatStringsSep ","
[ generatedConfig snippets ];
# }}}
# {{{ Client wrapper
# Wraps a neovim client, providing the dependencies
@ -1456,13 +1437,6 @@ let
extraArgs = "--set NEOVIDE_MULTIGRID true";
wrapFlags = flags: "-- ${flags}";
};
firenvim = wrapClient {
base = pkgs.neovim;
name = "firenvim";
binName = "nvim";
extraArgs = "--set GIT_DISCOVERY_ACROSS_FILESYSTEM 1";
};
# }}}
in
{
@ -1482,53 +1456,6 @@ in
pkgs.vimclip
];
# }}}
# {{{ Firenvim
home.file.".mozilla/native-messaging-hosts/firenvim.json" =
lib.mkIf config.programs.firefox.enable {
text =
let
# God knows what this does
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
firenvim_init = pkgs.writeText "firenvim_init.vim" /* vim */ ''
let g:firenvim_i=[]
let g:firenvim_o=[]
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
let g:Firenvim_oo={t->[chansend(2,t)]+add(g:firenvim_o,t)}
let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})
let g:started_by_firenvim = v:true
'';
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim" /* vim */ ''
try
call firenvim#run()
catch /Unknown function/
call chansend(g:firenvim_c,["f\n\n\n"..json_encode({"messages":["Your plugin manager did not load the Firenvim plugin for neovim."],"version":"0.0.0"})])
call chansend(2,["Firenvim not in runtime path. &rtp="..&rtp])
qall!
catch
call chansend(g:firenvim_c,["l\n\n\n"..json_encode({"messages": ["Something went wrong when running firenvim. See troubleshooting guide."],"version":"0.0.0"})])
call chansend(2,[v:exception])
qall!
endtry
'';
in
builtins.toJSON {
name = "firenvim";
description = "Turn your browser into a Neovim GUI.";
type = "stdio";
allowed_extensions = [ "firenvim@lacamb.re" ];
path = pkgs.writeShellScript "firenvim.sh" ''
mkdir -p /run/user/$UID/firenvim
chmod 700 /run/user/$UID/firenvim
cd /run/user/$UID/firenvim
exec '${firenvim}/bin/nvim' --headless \
--cmd 'source "${firenvim_init}"' \
-S '${firenvim_file_loaded}'
'';
};
};
# }}}
# {{{ Persistence
satellite.persistence.at.state.apps.neovim.directories = [
".local/state/nvim"