1
Fork 0

Many new snippets and homer update

This commit is contained in:
prescientmoon 2024-04-23 08:33:17 +02:00
parent aa6a5abcee
commit ed88b93171
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
23 changed files with 287 additions and 405 deletions

BIN
common/icons/github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
common/icons/porkbun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
common/icons/tailscale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1278,11 +1278,11 @@
"purifix": "purifix" "purifix": "purifix"
}, },
"locked": { "locked": {
"lastModified": 1713302426, "lastModified": 1713852340,
"narHash": "sha256-29m8oM9CtmvHKzfK1xfz2R7/Ae1GimmRyb3i27oIOw0=", "narHash": "sha256-4H5l6Hsg6SzhZwB8ikphlJmLtyi3xeUcPPsVh3gVd/k=",
"owner": "mateiadrielrafael", "owner": "mateiadrielrafael",
"repo": "miros", "repo": "miros",
"rev": "45b9ce1c3fedd548d824a01608e1a5c9570b8d95", "rev": "80a1cd4726b6d1b7b9d9ee4cfe850d87d524090b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1502,8 +1502,8 @@
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b8dd8be3c790215716e7c12b247f45ca525867e2",
"type": "github" "type": "github"
} }
}, },

View file

@ -15,6 +15,7 @@ let
localcdn # caches libraries locally localcdn # caches libraries locally
privacy-badger # blocks some trackers privacy-badger # blocks some trackers
privacy-pass # captcha stuff privacy-pass # captcha stuff
privacy-redirect # allows redirecting to my own instances for certain apps
skip-redirect # attempts to skip to the final reddirect for certain urls skip-redirect # attempts to skip to the final reddirect for certain urls
terms-of-service-didnt-read terms-of-service-didnt-read
translate-web-pages translate-web-pages

View file

