Move neovim dotfiles
This commit is contained in:
parent
bfc89aff7f
commit
a5eae4da13
78 changed files with 3 additions and 5 deletions
home/features/neovim/config/ftplugin
1
home/features/neovim/config/ftplugin/hkf.lua
Normal file
1
home/features/neovim/config/ftplugin/hkf.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.api.nvim_buf_set_option(0, "commentstring", "-- %s")
|
39
home/features/neovim/config/ftplugin/lua.lua
Normal file
39
home/features/neovim/config/ftplugin/lua.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local opts = function(desc)
|
||||
return { desc = desc, buffer = true }
|
||||
end
|
||||
|
||||
local function runLocal(functionName)
|
||||
return function()
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
local status, M = pcall(dofile, path)
|
||||
|
||||
if status then
|
||||
if M ~= nil then
|
||||
if type(M[functionName]) == "function" then
|
||||
M[functionName]()
|
||||
print("M." .. functionName .. "() executed succesfully!")
|
||||
else
|
||||
print("Module does not return a " .. functionName .. " function")
|
||||
end
|
||||
else
|
||||
print("Module returned nil")
|
||||
end
|
||||
else
|
||||
print("Cannot import current file :(")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>lf", ":source %<cr>", opts("Run [l]ua [f]ile "))
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ls",
|
||||
runLocal("setup"),
|
||||
opts("Run .[s]etup() in current file")
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>lc",
|
||||
runLocal("config"),
|
||||
opts("Run .[c]onfig() in current file")
|
||||
)
|
1
home/features/neovim/config/ftplugin/markdown.lua
Normal file
1
home/features/neovim/config/ftplugin/markdown.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("my.helpers.wrapMovement").enable()
|
9
home/features/neovim/config/ftplugin/nix.lua
Normal file
9
home/features/neovim/config/ftplugin/nix.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- Use _<leader>lg_ to fetchgit stuff
|
||||
vim.keymap.set("n", "<leader>lg", function()
|
||||
require("my.helpers").saveCursor(function()
|
||||
vim.cmd(":%!update-nix-fetchgit")
|
||||
end)
|
||||
end, { buffer = true, desc = "Update all fetchgit calls" })
|
||||
|
||||
-- Idk why this isn't here by default
|
||||
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")
|
19
home/features/neovim/config/ftplugin/purescript.lua
Normal file
19
home/features/neovim/config/ftplugin/purescript.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- Use vt to test
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>vt",
|
||||
':VimuxRunCommand "clear && spago test"<CR>',
|
||||
{ desc = "[V]imtex run [t]ests", buffer = true }
|
||||
)
|
||||
|
||||
-- Use vb to build
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>vb",
|
||||
':VimuxRunCommand "clear && spago build"<CR>',
|
||||
{ desc = "[V]imtex [b]uild", buffer = true }
|
||||
)
|
||||
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
|
||||
require("my.abbreviations.fp").setup()
|
198
home/features/neovim/config/ftplugin/tex.lua
Normal file
198
home/features/neovim/config/ftplugin/tex.lua
Normal file
|
@ -0,0 +1,198 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
|
||||
require("my.helpers.wrapMovement").enable()
|
||||
require("my.abbreviations.math").setup()
|
||||
|
||||
vim.opt.conceallevel = 0
|
||||
|
||||
-- {{{ Older functions for calculating things inside vim
|
||||
-- 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" })
|
||||
-- }}}
|
||||
|
||||
local abbreviations = {
|
||||
-- Other fancy symvols
|
||||
{ "tmat", "^T" }, -- Tranpose of a matrix
|
||||
{ "cmat", "^*" }, -- Conjugate of a matrix
|
||||
{ "sneg", "^C" }, -- Set complement
|
||||
{ "ortco", "^\\bot" }, -- Orthogonal complement
|
||||
{ "sinter", "^\\circ" }, -- Interior of a set
|
||||
{ "nuls", "\\varnothing" },
|
||||
|
||||
-- Basic commands
|
||||
{ "mangle", "\\measuredangle" },
|
||||
{ "aangle", "\\angle" },
|
||||
{ "sdiff", "\\setminus" },
|
||||
{ "sst", "\\subset" },
|
||||
{ "spt", "\\supset" },
|
||||
{ "sseq", "\\subseteq" },
|
||||
{ "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" },
|
||||
{ "com", "\\circ" },
|
||||
{ "mul", "\\cdot" },
|
||||
{ "smul", "\\times" },
|
||||
{ "card", "\\#" },
|
||||
{ "div", "\\|" },
|
||||
{ "ndiv", "\\not\\|\\:" },
|
||||
{ "perp", "\\perp" },
|
||||
{ "cdots", "\\cdots" }, -- center dots
|
||||
{ "ldots", "\\ldots" }, -- low dots
|
||||
{ "cldots", ",\\ldots," }, -- comma, low dots
|
||||
{ "frac", "\\frac" }, -- fraction
|
||||
{ "lim", "\\lim" }, -- Limit
|
||||
{ "sup", "\\sup" }, -- supremum
|
||||
{ "limsup", "\\lim\\sup" }, -- 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 = {
|
||||
-- {{{ 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,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ 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:
|
||||
-- {function-name}{modifier?}{argument}{argument-modifier?}
|
||||
--
|
||||
-- - function-name = f/g/h/P
|
||||
-- - modifier:
|
||||
-- - d => derivative
|
||||
-- - 2 => squared
|
||||
-- - 3 => cubed
|
||||
-- - i => inverse
|
||||
-- - argument = x/y/z/a/t/i/n/k
|
||||
-- - argument-modifier:
|
||||
-- - n => subscript n
|
||||
{
|
||||
"{f,g,h,P}{d,2,3,i,}{x,y,z,a,t,i,n,k}{n,}",
|
||||
"{}{',^2,^3,^\\{-1\\},}({}{_n,})",
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Graph theory
|
||||
-- Graph theory function syntax:
|
||||
-- gt[function]{graph}{modifier}
|
||||
-- - function:
|
||||
-- - basic functions: e/E/v/G/L
|
||||
-- - k => connectivity
|
||||
-- - a => size of the biggest stable set
|
||||
-- - w => size of the biggest clique
|
||||
-- - d => biggest degree
|
||||
-- - c{target}{kind} => {target} {kind} chromatic number
|
||||
-- - target:
|
||||
-- - vertices by default
|
||||
-- - e => edges
|
||||
-- - kind:
|
||||
-- - normal by default
|
||||
-- - l => list
|
||||
-- - graph:
|
||||
-- - G by default
|
||||
-- - s/x/y/h => S/X/Y/H
|
||||
-- - modifier:
|
||||
-- - a => '
|
||||
-- - 1/2 => _k
|
||||
{
|
||||
"gt{{e,E,v,V,L},k,a,w,d,md{,e},c{,e}{,l}}{,s,h,x,y}{,a,1,2}",
|
||||
"{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
}
|
||||
|
||||
local expanded = scrap.expand_many(abolishAbbreviations)
|
||||
|
||||
-- Last I checked this contained 1229 abbreviations
|
||||
-- print(#abbreviations + #expanded)
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
A.manyLocalAbbr(expanded)
|
||||
|
||||
vim.opt_local.list = false -- The lsp usese tabs for formatting
|
3
home/features/neovim/config/ftplugin/typst.lua
Normal file
3
home/features/neovim/config/ftplugin/typst.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require("my.helpers.wrapMovement").enable()
|
||||
require("my.abbreviations.math").setup()
|
||||
require("my.abbreviations.unicode").setup()
|
Loading…
Add table
Add a link
Reference in a new issue