2022-09-09 00:16:11 +02:00
|
|
|
local A = require("my.abbreviations")
|
2022-10-09 03:28:51 +02:00
|
|
|
local AB = require("my.plugins.abolish")
|
2022-09-09 00:16:11 +02:00
|
|
|
|
2022-09-12 13:50:02 +02:00
|
|
|
require("my.helpers.wrapMovement").setup()
|
|
|
|
|
2022-09-26 22:54:16 +02:00
|
|
|
vim.opt.conceallevel = 0
|
2022-09-09 00:16:11 +02:00
|
|
|
vim.opt.wrap = true
|
|
|
|
|
|
|
|
vim.g.tex_conceal = "abdmg"
|
2022-09-26 22:54:16 +02:00
|
|
|
vim.g.vimtex_imaps_enabled = 0
|
2022-10-14 13:44:47 +02:00
|
|
|
-- vim.g.vimtex_syntax_conceal = 1
|
2022-09-09 00:16:11 +02:00
|
|
|
|
2022-11-14 01:16:10 +01:00
|
|
|
vim.keymap.set("n", "<leader>lg", function()
|
|
|
|
if not pcall(function()
|
|
|
|
local a = tonumber(vim.fn.input("A: "))
|
|
|
|
local b = tonumber(vim.fn.input("B: "))
|
|
|
|
|
|
|
|
local g, x, y = require("my.helpers.math.mod").gcd(a, b)
|
|
|
|
|
|
|
|
vim.fn.input("Result: " .. g .. " " .. x .. " " .. y)
|
|
|
|
end) then vim.fn.input("No results exist") end
|
|
|
|
end, { buffer = true, desc = "Gcd calculator" })
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>li", function()
|
|
|
|
if not pcall(function()
|
|
|
|
local class = tonumber(vim.fn.input("Mod class: "))
|
|
|
|
local num = tonumber(vim.fn.input("Number: "))
|
|
|
|
|
|
|
|
vim.fn.input("Result: " .. require("my.helpers.math.mod").modinverse(num, class))
|
|
|
|
end) then vim.fn.input("No results exist") end
|
|
|
|
end, { buffer = true, desc = "Mod inverse calculator" })
|
|
|
|
|
2022-09-09 00:16:11 +02:00
|
|
|
local abbreviations = {
|
|
|
|
-- Greek chars
|
|
|
|
{ "eps", "\\epsilon" },
|
|
|
|
{ "delta", "\\delta" },
|
2022-09-26 22:54:16 +02:00
|
|
|
{ "Delta", "\\Delta" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "pi", "\\pi" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "psi", "\\psi" },
|
|
|
|
{ "alpha", "\\alpha" },
|
|
|
|
{ "beta", "\\beta" },
|
2022-09-26 22:54:16 +02:00
|
|
|
{ "theta", "\\theta" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "gamma", "\\gamma" },
|
2022-10-09 03:28:51 +02:00
|
|
|
{ "lam", "\\lambda" },
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "nuls", "\\varnothing" }, -- Other fancy symvols
|
2022-11-01 16:48:18 +01:00
|
|
|
{ "ints", "\\mathbb{Z}" },
|
2022-10-13 01:05:38 +02:00
|
|
|
{ "nats", "\\mathbb{N}" },
|
|
|
|
{ "rats", "\\mathbb{Q}" },
|
2022-10-14 13:44:47 +02:00
|
|
|
{ "rrea", "\\mathbb{R}" },
|
|
|
|
{ "ppri", "\\mathbb{P}" },
|
|
|
|
{ "ffie", "\\mathbb{F}" },
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "ccom", "\\mathbb{C}" }, -- Exponents
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "ei", "^{-1}" },
|
|
|
|
{ "e0", "^{0}" },
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "e1", "^{1}" },
|
|
|
|
{ "e2", "^{2}" },
|
|
|
|
{ "e3", "^{3}" },
|
|
|
|
{ "e4", "^{4}" },
|
|
|
|
{ "en", "^{n}" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "etn", "^{-}" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "ett", "^{t}" },
|
2022-10-04 23:42:58 +02:00
|
|
|
{ "tmat", "^{T}" }, -- Tranpose of a matrix
|
2022-11-01 16:48:18 +01:00
|
|
|
{ "cmat", "^{*}" }, -- Conjugate of a matrix
|
2022-11-14 01:16:10 +01:00
|
|
|
{"ortco", "^{\\bot}"}, -- Orthogonal complement
|
|
|
|
{ "etp", "^{+}" }, -- Subscripts
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "s0", "_{0}" },
|
|
|
|
{ "s1", "_{1}" },
|
|
|
|
{ "s2", "_{2}" },
|
|
|
|
{ "s3", "_{3}" },
|
|
|
|
{ "s4", "_{4}" },
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "sn", "_{n}" }, -- Function calls
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "fx", "f(x)" },
|
|
|
|
{ "gx", "g(x)" },
|
|
|
|
{ "hx", "h(x)" },
|
|
|
|
{ "Px", "P(x)" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "Pn", "P(n)" },
|
|
|
|
{ "foa", "f(a)" },
|
|
|
|
{ "goa", "g(a)" },
|
|
|
|
{ "hoa", "h(a)" },
|
|
|
|
{ "dfx", "f'(x)" },
|
|
|
|
{ "dgx", "g'(x)" },
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "dhx", "h'(x)" }, -- Basic commands
|
2022-09-26 22:54:16 +02:00
|
|
|
{ "mangle", "\\measuredangle" },
|
|
|
|
{ "aangle", "\\angle" },
|
2022-09-26 02:17:39 +02:00
|
|
|
{ "creq", "\\\\&=" },
|
|
|
|
{ "aeq", "&=" },
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "leq", "\\leq" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "geq", "\\geq" },
|
|
|
|
{ "sdiff", "\\setminus" },
|
2022-09-12 13:50:02 +02:00
|
|
|
{ "sst", "\\subset" },
|
|
|
|
{ "sseq", "\\subseteq" },
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "neq", "\\neq" },
|
|
|
|
{ "nin", "\\not\\in" },
|
|
|
|
{ "iin", "\\in" },
|
|
|
|
{ "tto", "\\to" },
|
2022-09-12 13:50:02 +02:00
|
|
|
{ "iip", "\\implies" },
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "iff", "\\iff" },
|
|
|
|
{ "land", "\\land" },
|
|
|
|
{ "lor", "\\lor" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "ssin", "\\sin" },
|
|
|
|
{ "ccos", "\\cos" },
|
2022-10-13 01:05:38 +02:00
|
|
|
{ "ttan", "\\ttan" },
|
|
|
|
{ "ssec", "\\sec" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "lln", "\\ln" },
|
2022-09-09 00:16:11 +02:00
|
|
|
{ "frl", "\\forall" },
|
|
|
|
{ "exs", "\\exists" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "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" },
|
2022-09-25 22:03:11 +02:00
|
|
|
{ "ccan", "\\cancel" },
|
2022-10-04 23:42:58 +02:00
|
|
|
{ "comp", "\\circ" },
|
2022-09-18 01:00:32 +02:00
|
|
|
{ "mul", "\\cdot" },
|
|
|
|
{ "smul", "\\times" },
|
|
|
|
{ "texpl", "&& \\text{}" },
|
2022-10-04 23:42:58 +02:00
|
|
|
{ "card", "\\#" },
|
2022-10-13 01:33:24 +02:00
|
|
|
{ "div", "\\|" },
|
|
|
|
{ "ndiv", "\\not\\|\\:" },
|
|
|
|
|
2022-10-04 23:42:58 +02:00
|
|
|
-- words
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "rref", "reduced row echalon form" }
|
2022-09-09 00:16:11 +02:00
|
|
|
}
|
|
|
|
|
2022-11-14 01:16:10 +01:00
|
|
|
-- Todo: convert exponents and subscripts
|
|
|
|
-- to use this more concise notation.
|
2022-10-09 03:28:51 +02:00
|
|
|
local abolishAbbreviations = {
|
2022-10-14 13:44:47 +02:00
|
|
|
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
|
|
|
|
{ "ib{p,s}", "integration by {parts,substitution}" },
|
2022-11-01 16:48:18 +01:00
|
|
|
{ "mx{,s}", "matri{x,ces}" },
|
2022-11-14 01:16:10 +01:00
|
|
|
{ "thrf", "therefore" },
|
|
|
|
{ "dete{,s}", "determinant{}" },
|
|
|
|
{ "bcla", "by contradiction let's assume" },
|
|
|
|
{ "ort{n,g}", "orto{normal,gonal}" },
|
|
|
|
{ "l{in,de}", "linearly {independent,dependent}" }
|
2022-10-09 03:28:51 +02:00
|
|
|
}
|
|
|
|
|
2022-09-09 00:16:11 +02:00
|
|
|
A.manyLocalAbbr(abbreviations)
|
2022-10-13 01:33:24 +02:00
|
|
|
AB.abolishMany(abolishAbbreviations)
|
2022-10-14 13:44:47 +02:00
|
|
|
|
2022-11-14 01:16:10 +01:00
|
|
|
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>",
|
|
|
|
{ desc = "Compile current buffer using vimtex", buffer = true })
|