@ -22,25 +22,6 @@ local abbreviations = {
{ "spt", "\\supset" }, { "spt", "\\supset" },
{ "sseq", "\\subseteq" }, { "sseq", "\\subseteq" },
{ "speq", "\\supseteq" }, { "speq", "\\supseteq" },
{ "nin", "\\not\\in" },
{ "iin", "\\in" },
{ "tto", "\\to" },
{ "land", "\\land" },
{ "lor", "\\lor" },
{ "ssin", "\\sin" },
{ "ccos", "\\cos" },
{ "ttan", "\\ttan" },
{ "ssec", "\\sec" },
{ "lln", "\\ln" },
{ "frl", "\\forall" },
{ "exs", "\\exists" },
{ "iinf", "\\infty" },
{ "ninf", "-\\infty" },
{ "nlnl", "\\pm" }, -- had this as npnp first but it was hard-ish to type
{ "ccup", "\\cup" },
{ "ccap", "\\cap" },
{ "nope", "\\bot" },
{ "yee", "\\top" },
{ "ccan", "\\cancel" }, { "ccan", "\\cancel" },
{ "com", "\\circ" }, { "com", "\\circ" },
{ "mul", "\\cdot" }, { "mul", "\\cdot" },
@ -57,24 +38,6 @@ local abbreviations = {
{ "sup", "\\sup" }, -- supremum { "sup", "\\sup" }, -- supremum
{ "limsup", "\\lim\\sup" }, -- Limit of the supremum { "limsup", "\\lim\\sup" }, -- Limit of the supremum
{ "cal", "\\mathcal" }, -- Limit of the supremum { "cal", "\\mathcal" }, -- Limit of the supremum
-- Decorations
{ "hat", "\\hat" },
{ "bar", "\\bar" },
-- Custom commands
{ "abs", "\\abs" }, -- custom abs command
{ "norm", "\\norm" }, -- custom norm command
{ "iprod", "\\iprod" }, -- custom inner product command
{ "diprod", "\\dprod" }, -- custom self inner product command
{ "prob", "\\prob" }, -- custom probability function
{ "dist", "\\dist" }, -- custom dist function
{ "oball", "\\ball" }, -- custom ball function
{ "diam", "\\diam" }, -- custom diam operator
{ "gen", "\\gen" }, -- custom command for group generated by element
{ "ord", "\\ordop" }, -- order of a group
{ "vsm", "\\vecspace" }, -- custom math vector space
{ "half", "\\half" }, -- 1/2 fraction
} }
local abolishAbbreviations = { local abolishAbbreviations = {
@ -93,16 +56,6 @@ local abolishAbbreviations = {
options = A.no_capitalization, options = A.no_capitalization,
}, },
-- }}} -- }}}
-- {{{ My own operator syntax:
-- - Any operator can be prefixed with "a" to
-- align in aligned mode
-- - Any operator can be prefixed with cr to
-- start a new line and align in aligned mode
{
"{cr,a,}{eq,neq,leq,geq,lt,gt,iff,iip,iib}",
"{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff,\\implies,\\impliedby}",
},
-- }}}
-- {{{ General function calls: -- {{{ General function calls:
-- {function-name}{modifier?}{argument}{argument-modifier?} -- {function-name}{modifier?}{argument}{argument-modifier?}
-- --

View file

@ -1,21 +1,10 @@
-- enable experimental lua loader -- Enable experimental lua loader
vim.loader.enable() vim.loader.enable()
vim.opt.runtimepath:prepend(vim.g.nix_extra_runtime)
-- bootstrap from github local tempest = require("my.tempest")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local nix = require("nix")
if not vim.loop.fs_stat(lazypath) then tempest.configureMany(nix.pre)
vim.fn.system({ require("my.lazy").setup()
"git", tempest.configureMany(nix.post)
"clone",
"--filter=blob:none",
"--single-branch",
"git@github.com:folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- Start the actual init process
require("my.init").setup()

View file

@ -1,11 +1,9 @@
{ {
"alpha-nvim": { "branch": "main", "commit": "1356b9ef31b985d541d94314f2cf73c61124bf1d" },
"catppuccin": { "branch": "main", "commit": "9703f227bfab20d04bcee62d2f08f1795723b4ae" }, "catppuccin": { "branch": "main", "commit": "9703f227bfab20d04bcee62d2f08f1795723b4ae" },
"clipboard-image": { "branch": "main", "commit": "485de5493d196154db30f85665f8ac480ce116a2" }, "clipboard-image": { "branch": "main", "commit": "485de5493d196154db30f85665f8ac480ce116a2" },
"cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
@ -27,16 +25,17 @@
"inc-rename": { "branch": "main", "commit": "6f9b5f9cb237e12935144cdc535322b8c93c1b25" }, "inc-rename": { "branch": "main", "commit": "6f9b5f9cb237e12935144cdc535322b8c93c1b25" },
"indent-blankline": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, "indent-blankline": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
"lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lean": { "branch": "main", "commit": "1a2a2dfbc7e6775e9ec8b84e5eadaf31fde1894e" }, "lean": { "branch": "main", "commit": "1a2a2dfbc7e6775e9ec8b84e5eadaf31fde1894e" },
"live-command": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" }, "live-command": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" },
"lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" }, "lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"luasnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "luasnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"mini.ai": { "branch": "main", "commit": "98e45e6832351354e41e82b32a80ce7537c20746" },
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
"mini.files": { "branch": "main", "commit": "eab771c69b787a3f042dc6505d15613c282aa786" }, "mini.files": { "branch": "main", "commit": "eab771c69b787a3f042dc6505d15613c282aa786" },
"mini.operators": { "branch": "main", "commit": "0765e4818086e96b8fb55d280e47af781a5bc56a" }, "mini.operators": { "branch": "main", "commit": "0765e4818086e96b8fb55d280e47af781a5bc56a" },
"mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" }, "mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" },
"mini.starter": { "branch": "main", "commit": "4cfe09ee18390708fcdbe3bc6e7a4f4a06731db9" },
"mini.statusline": { "branch": "main", "commit": "dfd3d2ba295473930f78f143852b9b53eb54ae2a" }, "mini.statusline": { "branch": "main", "commit": "dfd3d2ba295473930f78f143852b9b53eb54ae2a" },
"mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" },
"navigator": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "navigator": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
@ -44,7 +43,6 @@
"neodev": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, "neodev": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
"nui": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, "nui": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" },
"null-ls": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, "null-ls": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" },
"plenary": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "plenary": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"purescript": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" }, "purescript": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" },
"rust-tools": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, "rust-tools": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },

View file

@ -2,29 +2,12 @@ local A = require("my.abbreviations")
local scrap = require("scrap") local scrap = require("scrap")
local M = {} local M = {}
-- {{{ Ascii
M.ascii = {
{ "tto", "->" }, -- [t]o
{ "ffrom", "<-" }, -- [f]rom
{ "iip", "=>" }, -- [i]t [i]m[p]lies
{ "iib", "<=" }, -- [i]t's [i]mplied [b]ly
{ "leq", "<=" }, -- [l]ess than or [e][q]ual
{ "geq", ">=" }, -- [g]reater than or [e][q]ual
{ "seq", "=" }, -- [s]ingle [e][q]ual
{ "deq", "==" }, -- [d]ouble [e][q]ual
{ "land", "/\\" }, -- [l]ogial [a][n][d]
{ "lor", "\\/" }, -- [l]ogial [o][r]
}
-- }}}
M.words = { M.words = {
{ "thrf", "therefore" }, { "thrf", "therefore" },
} }
function M.setup() function M.setup()
A.manyGlobalAbbr(scrap.expand_many(M.words)) A.manyGlobalAbbr(scrap.expand_many(M.words))
A.manyGlobalAbbr(scrap.expand_many(M.ascii, { capitalized = false }))
end end
return M return M

View file

@ -19,35 +19,6 @@ M.words = {
{ "cex{,s}", "counterexample{}" }, { "cex{,s}", "counterexample{}" },
{ "er{t,s,r}", "{transitivity,symmetry,reflexivity}" }, { "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
-- }}} -- }}}
-- {{{ Special chars
-- System for writing special characters which need to also be easly
-- accessible as {sub/super}scripts.
--
-- The reason epsilon and lambda are separated out from everything else in
-- the pattern is because they are the only ones where `foo` doesn't expand
-- to `\\foo` directly (so I saved some keystrokes by letting scrap.nvim
-- repeat everything for me).
{
"{,e,s}{{eps,lam},{star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega}}",
"{,^,_}\\\\{{epsilon,lambda},{}}",
options = A.no_capitalization,
},
-- }}}
-- {{{ Set symbols
-- - nats => naturals
-- - ints => integers
-- - rats => rationals
-- - irats => irationals
-- - rrea => reals
-- - comp => complex
-- - ppri => primes
-- - ffie => fields
{
"{nats,ints,rats,irats,rrea,comp,ppri,ffie}",
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
options = A.no_capitalization,
},
-- }}}
-- {{{ Calculus & analysis -- {{{ Calculus & analysis
{ "ib{p,s}", "integration by {parts,substitution}" }, { "ib{p,s}", "integration by {parts,substitution}" },
{ "{o,c,}nb{,h}{,s}", "{open,closed,} neighbour{,hood}{}" }, { "{o,c,}nb{,h}{,s}", "{open,closed,} neighbour{,hood}{}" },

View file

@ -1,22 +0,0 @@
local M = {}
function M.setup()
vim.opt.runtimepath:append(vim.g.nix_extra_runtime)
local tempest = require("my.tempest")
local nix = require("nix")
-- Import my other files
tempest.configureMany(nix.pre)
require("my.keymaps").setup()
require("my.lazy").setup()
tempest.configureMany(nix.post)
require("luasnip.loaders.from_lua").lazy_load({
fs_event_providers = {
libuv = true,
},
})
end
return M

View file

@ -1,65 +0,0 @@
-- TODO: operator for wrapping motion with fold
local M = {}
-- {{{ Helpers
---Performs a basic move operation
---Moves a keybind to a different set of keys.
---Useful for moving built in keybinds out of the way.
---@param from string
---@param to string
---@param opts table|nil
function M.move(from, to, opts)
vim.keymap.set("n", to, from, opts)
vim.keymap.set("n", from, "<Nop>")
end
---Create a textobject defined by some delimiters
---@param from string
---@param to string
---@param name string
---@param opts table|nil
function M.delimitedTextobject(from, to, name, opts)
opts = opts or {}
if opts.desc == nil then
opts.desc = name
end
vim.keymap.set({ "v", "o" }, "i" .. from, "i" .. to, opts)
vim.keymap.set({ "v", "o" }, "a" .. from, "a" .. to, opts)
end
---Helper to create a normal mode mapping and give it some description.
---@param from string
---@param to string|function
---@param desc string
---@param silent boolean|nil
---@param isLocal boolean|nil
function M.nmap(from, to, desc, silent, isLocal)
if silent == nil then
silent = true
end
if isLocal == nil then
isLocal = false
end
vim.keymap.set(
"n",
from,
to,
{ desc = desc, silent = silent, buffer = isLocal }
)
end
-- }}}
function M.setup()
-- {{{ Text objects
M.delimitedTextobject("q", '"', "[q]uotes")
M.delimitedTextobject("a", "'", "[a]postrophes")
M.delimitedTextobject("r", "[", "squa[r]e brackets")
-- }}}
end
return M

View file

@ -1,70 +0,0 @@
local runtime = require("my.tempest")
local header_string = [[
]]
local header = runtime.helpers.split(header_string, "\n")
local M = {
"goolord/alpha-nvim",
dependencies = { "web-devicons" },
config = function()
local theme = require("alpha.themes.dashboard")
theme.opts.width = 70
theme.opts.position = "center"
theme.section.buttons.val = {}
-- See [the header generator](https://patorjk.com/software/taag/#p=display&v=0&f=ANSI%20Shadow&t=NEOVim%20%3A3)
theme.section.header.opts.hl = "AlphaHeader"
theme.section.header.val = header
local version = vim.version()
local footer = function()
local versionString = "🚀 "
.. version.major
.. "."
.. version.minor
.. "."
.. version.patch
local lazy_ok, lazy = pcall(require, "lazy")
if lazy_ok then
local total_plugins = lazy.stats().count .. " Plugins"
local startuptime = (
math.floor(lazy.stats().startuptime * 100 + 0.5) / 100
)
return versionString
.. " — 🧰 "
.. total_plugins
.. " — 🕐 "
.. startuptime
.. "ms"
else
return version
end
end
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
theme.section.footer.val = footer()
vim.cmd("AlphaRedraw")
end,
desc = "Footer for Alpha",
})
theme.section.footer.opts.hl = "AlphaFooter"
theme.section.header.opts.hl = "AlphaHeader"
theme.section.buttons.opts.hl = "AlphaButton"
require("alpha").setup(theme.config)
end,
lazy = false,
cond = runtime.blacklist({ "vscode", "firenvim" }),
}
return M

View file

@ -75,7 +75,7 @@ let
# }}} # }}}
# {{{ Folding # {{{ Folding
foldmethod = "marker"; # use {{{ }}} for folding foldmethod = "marker"; # use {{{ }}} for folding
foldcolumn = "1"; # show column with folds on the left foldcolumn = "0"; # show no column with folds on the left
# }}} # }}}
}; };
@ -262,9 +262,10 @@ let
}; };
}; };
# }}} # }}}
# {{{ Language specific settings # {{{ Language specific overrides
"5:language-specific-settings" = { "5:language-specific-settings" = {
autocmds = [ autocmds = [
# {{{ Nix
{ {
event = "FileType"; event = "FileType";
group = "UserNixSettings"; group = "UserNixSettings";
@ -282,6 +283,8 @@ let
}; };
}; };
} }
# }}}
# {{{ Purescript
{ {
event = "FileType"; event = "FileType";
group = "UserPurescriptSettings"; group = "UserPurescriptSettings";
@ -291,6 +294,7 @@ let
commentstring = "-- %s"; commentstring = "-- %s";
}; };
} }
# }}}
]; ];
}; };
# }}} # }}}
@ -589,7 +593,6 @@ let
package = "nvim-treesitter/nvim-treesitter"; package = "nvim-treesitter/nvim-treesitter";
main = "nvim-treesitter.configs"; main = "nvim-treesitter.configs";
dependencies.lua = [ "nvim-treesitter/nvim-treesitter-textobjects" ];
dependencies.nix = [ pkgs.tree-sitter ]; dependencies.nix = [ pkgs.tree-sitter ];
cond = blacklist "vscode"; cond = blacklist "vscode";
@ -602,45 +605,7 @@ let
additional_vim_regex_highlighting = false; additional_vim_regex_highlighting = false;
}; };
#}}} #}}}
# {{{ Textobjects
opts.textobjects = {
#{{{ Select
select = {
enable = true;
lookahead = true;
keymaps = {
# You can use the capture groups defined in textobjects.scm
af = "@function.outer";
"if" = "@function.inner";
ac = "@class.outer";
ic = "@class.inner";
};
};
#}}}
#{{{ Move
move = {
enable = true;
set_jumps = true; # whether to set jumps in the jumplist
goto_next_start = {
"]f" = "@function.outer";
"]t" = "@class.outer";
};
goto_next_end = {
"]F" = "@function.outer";
"]T" = "@class.outer";
};
goto_previous_start = {
"[f" = "@function.outer";
"[t" = "@class.outer";
};
goto_previous_end = {
"[F" = "@function.outer";
"[T" = "@class.outer";
};
};
#}}}
};
# }}}
opts.indent.enable = true; opts.indent.enable = true;
}; };
# }}} # }}}
@ -656,6 +621,24 @@ let
# opts.enable = true; # opts.enable = true;
# }; # };
# }}} # }}}
# {{{ mini.starter
mini-starter = {
package = "echasnovski/mini.starter";
name = "mini.starter";
cond = blacklist [ "vscode" "firenvim" ];
lazy = false;
opts = _: {
header = builtins.readFile ./header.txt;
footer = importFrom ./plugins/ministarter.lua "lazy_stats_item";
content_hooks = [
(lua ''require("mini.starter").gen_hook.adding_bullet()'')
(lua ''require("mini.starter").gen_hook.aligning('center', 'center')'')
];
silent = true;
};
};
# }}}
# }}} # }}}
# {{{ editing # {{{ editing
# {{{ text navigation # {{{ text navigation
@ -753,6 +736,29 @@ let
opts.keymaps.replace_all = "<s-cr>"; opts.keymaps.replace_all = "<s-cr>";
}; };
# }}} # }}}
# {{{ mini.ai
mini-ai = {
package = "echasnovski/mini.ai";
name = "mini.ai";
event = "VeryLazy";
opts = _: # lazy, as we import mini.ai inside
let balanced = from: [ "%b${from}" "^.().*().$" ];
in
{
custom_textobjects = {
b = balanced "()";
B = balanced "{}";
r = balanced "[]";
v = balanced "";
q = balanced "\"\"";
Q = balanced "``";
a = balanced "''";
A = lua "require('mini.ai').gen_spec.argument()";
};
};
};
# }}}
# {{{ mini.comment # {{{ mini.comment
mini-comment = { mini-comment = {
package = "echasnovski/mini.comment"; package = "echasnovski/mini.comment";
@ -805,6 +811,7 @@ let
r = mk true "%b[]" "[" "]"; r = mk true "%b[]" "[" "]";
v = mk true "%b" "" ""; v = mk true "%b" "" "";
q = mk false "\".-\"" "\"" "\""; q = mk false "\".-\"" "\"" "\"";
Q = mk false "`.-`" "`" "`";
a = mk false "'.-'" "'" "'"; a = mk false "'.-'" "'" "'";
}; };
# }}} # }}}
@ -835,70 +842,72 @@ let
package = "echasnovski/mini.pairs"; package = "echasnovski/mini.pairs";
name = "mini.pairs"; name = "mini.pairs";
config = true;
# We could specify all the generated bindings, but I don't think it's worth it # We could specify all the generated bindings, but I don't think it's worth it
event = [ "InsertEnter" "CmdlineEnter" ]; event = [ "InsertEnter" "CmdlineEnter" ];
}; };
# }}} # }}}
# {{{ luasnip # {{{ luasnip
# snippeting engine # snippeting engine
luasnip = luasnip = {
{ package = "L3MON4D3/LuaSnip";
package = "L3MON4D3/LuaSnip"; version = "v2";
version = "v2";
cond = blacklist "vscode"; cond = blacklist "vscode";
config = thunk '' config = thunk ''
require("luasnip").config.setup(${encode { require("luasnip").config.setup(${encode {
enable_autosnippets = true; enable_autosnippets = true;
update_events = ["TextChanged" "TextChangedI"]; update_events = ["TextChanged" "TextChangedI"];
}}) }})
'';
# {{{ Keybinds require("luasnip.loaders.from_lua").lazy_load(${encode {
keys = [ fs_event_providers.libuv = true;
{ }})
mode = "i"; '';
expr = true;
mapping = "<tab>";
action = thunk /* lua */ ''
local luasnip = require("luasnip")
if not luasnip.jumpable(1) then # {{{ Keybinds
return "<tab>" keys = [
end {
mode = "i";
expr = true;
mapping = "<tab>";
action = thunk /* lua */ ''
local luasnip = require("luasnip")
vim.schedule(function() if not luasnip.jumpable(1) then
luasnip.jump(1) return "<tab>"
end) end
return "<ignore>" vim.schedule(function()
''; luasnip.jump(1)
desc = "Jump to next snippet tabstop"; end)
}
{ return "<ignore>"
mode = "i"; '';
mapping = "<s-tab>"; desc = "Jump to next snippet tabstop";
action = thunk /* lua */ '' }
require("luasnip").jump(-1) {
''; mode = "i";
desc = "Jump to previous snippet tabstop"; mapping = "<s-tab>";
} action = thunk /* lua */ ''
{ require("luasnip").jump(-1)
mode = "is"; '';
mapping = "<c-a>"; desc = "Jump to previous snippet tabstop";
action = "<Plug>luasnip-prev-choice"; }
desc = "Previous snippet node choice"; {
} mode = "is";
{ mapping = "<c-a>";
mode = "is"; action = "<Plug>luasnip-prev-choice";
mapping = "<c-f>"; desc = "Previous snippet node choice";
action = "<Plug>luasnip-next-choice"; }
desc = "Next snippet node choice"; {
} mode = "is";
]; mapping = "<c-f>";
# }}} action = "<Plug>luasnip-next-choice";
}; desc = "Next snippet node choice";
}
];
# }}}
};
# }}} # }}}
# {{{ miros # {{{ miros
# snippeting generation language # snippeting generation language
@ -1145,7 +1154,6 @@ let
"hrsh7th/cmp-cmdline" "hrsh7th/cmp-cmdline"
"hrsh7th/cmp-path" "hrsh7th/cmp-path"
"saadparwaiz1/cmp_luasnip" "saadparwaiz1/cmp_luasnip"
"dmitmel/cmp-digraphs"
# }}} # }}}
"onsails/lspkind.nvim" # show icons in lsp completion menus "onsails/lspkind.nvim" # show icons in lsp completion menus
"luasnip" "luasnip"
@ -1522,7 +1530,12 @@ let
"lua/nix" "init" "lua/nix" "init"
generated.lua); generated.lua);
extraRuntime = lib.concatStringsSep "," [ generatedConfig mirosSnippetCache ]; extraRuntime = lib.concatStringsSep "," [
generatedConfig
mirosSnippetCache
"${pkgs.vimPlugins.lazy-nvim}"
];
# }}} # }}}
# {{{ Client wrapper # {{{ Client wrapper
# Wraps a neovim client, providing the dependencies # Wraps a neovim client, providing the dependencies

View file

@ -0,0 +1,6 @@
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ██████╗
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ██╗╚════██╗
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ╚═╝ █████╔╝
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██╗ ╚═══██╗
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ╚═╝██████╔╝
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝

View file

@ -60,7 +60,6 @@ function M.config()
{ name = "buffers" }, { name = "buffers" },
{ name = "emoji" }, { name = "emoji" },
{ name = "path" }, { name = "path" },
{ name = "digraphs" },
}), }),
-- }}} -- }}}
} }

View file

@ -0,0 +1,40 @@
local M = {}
local version = vim.version()
local version_string = "🚀 "
.. version.major
.. "."
.. version.minor
.. "."
.. version.patch
local lazy_stats = nil
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local lazy_ok, lazy = pcall(require, "lazy")
if lazy_ok then
lazy_stats = {
total_plugins = lazy.stats().count .. " Plugins",
startup_time = math.floor(lazy.stats().startuptime * 100 + 0.5) / 100,
}
require("mini.starter").refresh()
end
end,
})
function M.lazy_stats_item()
if lazy_stats ~= nil then
return version_string
.. " — 🧰 "
.. lazy_stats.total_plugins
.. " — 🕐 "
.. lazy_stats.startup_time
.. "ms"
else
return version_string
end
end
return M

View file

@ -0,0 +1,9 @@
block auto
abbr tto ->
abbr ffrom <-
abbr iip =>
abbr iib <=
abbr leq <=
abbr geq >=
abbr land /\
abbr lor /\

View file

@ -10,7 +10,7 @@ block start auto
string @kind string @kind
name @kind definition name @kind definition
desc Define a @⟨@kind:type,newtype,adt⟩ desc Define a @⟨@kind:type,newtype,adt⟩
snip data $1 = $2 snip @kind $1 = $2
string example string example
name example docstring name example docstring
@ -44,18 +44,17 @@ block start auto
string derive string derive
name derive typeclass instance name derive typeclass instance
desc Derive a typeclass instance desc Derive a typeclass instance
snip snip derive instance $|1⟨$1,newtype $1⟩instance $0
derive $|1⟨$1,newtype $1⟩instance $0
for typeclass <- @⟨Eq,Ord,Functor⟩ for typeclass <- @⟨Eq,Ord,Functor⟩
string d@⟨@typeclass:eq,ord,functor⟩ string d@⟨@typeclass:eq,ord,functor⟩
name derive @typeclass name derive @typeclass
snip derive @typeclass $0 snip derive instance @typeclass $0
for typeclass <- @⟨Newtype,Generic⟩ for typeclass <- @⟨Newtype,Generic⟩
string d@⟨@typeclass:newtype,generic⟩ string d@⟨@typeclass:newtype,generic⟩
name derive @typeclass name derive @typeclass
snip derive @typeclass $1 _ snip derive instance @typeclass $1 _
for typeclass <- @⟨Show,Debug⟩ for typeclass <- @⟨Show,Debug⟩
for lower <- @⟨@typeclass:show,debug⟩ for lower <- @⟨@typeclass:show,debug⟩

View file

@ -1,11 +1,19 @@
for thmenv <- @⟨theorem,lemma,exercise,definition,corollary,example⟩ for thmenv <- @⟨theorem,lemma,exercise,definition,corollary,example⟩
for thmprefix <- @⟨@thmenv:thm,lem,exe,def,cor,exa⟩ for thmprefix <- @⟨@thmenv:thm,lem,exe,def,cor,exa⟩
block auto !math start block auto start
for env <- @⟨$1,enumerate,itemize,align*⟩ string begin
name environment
snip
\begin{$1}
$0
\end{$1}
string @⟨@env:begin,olist,ulist,dm⟩ block auto !math start
name @⟨@env:environment,ordered list,unordered list,display math⟩ for env <- @⟨enumerate,itemize,align*⟩
string @⟨@env:olist,ulist,dm⟩
name @⟨@env:ordered list,unordered list,display math⟩
snip snip
\begin{@env} \begin{@env}
$0 $0
@ -84,10 +92,12 @@ block math
$7 & $8 & $9 $7 & $8 & $9
\end{@matenv} \end{@matenv}
for operator <- @⟨eq,neq,leq,geq,lt,gt⟩ for operator <- @⟨eq,neq,defas,leq,geq,lt,gt,iip,iib
for symbol <- @⟨@operator:=,\neq,\leq,\geq,<,>⟩ for symbol <- @⟨@operator:=,\neq,\coloneq,\leq,\geq,<,>,\implies,\impliedby
block auto block auto
abbr @operator @symbol
string a@operator string a@operator
name align at @operator name align at @operator
snip &@symbol $0 snip &@symbol $0
@ -147,19 +157,45 @@ block math
⟩}}$0 ⟩}}$0
block auto block auto
for constant <- @⟨star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega⟩ for constkind <- @⟨default,shortened⟩
string @constant for constant <- @⟨@constkind:
snip \\@constant @⟨star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega,half,ordop,land,lor⟩,
@⟨lam,eps,iinf⟩
for expansion <- @⟨@constkind:
@constant,
@⟨@constant:lambda,epsilon,ifty⟩
for shortconstant <- @⟨eps,lam⟩ for operator <- @⟨,e,s
string @shortconstant string @operator@constant
snip \\@⟨@shortconstant:epsilon,lambda⟩ snip @⟨@operator:,^,_⟩\\@expansion
for operator <- @⟨overline,hat,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod⟩ abbr niinf -\ifty
abbr eniinf ^{-\ifty}
abbr sniinf _{-\ifty}
abbr frl \forall
abbr exs \exists
abbr nin \not\in
abbr ccup \cup
abbr ccap \cap
abbr nope \bot
abbr yee \top
abbr nlnl \pm
abbr vsm \vecspace
abbr oball \ball
for noperator <- @⟨ordop,land,lor⟩
string @noperator
snip \\@noperator
for operator <- @⟨overline,hat,bar,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod,gen,diam,prob⟩
string @operator string @operator
snip \\@operator$|1⟨{$1}, $0⟩ snip \\@operator$|1⟨{$1}, $0⟩
for bioperator <- @⟨iprod,frac,binom⟩ for bioperator <- @⟨iprod,frac,binom,dist
string @bioperator string @bioperator
snip \\@bioperator$|1⟨ $1,{$1}⟩$|2⟨ $2,{$2}⟩ $0 snip \\@bioperator$|1⟨ $1,{$1}⟩$|2⟨ $2,{$2}⟩ $0
@ -167,25 +203,33 @@ block math
desc Create a set by escaping the brackets desc Create a set by escaping the brackets
snip \{$1\} snip \{$1\}
pattern e([%a%d]) pattern (.*)e@⟨t(%a),(%d)
name auto exponent name auto exponent
snip ^@0 snip @0^@1 $0
pattern s([%a%d]) pattern (.*)so(%a)
name auto subscript name auto subscript
snip _@0 snip @0_@1 $0
pattern (\?[%a]+)(%d) pattern (\?[%a]+)(%d)
name auto digt subscript name auto digt subscript
snip @0_@1 snip @0_@1 $0
string ss string ss
name subscript name subscript
snip _{$1}$0 snip _{$1} $0
string ee string ee
name exponent name exponent
snip ^{$1}$0 snip ^{$1} $0
pattern (%a)(.)pp
name auto parenthesis
snip @0(@1) $0
pattern (%a)d(.)p
name auto parenthesis
snip @0'(@1) $0
for limtarget <- @⟨anything,zero,infinity,negative infinity⟩ for limtarget <- @⟨anything,zero,infinity,negative infinity⟩
for prefix <- @⟨@limtarget:,z,i,n⟩ for prefix <- @⟨@limtarget:,z,i,n⟩

View file

@ -147,6 +147,32 @@ in
]; ];
} }
# }}} # }}}
# {{{ External
{
name = "External";
icon = fa "arrow-up-right-from-square";
items = [
{
name = "Dotfiles";
subtitle = "Configuration for all my machines";
logo = icon "github.png";
url = "https://github.com/mateiadrielrafael/everything-nix";
}
{
name = "Tailscale";
subtitle = "Access this homelab from anywhere";
logo = icon "tailscale.png";
url = "https://tailscale.com/";
}
{
name = "Porkbun";
subtitle = "Domain management";
logo = icon "porkbun.png";
url = "https://porkbun.com/account/domainsSpeedy";
}
];
}
# }}}
]; ];
}; };
}); });

View file

@ -29,6 +29,9 @@ in
WHOOGLE_CONFIG_DISABLE = "0"; WHOOGLE_CONFIG_DISABLE = "0";
WHOOGLE_CONFIG_BLOCK = lib.concatStringsSep "," websiteBlocklist; WHOOGLE_CONFIG_BLOCK = lib.concatStringsSep "," websiteBlocklist;
WHOOGLE_CONFIG_THEME = "system"; WHOOGLE_CONFIG_THEME = "system";
WHOOGLE_ALT_WIKI = ""; # disable redirecting wikipedia links
WHOOGLE_ALT_RD = "redlib.moonythm.dev";
WHOOGLE_ALT_YT = "yt.moonythm.dev";
}; };
}; };

View file

@ -81,21 +81,26 @@ let
} }
''; '';
encodeString = given: ''"${lib.escape ["\"" "\\"] (toString given)}"''; encodeString = given:
if lib.hasInfix "\n" given then
''[[${(toString given)}]]'' # This is not perfect but oh well
else
''"${lib.escape ["\"" "\\"] (toString given)}"'';
mkAttrName = s: mkAttrName = s:
let let
# These list *are* incomplete # A "good enough" approach to figuring out the correct encoding for attribute names
forbiddenChars = lib.stringToCharacters "<>[]{}()'\".,:;\\/*_"; allowedStartingChars = lib.stringToCharacters "abcdefghijklmnopqrstuvwxyz_";
allowedChars = allowedStartingChars ++ lib.stringToCharacters "0123456789";
keywords = [ "if" "then" "else" "do" "for" "local" "" ]; keywords = [ "if" "then" "else" "do" "for" "local" "" ];
in in
if lib.any (c: lib.hasInfix c s) forbiddenChars || lib.elem s keywords then if builtins.match "([a-zA-Z_][a-zA-Z_0-9]*)" s != [ s ] || lib.elem s keywords then
"[${helpers.encodeString s}]" "[${helpers.encodeString s}]"
else s; else s;
# }}} # }}}
}; };
# }}} # }}}
# {{{ This function takes a nix value and encodes it to a lua string. # {{{ Encoding
isLuaLiteral = given: lib.isAttrs given && given.__luaEncoderTag or null == "lua"; isLuaLiteral = given: lib.isAttrs given && given.__luaEncoderTag or null == "lua";
encodeWithDepth = depth: given: encodeWithDepth = depth: given:
let recurse = encodeWithDepth depth; in let recurse = encodeWithDepth depth; in