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/lua/my
abbreviations
helpers.luahelpers
init.luakeymaps.lualazy.luaneovide.luaoptions.luaplugins
clipboard-image.luacmp.luacrates.luadashboard.luafirenvim.luaflash.luaformat-nvim.luagitsigns.luaharpoon.luahaskell-tools.luahydra.luaidris.luainit.luairon.lualean.lualspconfig.lualualine.lualuasnip.luamagma.luamini-files.luamini-operators.luamini-surround.luaneoconf.luaneogit.luaneorg.luanull-ls.luanvim-tree.luaobsidian.luarust-tools.luatelescope.lua
themes
treesitter.luavenn.luavimtex.luavimux.luawhichkey.lua
39
home/features/neovim/config/lua/my/abbreviations/fp.lua
Normal file
39
home/features/neovim/config/lua/my/abbreviations/fp.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
M.symols = {
|
||||
{ "mto", ">>=" }, -- [M]onadic [t]o
|
||||
{ "oalt", "<\\|>" }, -- [O]peration [A]lternative
|
||||
{ "omono", "<>" }, -- [O]peration [M]onoid
|
||||
}
|
||||
|
||||
M.types = {
|
||||
{ "tarr", "Array" },
|
||||
{ "tlis", "List" },
|
||||
{ "tmay", "Maybe" },
|
||||
{ "teff", "Effect" },
|
||||
{ "taff", "Aff" },
|
||||
{ "tnea", "NonEmptyArray" },
|
||||
}
|
||||
|
||||
M.functions = {
|
||||
{ "tfold", "toUnfoldable" }, -- [T]o [f]oldable
|
||||
{ "ffold", "fromFoldable" }, -- [F]rom un[f]oldable
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.types, A.no_capitalization)
|
||||
)
|
||||
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.symols, A.no_capitalization)
|
||||
)
|
||||
|
||||
scrap.many_local_abbreviations(
|
||||
scrap.expand_many(M.functions, A.no_capitalization)
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
30
home/features/neovim/config/lua/my/abbreviations/global.lua
Normal file
30
home/features/neovim/config/lua/my/abbreviations/global.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
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 = {
|
||||
{ "thrf", "therefore" },
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.words))
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.ascii, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/abbreviations/init.lua
Normal file
31
home/features/neovim/config/lua/my/abbreviations/init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local M = {}
|
||||
|
||||
M.no_capitalization = { capitalized = false }
|
||||
|
||||
function M.localAbbr(lhs, rhs)
|
||||
-- Create abbreviation
|
||||
vim.cmd(":iabbrev <buffer> " .. lhs .. " " .. rhs)
|
||||
end
|
||||
|
||||
function M.manyLocalAbbr(abbreviations)
|
||||
for _, value in pairs(abbreviations) do
|
||||
M.localAbbr(value[1], value[2])
|
||||
end
|
||||
end
|
||||
|
||||
function M.abbr(lhs, rhs)
|
||||
-- Create abbreviation
|
||||
vim.cmd(":iabbrev " .. lhs .. " " .. rhs)
|
||||
end
|
||||
|
||||
function M.manyGlobalAbbr(abbreviations)
|
||||
for _, value in pairs(abbreviations) do
|
||||
M.abbr(value[1], value[2])
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require("my.abbreviations.global").setup()
|
||||
end
|
||||
|
||||
return M
|
100
home/features/neovim/config/lua/my/abbreviations/math.lua
Normal file
100
home/features/neovim/config/lua/my/abbreviations/math.lua
Normal file
|
@ -0,0 +1,100 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
M.words = {
|
||||
-- {{{ General phrases
|
||||
{ "thrf", "therefore" },
|
||||
{ "bcla", "by contradiction let's assume" },
|
||||
{ "wlg", "without loss of generality" },
|
||||
{ "tits", "that is to say," },
|
||||
{ "wpbd", "we will prove the statement in both directions." },
|
||||
{ "stam{,s}", "statement{}" },
|
||||
{ "{ww,tt}{m,i}", "{which,this} {means,implies}" },
|
||||
{ "cex{,s}", "counterexample{}" },
|
||||
{ "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
|
||||
{ "ib{p,s}", "integration by {parts,substitution}" },
|
||||
{ "nb{,h}{,s}", "neighbour{,hood}{}" },
|
||||
-- }}}
|
||||
-- {{{ Linear algebra
|
||||
{ "rref", "reduced row echalon form" },
|
||||
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
|
||||
{ "mx{,s}", "matri{x,ces}" },
|
||||
{ "dete{,s}", "determinant{}" },
|
||||
{ "ort{n,g}", "orto{normal,gonal}" },
|
||||
{ "l{in,de}", "linearly {independent,dependent}" },
|
||||
{ "lcon{,s}", "linear combination{}" },
|
||||
{ "vst{,s}", "vector space{}" }, -- text vector space
|
||||
{
|
||||
"rizz", -- ok please ignore this one 💀
|
||||
"Riesz vector",
|
||||
options = A.no_capitalization,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Differential equations
|
||||
-- Note: we must add the space inside the {} in order for capitalization to work!
|
||||
{
|
||||
"{{s,o,l},}deq{s,}",
|
||||
"{{scalar,ordinary,linear} ,}differential equation{}",
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Graph theory
|
||||
{ "vx{,s}", "vert{ex,ices}" },
|
||||
{ "edg{,s}", "edge{}" },
|
||||
-- }}}
|
||||
}
|
||||
|
||||
M.notation = {
|
||||
-- {{{ Exponents and subscripts:
|
||||
-- {operation}{argument}
|
||||
-- - operation = e (exponent) | s (subscript)
|
||||
-- - argument = t{special} | {basic}
|
||||
-- - basic = 0-9|n|i|t|k
|
||||
-- - special =
|
||||
-- - "p" => +
|
||||
-- - "m" => -
|
||||
-- - "i" => -1
|
||||
{
|
||||
"{e,s}{{0,1,2,3,4,5,6,7,8,9,n,i,t,k},t{i,m,p}}",
|
||||
"{^,_}{{},{\\{-1\\},-,+}}",
|
||||
},
|
||||
-- }}}
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.words))
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.notation, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
149
home/features/neovim/config/lua/my/abbreviations/unicode.lua
Normal file
149
home/features/neovim/config/lua/my/abbreviations/unicode.lua
Normal file
|
@ -0,0 +1,149 @@
|
|||
local A = require("my.abbreviations")
|
||||
local scrap = require("scrap")
|
||||
local M = {}
|
||||
|
||||
-- {{{ Unicode
|
||||
M.unicode = {
|
||||
-- {{{ Logic
|
||||
{ "frl", "∀" }, -- [f]o[r]al[l]
|
||||
{ "exs", "∃" }, -- [e][x]ist[s]
|
||||
{ "land", "∧" }, -- [l]ogical [and]
|
||||
{ "Land", "⋀" }, -- arbitrary [l]ogical [and]
|
||||
{ "lor", "∨" }, -- [l]ogical [or]
|
||||
{ "Lor", "⋁" }, -- [l]ogical [or]
|
||||
{ "bot", "⊥" }, -- false
|
||||
{ "top", "⊤" }, -- true
|
||||
{ "iip", "⟹" }, -- [i]t [i]m[p]lies
|
||||
{ "iib", "⟸" }, -- [i]t's [i]mplied [b]y
|
||||
{ "iff", "⟺" }, -- [if] and only i[f]
|
||||
{ "lneg", "¬" }, -- [l]ogical [neg]ation
|
||||
-- }}}
|
||||
-- {{{ Set theory
|
||||
{ "nolla", "∅" },
|
||||
{ "sect", "∩" }, -- set intersection
|
||||
{ "Sect", "⋂" }, -- arbitrary set intersection
|
||||
{ "dsect", "⊓" }, -- disjoint set intersection (whatever that means lol)
|
||||
{ "union", "∪" }, -- set union
|
||||
{ "Union", "⋃" }, -- arbitrary set union
|
||||
{ "dnion", "⊔" }, -- disjoint set union
|
||||
-- {{{ Inclusions
|
||||
{ "sst", "⊂" }, -- [s]ub[s]et
|
||||
{ "nsst", "⊄" }, -- [n]ot [s]ub[s]et
|
||||
{ "sseq", "⊆" }, -- [s]ub[s]et or [eq]ual
|
||||
{ "nsseq", "⊈" }, -- [n]ot [s]ub[s]et or [eq]ual
|
||||
{ "psseq", "⊊" }, -- [p]roper [s]ub[s]et or [eq]ual
|
||||
{ "spt", "⊃" }, -- [s]u[p]erset
|
||||
{ "nspt", "⊅" }, -- [s]u[p]erset
|
||||
{ "speq", "⊇" }, -- [s]u[p]erset or [eq]ual
|
||||
{ "nspeq", "⊉" }, -- [n]ot [s]u[p]erset or [eq]ual
|
||||
{ "pspeq", "⊋" }, -- [p]roper [s]u[p]erset or [eq]ual
|
||||
-- }}}
|
||||
-- }}}
|
||||
-- {{{ Double stroked chars
|
||||
{ "AA", "𝔸" },
|
||||
{ "BB", "𝔹" },
|
||||
{ "CC", "ℂ" },
|
||||
{ "DD", "ⅅ" },
|
||||
{ "EE", "𝔼" },
|
||||
{ "FF", "𝔽" },
|
||||
{ "GG", "𝔾" },
|
||||
{ "HH", "ℍ" },
|
||||
{ "II", "𝕀" },
|
||||
{ "JJ", "𝕁" },
|
||||
{ "KK", "𝕂" },
|
||||
{ "LL", "𝕃" },
|
||||
{ "MM", "𝕄" },
|
||||
{ "NN", "ℕ" },
|
||||
{ "OO", "𝕆" },
|
||||
{ "PP", "ℙ" },
|
||||
{ "QQ", "ℚ" },
|
||||
{ "RR", "ℝ" },
|
||||
{ "SS", "𝕊" },
|
||||
{ "TT", "𝕋" },
|
||||
{ "UU", "𝕌" },
|
||||
{ "VV", "𝕍" },
|
||||
{ "WW", "𝕎" },
|
||||
{ "XX", "𝕏" },
|
||||
{ "YY", "𝕐" },
|
||||
{ "ZZ", "ℤ" },
|
||||
-- }}}
|
||||
-- {{{ Common operators
|
||||
{ "comp", "∘" }, -- composition
|
||||
{ "mul", "⋅" }, -- multiplication
|
||||
{ "sqrt", "√" }, -- square root
|
||||
{ "cbrt", "∛" }, -- cube root
|
||||
-- }}}
|
||||
-- {{{ Integrals
|
||||
{ "int", "∫" }, -- integral
|
||||
{ "iint", "∬" }, -- integral
|
||||
{ "iiint", "∭" }, -- integral
|
||||
{ "pint", "∮" }, -- integral
|
||||
{ "piint", "∯" }, -- integral
|
||||
{ "piiint", "∰" }, -- integral
|
||||
-- }}}
|
||||
-- {{{ Common relations
|
||||
{ "sim", "∼" }, -- similarity
|
||||
{ "simeq", "≃" },
|
||||
{ "cong", "≅" }, -- congruence
|
||||
{ "defas", "≔" }, -- defined as
|
||||
{ "eq", "=" }, -- [eq]ual
|
||||
{ "neq", "≠" }, -- [n]ot [eq]ual
|
||||
{ "leq", "≤" }, -- [l]ess than or [e][q]ual
|
||||
{ "geq", "≥" }, -- [g]reater than or [e][q]ual
|
||||
|
||||
{ "iin", "∈" }, -- [I]ncluded [i][n]
|
||||
{ "nin", "∉" }, -- [n]ot included [i][n]
|
||||
{ "iic", "∋" }, -- [I]n[c]ludes
|
||||
{ "nic", "∌" }, -- does'[n]t [i]n[c]lude
|
||||
-- }}}
|
||||
-- {{{ Greek characters
|
||||
{ "alpha", "α" },
|
||||
{ "beta", "β" },
|
||||
{ "gamma", "γ" },
|
||||
{ "Gamma", "Γ" },
|
||||
{ "delta", "δ" },
|
||||
{ "Delta", "Δ" },
|
||||
{ "eps", "ε" },
|
||||
{ "zeta", "ζ" },
|
||||
{ "eta", "η" },
|
||||
{ "theta", "θ" },
|
||||
{ "Theta", "Θ" },
|
||||
{ "iota", "ι" },
|
||||
{ "kappa", "κ" },
|
||||
{ "lambda", "λ" },
|
||||
{ "Lambda", "Λ" },
|
||||
{ "mu", "μ" },
|
||||
{ "nu", "ν" },
|
||||
{ "xi", "ξ" },
|
||||
{ "pi", "π" },
|
||||
{ "Pi", "∏" },
|
||||
{ "rho", "ρ" },
|
||||
{ "sigma", "ς" },
|
||||
{ "Sigma", "Σ" },
|
||||
{ "tau", "τ" },
|
||||
{ "upsilon", "υ" },
|
||||
{ "phi", "ϕ" },
|
||||
{ "Phi", "Φ" },
|
||||
{ "chi", "χ" },
|
||||
{ "psi", "ψ" },
|
||||
{ "Psi", "Ψ" },
|
||||
{ "omega", "ω" },
|
||||
{ "Omega", "Ω" },
|
||||
-- }}}
|
||||
-- {{{ Common symbols
|
||||
{ "iinf", "∞" },
|
||||
{ "star", "⋆" },
|
||||
{ "diamond", "⋄" },
|
||||
-- }}}
|
||||
-- {{{ Brackets
|
||||
{ "langle", "⟨" },
|
||||
{ "rangle", "⟩" },
|
||||
-- }}}
|
||||
}
|
||||
-- }}}
|
||||
|
||||
function M.setup()
|
||||
A.manyGlobalAbbr(scrap.expand_many(M.unicode, { capitalized = false }))
|
||||
end
|
||||
|
||||
return M
|
19
home/features/neovim/config/lua/my/helpers.lua
Normal file
19
home/features/neovim/config/lua/my/helpers.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local M = {}
|
||||
|
||||
function M.mergeTables(t1, t2)
|
||||
local t3 = {}
|
||||
|
||||
if t1 ~= nil then for k, v in pairs(t1) do t3[k] = v end end
|
||||
|
||||
if t2 ~= nil then for k, v in pairs(t2) do t3[k] = v end end
|
||||
|
||||
return t3
|
||||
end
|
||||
|
||||
function M.saveCursor(callback)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
callback()
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
end
|
||||
|
||||
return M
|
43
home/features/neovim/config/lua/my/helpers/env.lua
Normal file
43
home/features/neovim/config/lua/my/helpers/env.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local function makeEnv(cond)
|
||||
return {
|
||||
-- I am doing this to get type hints!
|
||||
active = function()
|
||||
return cond
|
||||
end,
|
||||
not_active = function()
|
||||
return not cond()
|
||||
end,
|
||||
unless = function(f)
|
||||
if not cond() then
|
||||
f()
|
||||
end
|
||||
end,
|
||||
when = function(f)
|
||||
if cond() then
|
||||
f()
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
vscode = makeEnv(function()
|
||||
return vim.g.vscode ~= nil
|
||||
end),
|
||||
neovide = makeEnv(function()
|
||||
return vim.g.neovide ~= nil or require("nix.env") == "neovide"
|
||||
end),
|
||||
firenvim = makeEnv(function()
|
||||
return vim.g.started_by_firenvim ~= nil or require("nix.env") == "firenvim"
|
||||
end),
|
||||
_and = function(a, b)
|
||||
return makeEnv(function()
|
||||
return a.active() and b.active()
|
||||
end)
|
||||
end,
|
||||
_or = function(a, b)
|
||||
return makeEnv(function()
|
||||
return a.active() or b.active()
|
||||
end)
|
||||
end,
|
||||
}
|
15
home/features/neovim/config/lua/my/helpers/math/mod.lua
Normal file
15
home/features/neovim/config/lua/my/helpers/math/mod.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
function M.modinverse(b, m)
|
||||
local g, x, _ = M.gcd(b, m)
|
||||
if g ~= 1 then return nil end
|
||||
return x % m
|
||||
end
|
||||
|
||||
function M.gcd(a, b)
|
||||
if a == 0 then return b, 0, 1 end
|
||||
local g, x1, y1 = M.gcd(b % a, a)
|
||||
return g, y1 - (math.floor(b / a)) * x1, x1
|
||||
end
|
||||
|
||||
return M
|
13
home/features/neovim/config/lua/my/helpers/string.lua
Normal file
13
home/features/neovim/config/lua/my/helpers/string.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M.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
|
||||
|
||||
return M
|
39
home/features/neovim/config/lua/my/helpers/wrapMovement.lua
Normal file
39
home/features/neovim/config/lua/my/helpers/wrapMovement.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local M = {}
|
||||
|
||||
local function swap(key)
|
||||
vim.keymap.set({ "n", "v" }, key, "g" .. key, { buffer = true })
|
||||
vim.keymap.set({ "n", "v" }, "g" .. key, key, { buffer = true })
|
||||
end
|
||||
|
||||
local function unswap(key)
|
||||
vim.keymap.del({ "n", "v" }, key)
|
||||
vim.keymap.del({ "n", "v" }, "g" .. key)
|
||||
end
|
||||
|
||||
function M.enable()
|
||||
vim.opt.wrap = true
|
||||
|
||||
swap("j")
|
||||
swap("k")
|
||||
swap("0")
|
||||
swap("$")
|
||||
end
|
||||
|
||||
function M.disable()
|
||||
vim.opt.wrap = false
|
||||
|
||||
unswap("j")
|
||||
unswap("k")
|
||||
unswap("0")
|
||||
unswap("$")
|
||||
end
|
||||
|
||||
function M.toggle()
|
||||
if vim.opt.wrap == true then
|
||||
M.disable()
|
||||
else
|
||||
M.enable()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
10
home/features/neovim/config/lua/my/init.lua
Normal file
10
home/features/neovim/config/lua/my/init.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Import my other files
|
||||
require("my.options").setup()
|
||||
require("my.keymaps").setup()
|
||||
require("my.lazy").setup()
|
||||
end
|
||||
|
||||
return M
|
125
home/features/neovim/config/lua/my/keymaps.lua
Normal file
125
home/features/neovim/config/lua/my/keymaps.lua
Normal file
|
@ -0,0 +1,125 @@
|
|||
local helpers = require("my.helpers")
|
||||
|
||||
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 perhapsOpts table|nil
|
||||
function M.delimitedTextobject(from, to, name, perhapsOpts)
|
||||
local opts = helpers.mergeTables(perhapsOpts or {}, { desc = name })
|
||||
|
||||
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()
|
||||
-- {{{ Free up q and Q
|
||||
M.move("q", "yq", { desc = "Record macro" })
|
||||
M.move("Q", "yQ")
|
||||
-- }}}
|
||||
-- {{{ Easier access to <C-^>
|
||||
M.move("<C-^>", "<Leader>a", { desc = "[A]lternate file" })
|
||||
-- }}}
|
||||
-- {{{ Quit all buffers
|
||||
M.nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
|
||||
-- }}}
|
||||
-- {{{ Replace word in file
|
||||
M.nmap("<leader>rw", ":%s/<C-r><C-w>/", "[R]eplace [w]ord in file")
|
||||
-- }}}
|
||||
-- {{{ Toggle settings
|
||||
M.nmap(
|
||||
"<leader>sw",
|
||||
require("my.helpers.wrapMovement").toggle,
|
||||
"toggle word [w]rap"
|
||||
)
|
||||
-- }}}
|
||||
-- {{{ Text objects
|
||||
M.delimitedTextobject("q", '"', "[q]uotes")
|
||||
M.delimitedTextobject("a", "'", "[a]postrophes")
|
||||
M.delimitedTextobject("r", "[", "squa[r]e brackets")
|
||||
-- }}}
|
||||
-- {{{Diagnostic keymaps
|
||||
M.nmap("[d", vim.diagnostic.goto_prev, "Goto previous [d]iagnostic")
|
||||
M.nmap("]d", vim.diagnostic.goto_next, "Goto next [d]iagnostic")
|
||||
M.move("J", "qj")
|
||||
M.nmap("J", vim.diagnostic.open_float, "Open current diagnostic")
|
||||
M.nmap("<leader>D", vim.diagnostic.setloclist, "[D]iagnostic loclist")
|
||||
-- }}}
|
||||
-- {{{ Chords (save, clipboard)
|
||||
-- Different chords get mapped to f keys by a custom script of mine.
|
||||
-- In the future, I might get this on my keyboard firmware.
|
||||
vim.keymap.set({ "i", "v" }, "<f10>", "<Esc>", { desc = "Exit insert mode" }) -- Exit inset mode using *jk*
|
||||
vim.keymap.set({ "n", "v" }, "<f11>", '"+', { desc = "Use global clipboard" }) -- Use global clipboard with *cp*
|
||||
M.nmap("<f12>", ":silent write<cr>", "Save current file") -- Save using *ji*
|
||||
-- }}}
|
||||
-- {{{ Shift-Enter for not continuing the current comment
|
||||
-- This does not preserve intendation. Not sure what a better solution would look like.
|
||||
vim.keymap.set("i", "<S-CR>", function()
|
||||
vim.paste({ "", "" }, -1)
|
||||
end, { desc = "Insert newline without continuing the current comment" })
|
||||
-- }}}
|
||||
-- {{{ Allow quiting basic buffers with "qq"
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help" },
|
||||
group = vim.api.nvim_create_augroup("BasicBufferQuitting", {}),
|
||||
callback = function(event)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"qq",
|
||||
"<cmd>close<cr>",
|
||||
{ buffer = event.buf, silent = true, desc = "[q]uit current buffer" }
|
||||
)
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
-- -- {{{ Winblend
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "*" },
|
||||
group = vim.api.nvim_create_augroup("WinblendSettings", {}),
|
||||
callback = function()
|
||||
vim.opt.winblend = 0
|
||||
end,
|
||||
})
|
||||
-- -- }}}
|
||||
end
|
||||
|
||||
return M
|
48
home/features/neovim/config/lua/my/lazy.lua
Normal file
48
home/features/neovim/config/lua/my/lazy.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("lazy").setup("my.plugins", {
|
||||
defaults = { lazy = true },
|
||||
install = {
|
||||
-- install missing plugins on startup. This doesn't increase startup time.
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = { "rose-pine", "catpuccin" },
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
dev = {
|
||||
-- Fallback to git when local plugin doesn't exist
|
||||
fallback = true,
|
||||
|
||||
-- Directory where I store my local plugin projects
|
||||
path = "~/Projects",
|
||||
|
||||
patterns = { "Mateiadrielrafael" },
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
paths = {
|
||||
-- Extra runtime path specified by nix
|
||||
os.getenv("NVIM_EXTRA_RUNTIME") or "",
|
||||
},
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>L", "<cmd>Lazy<cr>", { desc = "[L]azy ui" })
|
||||
|
||||
return M
|
14
home/features/neovim/config/lua/my/neovide.lua
Normal file
14
home/features/neovim/config/lua/my/neovide.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local default_length = 0.04
|
||||
-- vim.g.neovide_floating_blur_amount_x = 10.0
|
||||
-- vim.g.neovide_floating_blur_amount_y = 10.0
|
||||
vim.g.neovide_transparency = 0.5
|
||||
-- vim.g.transparency = 0.6
|
||||
-- vim.g.pumblend = 0
|
||||
vim.g.neovide_cursor_animation_length = default_length
|
||||
vim.g.neovide_cursor_animate_in_insert_mode = false
|
||||
end
|
||||
|
||||
return M
|
49
home/features/neovim/config/lua/my/options.lua
Normal file
49
home/features/neovim/config/lua/my/options.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Disable filetype.vim
|
||||
vim.g.do_filetype_lua = true
|
||||
vim.g.did_load_filetypes = false
|
||||
|
||||
-- Basic options
|
||||
vim.opt.joinspaces = false -- No double spaces with join
|
||||
vim.opt.list = true -- Show some invisible characters
|
||||
vim.opt.cmdheight = 0 -- Hide command line when it's not getting used
|
||||
|
||||
-- tcqj are there by default, and "r" automatically continues comments on enter
|
||||
vim.opt.formatoptions = "tcqjr"
|
||||
|
||||
-- Line numbers
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers
|
||||
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
vim.opt.shiftwidth = 2 -- Size of an indent
|
||||
vim.opt.tabstop = 2 -- Size of tab character
|
||||
vim.opt.shiftround = true -- When using < or >, rounds to closest multiple of shiftwidth
|
||||
vim.opt.smartindent = true -- Insert indents automatically
|
||||
|
||||
vim.opt.scrolloff = 4 -- Starts scrolling 4 lines from the edge of the screen
|
||||
vim.opt.termguicolors = true -- True color support
|
||||
|
||||
vim.opt.ignorecase = true -- Ignore case
|
||||
vim.opt.smartcase = true -- Do not ignore case with capitals
|
||||
|
||||
vim.opt.splitbelow = true -- Put new windows below current
|
||||
vim.opt.splitright = true -- Put new windows right of current
|
||||
|
||||
vim.opt.wrap = false -- Disable line wrap (by default)
|
||||
vim.opt.wildmode = { "list", "longest" } -- Command-line completion mode
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
vim.opt.undofile = true -- persist undos!!
|
||||
|
||||
-- Set leader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldmethod = "marker" -- use {{{ }}} for folding
|
||||
vim.opt.foldcolumn = "1" -- show column with folds on the left
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,42 @@
|
|||
local M = {
|
||||
"postfen/clipboard-image.nvim",
|
||||
cmd = "PasteImg",
|
||||
}
|
||||
|
||||
local function img_name()
|
||||
vim.fn.inputsave()
|
||||
local name = vim.fn.input("Name: ")
|
||||
vim.fn.inputrestore()
|
||||
|
||||
if name == nil or name == "" then
|
||||
return os.date("%y-%m-%d-%H-%M-%S")
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>p",
|
||||
":PasteImg<cr>",
|
||||
{ desc = "[P]aste image from clipboard" }
|
||||
)
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("clipboard-image").setup({
|
||||
default = {
|
||||
img_name = img_name,
|
||||
},
|
||||
tex = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
affix = "\\includegraphics[width=\\textwidth]{%s}",
|
||||
},
|
||||
typst = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
affix = '#image("%s", width: 100)',
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
123
home/features/neovim/config/lua/my/plugins/cmp.lua
Normal file
123
home/features/neovim/config/lua/my/plugins/cmp.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"onsails/lspkind.nvim", -- show icons in lsp completion menus
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip", -- snippeting engine
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local function has_words_before()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0
|
||||
and vim.api
|
||||
.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
:sub(col, col)
|
||||
:match("%s")
|
||||
== nil
|
||||
end
|
||||
|
||||
function M.config()
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
local options = {
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
local kind = lspkind.cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 50,
|
||||
symbol_map = {
|
||||
Text = ".",
|
||||
},
|
||||
})(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
|
||||
-- Rust analyzer sometimes has this be nil when working with lifetime arguments.
|
||||
if strings[1] ~= nil then
|
||||
kind.kind = " " .. strings[1] .. " "
|
||||
end
|
||||
|
||||
kind.menu = ""
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-s>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffers" },
|
||||
{ name = "emoji" },
|
||||
{ name = "path" },
|
||||
-- { name = 'omni' },
|
||||
}),
|
||||
}
|
||||
|
||||
cmp.setup(options)
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
return M
|
51
home/features/neovim/config/lua/my/plugins/crates.lua
Normal file
51
home/features/neovim/config/lua/my/plugins/crates.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
local K = require("my.keymaps")
|
||||
local M = {
|
||||
"saecki/crates.nvim",
|
||||
event = "BufReadPost Cargo.toml",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local crates = require("crates")
|
||||
|
||||
crates.setup({
|
||||
null_ls = {
|
||||
enabled = true,
|
||||
name = "crates.nvim",
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceCargo", {}),
|
||||
pattern = "Cargo.toml",
|
||||
callback = function()
|
||||
require("cmp").setup.buffer({ sources = { { name = "crates" } } })
|
||||
end,
|
||||
})
|
||||
|
||||
local function nmap(from, to, desc)
|
||||
K.nmap(from, to, desc, true, true)
|
||||
end
|
||||
|
||||
nmap("<leader>lct", crates.toggle, "[c]rates [t]oggle")
|
||||
nmap("<leader>lcr", crates.reload, "[c]rates [r]efresh")
|
||||
|
||||
nmap("<leader>lcH", crates.open_homepage, "[c]rates [H]omepage")
|
||||
nmap("<leader>lcR", crates.open_repository, "[c]rates [R]repository")
|
||||
nmap("<leader>lcD", crates.open_documentation, "[c]rates [D]ocumentation")
|
||||
nmap("<leader>lcC", crates.open_crates_io, "[c]rates [C]rates.io")
|
||||
|
||||
nmap("<leader>lcv", crates.show_versions_popup, "[c]rates [v]ersions")
|
||||
nmap("<leader>lcf", crates.show_features_popup, "[c]rates [f]eatures")
|
||||
nmap("<leader>lcd", crates.show_dependencies_popup, "[c]rates [d]eps")
|
||||
nmap("K", crates.show_popup, "crates popup")
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
["<leader>lc"] = {
|
||||
name = "[l]ocal [c]rates",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
69
home/features/neovim/config/lua/my/plugins/dashboard.lua
Normal file
69
home/features/neovim/config/lua/my/plugins/dashboard.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local header_string = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ██████╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ██╗╚════██╗
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ╚═╝ █████╔╝
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██╗ ╚═══██╗
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ╚═╝██████╔╝
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
|
||||
]]
|
||||
|
||||
local header = require("my.helpers.string").split(header_string, "\n")
|
||||
|
||||
local M = {
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-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 footer = function()
|
||||
local version = "🚀 "
|
||||
.. vim.version().major
|
||||
.. "."
|
||||
.. vim.version().minor
|
||||
.. "."
|
||||
.. vim.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 version
|
||||
.. " — 🧰 "
|
||||
.. 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 = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
return M
|
61
home/features/neovim/config/lua/my/plugins/firenvim.lua
Normal file
61
home/features/neovim/config/lua/my/plugins/firenvim.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
local env = require("my.helpers.env")
|
||||
local K = require("my.keymaps")
|
||||
|
||||
local M = {
|
||||
"glacambre/firenvim", -- vim inside chrome
|
||||
lazy = false,
|
||||
cond = env.firenvim.active(),
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
function M.setup()
|
||||
M.config()
|
||||
print(vim.inspect(M.localSettings))
|
||||
end
|
||||
|
||||
return M
|
36
home/features/neovim/config/lua/my/plugins/flash.lua
Normal file
36
home/features/neovim/config/lua/my/plugins/flash.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local function keybind(keys, action, desc, modes)
|
||||
if modes == nil then
|
||||
modes = { "n", "x", "o" }
|
||||
end
|
||||
|
||||
return {
|
||||
keys,
|
||||
mode = modes,
|
||||
function()
|
||||
require("flash")[action]()
|
||||
end,
|
||||
desc = desc,
|
||||
}
|
||||
end
|
||||
|
||||
local M = {
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
---@type Flash.Config
|
||||
opts = {
|
||||
modes = {
|
||||
char = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
keybind("s", "jump", "Flash"),
|
||||
keybind("S", "treesitter", "Flash Treesitter"),
|
||||
keybind("r", "remote", "Remote Flash", { "o" }),
|
||||
keybind("R", "treesitter_search", "Treesitter Search", { "o", "x" }),
|
||||
keybind("<C-S>", "toggle", "Toggle Flash Search", { "c" }),
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
42
home/features/neovim/config/lua/my/plugins/format-nvim.lua
Normal file
42
home/features/neovim/config/lua/my/plugins/format-nvim.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
local env = require("my.helpers.env")
|
||||
local K = require("my.keymaps")
|
||||
|
||||
local M = {
|
||||
"mhartington/formatter.nvim",
|
||||
event = "BufReadPre",
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local any = require("formatter.filetypes.any")
|
||||
local formatters = {
|
||||
markdown = {
|
||||
require("formatter.filetypes.markdown").prettier,
|
||||
},
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
["*"] = {
|
||||
any.remove_trailing_whitespace,
|
||||
},
|
||||
}
|
||||
|
||||
require("formatter").setup({ filetype = formatters })
|
||||
|
||||
local format = function()
|
||||
if formatters[vim.bo.filetype] ~= nil then
|
||||
vim.cmd([[Format]])
|
||||
elseif next(vim.lsp.get_active_clients({ bufnr = 0 })) == nil then
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end
|
||||
|
||||
K.nmap("<leader>F", format, "[F]ormat file")
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Formatting", { clear = false }),
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
98
home/features/neovim/config/lua/my/plugins/gitsigns.lua
Normal file
98
home/features/neovim/config/lua/my/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,98 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "BufReadPost",
|
||||
cond = env.firenvim.not_active() and env.vscode.not_active(),
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local wk = require("which-key")
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
-- {{{ Helpers
|
||||
local function map(mode, from, to, desc, expr)
|
||||
vim.keymap.set(
|
||||
mode,
|
||||
from,
|
||||
to,
|
||||
{ expr = expr, silent = true, buffer = bufnr, desc = desc }
|
||||
)
|
||||
end
|
||||
|
||||
local function exprmap(from, to, desc)
|
||||
map("n", from, to, desc, true)
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Navigation
|
||||
exprmap("]c", function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
|
||||
return "<Ignore>"
|
||||
end, "Navigate to next hunk")
|
||||
|
||||
exprmap("[c", function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
|
||||
return "<Ignore>"
|
||||
end, "Navigate to previous hunk")
|
||||
-- }}}
|
||||
-- {{{ Actions
|
||||
local prefix = "<leader>h"
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = { h = { name = "gitsigns" } },
|
||||
})
|
||||
|
||||
-- {{{ Normal mode
|
||||
map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk")
|
||||
map("n", prefix .. "r", gs.reset_hunk, "[r]eset hunk")
|
||||
map("n", prefix .. "S", gs.stage_buffer, "[s]tage buffer")
|
||||
map("n", prefix .. "u", gs.undo_stage_hunk, "[u]ndo hunk staging")
|
||||
map("n", prefix .. "R", gs.reset_buffer, "[r]eset buffer")
|
||||
map("n", prefix .. "p", gs.preview_hunk, "[p]review hunk")
|
||||
map("n", prefix .. "b", function()
|
||||
gs.blame_line({ full = true })
|
||||
end, "[b]lame line")
|
||||
map("n", prefix .. "d", gs.diffthis, "[d]iff this")
|
||||
map("n", prefix .. "D", function()
|
||||
gs.diffthis("~")
|
||||
end, "[d]iff file (?)")
|
||||
-- }}}
|
||||
-- {{{ Toggles
|
||||
map(
|
||||
"n",
|
||||
prefix .. "tb",
|
||||
gs.toggle_current_line_blame,
|
||||
"[t]oggle line [b]laming"
|
||||
)
|
||||
map("n", prefix .. "td", gs.toggle_deleted, "[t]oggle [d]eleted")
|
||||
-- }}}
|
||||
-- {{{ Visual
|
||||
map("v", prefix .. "s", function()
|
||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "stage visual hunk")
|
||||
map("v", prefix .. "r", function()
|
||||
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "reset visual hunk")
|
||||
-- }}}
|
||||
-- }}}
|
||||
-- {{{ Text objects
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Inside hunk")
|
||||
-- }}}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
30
home/features/neovim/config/lua/my/plugins/harpoon.lua
Normal file
30
home/features/neovim/config/lua/my/plugins/harpoon.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local M = {
|
||||
"ThePrimeagen/harpoon",
|
||||
}
|
||||
|
||||
local function bindHarpoon(key, index)
|
||||
vim.keymap.set("n", "<C-s>" .. key, function()
|
||||
require("harpoon.ui").nav_file(index)
|
||||
end, { desc = "Harpoon file " .. index })
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set("n", "<leader>H", function()
|
||||
require("harpoon.mark").add_file()
|
||||
end, { desc = "Add file to [h]arpoon" })
|
||||
vim.keymap.set("n", "<C-a>", function()
|
||||
require("harpoon.ui").toggle_quick_menu()
|
||||
end, { desc = "Toggle harpoon quickmenu" })
|
||||
|
||||
bindHarpoon("q", 1)
|
||||
bindHarpoon("w", 2)
|
||||
bindHarpoon("e", 3)
|
||||
bindHarpoon("r", 4)
|
||||
bindHarpoon("a", 5)
|
||||
bindHarpoon("s", 6)
|
||||
bindHarpoon("d", 7)
|
||||
bindHarpoon("f", 8)
|
||||
bindHarpoon("z", 9)
|
||||
end
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/haskell-tools.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/haskell-tools.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local lspconfig = require("my.plugins.lspconfig")
|
||||
local M = {
|
||||
"mrcjkb/haskell-tools.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
version = "^2",
|
||||
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.g.haskell_tools = {
|
||||
hls = {
|
||||
on_attach = lspconfig.on_attach,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = "fourmolu",
|
||||
-- This seems to work better with custom preludes
|
||||
-- See this issue https://github.com/fourmolu/fourmolu/issues/357
|
||||
plugin = { fourmolu = { config = { external = true } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
tools = {
|
||||
hover = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
404
home/features/neovim/config/lua/my/plugins/hydra.lua
Normal file
404
home/features/neovim/config/lua/my/plugins/hydra.lua
Normal file
|
@ -0,0 +1,404 @@
|
|||
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
|
44
home/features/neovim/config/lua/my/plugins/idris.lua
Normal file
44
home/features/neovim/config/lua/my/plugins/idris.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local env = require("my.helpers.env")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"ShinKage/idris2-nvim",
|
||||
dependencies = {"nui.nvim", "nvim-lspconfig"},
|
||||
ft = { "idris2", "lidris2", "ipkg" },
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local idris2 = require("idris2")
|
||||
|
||||
idris2.setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
lspconfig.on_attach(client, bufnr)
|
||||
|
||||
local function nmap(from, to, desc)
|
||||
vim.keymap.set("n", "<leader>I" .. from, function()
|
||||
require("idris2.code_action")[to]()
|
||||
end, { desc = desc, bufnr = true })
|
||||
end
|
||||
|
||||
nmap("C", "make_case", "Make [c]ase")
|
||||
nmap("L", "make_lemma", "Make [l]emma")
|
||||
nmap("c", "add_clause", "Add [c]lause")
|
||||
nmap("e", "expr_search", "[E]xpression search")
|
||||
nmap("d", "generate_def", "Generate [d]efinition")
|
||||
nmap("s", "case_split", "Case [s]plit")
|
||||
nmap("h", "refine_hole", "Refine [h]ole")
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({ ["<leader>I"] = { name = "[I]dris", buffer = bufnr } })
|
||||
end
|
||||
end,
|
||||
},
|
||||
client = { hover = { use_split = true } },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
225
home/features/neovim/config/lua/my/plugins/init.lua
Normal file
225
home/features/neovim/config/lua/my/plugins/init.lua
Normal file
|
@ -0,0 +1,225 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
if env.neovide.active() then
|
||||
require("my.neovide").setup()
|
||||
end
|
||||
|
||||
return {
|
||||
--{{{ Language support
|
||||
{
|
||||
"purescript-contrib/purescript-vim",
|
||||
ft = "purescript",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"elkowar/yuck.vim",
|
||||
ft = "yuck",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"Fymyte/rasi.vim",
|
||||
ft = "rasi",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"teal-language/vim-teal",
|
||||
ft = "teal",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"udalov/kotlin-vim",
|
||||
ft = "kotlin",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"kmonad/kmonad-vim",
|
||||
ft = "kbd",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"vmchale/dhall-vim",
|
||||
ft = "dhall",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"yasuhiroki/github-actions-yaml.vim",
|
||||
ft = { "yml", "yaml" },
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"kaarmu/typst.vim",
|
||||
ft = "typst",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"theRealCarneiro/hyprland-vim-syntax",
|
||||
ft = "hypr",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
--}}}
|
||||
|
||||
{
|
||||
-- Better ui for inputs/selects
|
||||
"stevearc/dressing.nvim",
|
||||
config = true,
|
||||
-- https://github.com/folke/dot/blob/master/config/nvim/lua/config/plugins/init.lua
|
||||
init = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.input = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.input(...)
|
||||
end
|
||||
end,
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Helper libs
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
-- Autoload when running tests
|
||||
cmd = { "PlenaryBustedDirectory", "PlenaryBustedFile" },
|
||||
},
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- nice looking icons
|
||||
{
|
||||
"mateiadrielrafael/scrap.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("my.abbreviations").setup()
|
||||
end,
|
||||
}, -- vim-abolish rewrite
|
||||
|
||||
{
|
||||
"terrortylor/nvim-comment",
|
||||
keys = { "gc", "gcc", { "gc", mode = "v" } },
|
||||
config = function()
|
||||
require("nvim_comment").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- easly switch between tmux and vim panes
|
||||
"christoomey/vim-tmux-navigator",
|
||||
keys = { "<C-h>", "<C-j>", "<C-k>", "<C-l>" },
|
||||
cond = env.vscode.not_active()
|
||||
and env.neovide.not_active()
|
||||
and env.firenvim.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- track time usage
|
||||
"wakatime/vim-wakatime",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- show progress for lsp stuff
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "legacy",
|
||||
event = "BufReadPre",
|
||||
cond = env.vscode.not_active(),
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
-- export to pastebin like services
|
||||
"rktjmp/paperplanes.nvim",
|
||||
opts = {
|
||||
provider = "paste.rs",
|
||||
},
|
||||
cmd = "PP",
|
||||
},
|
||||
|
||||
{
|
||||
-- case switching + the subvert command
|
||||
"tpope/vim-abolish",
|
||||
event = "VeryLazy",
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
{
|
||||
-- automatically set options based on current file
|
||||
"tpope/vim-sleuth",
|
||||
event = "BufRead",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
|
||||
{
|
||||
-- generate permalinks for code
|
||||
"ruifm/gitlinker.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { mappings = "<leader>yg" },
|
||||
init = function()
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>yg"] = {
|
||||
desc = "[Y]ank [g]it remote url",
|
||||
},
|
||||
})
|
||||
end
|
||||
end,
|
||||
cond = env.firenvim.not_active(),
|
||||
keys = "<leader>yg",
|
||||
},
|
||||
|
||||
{
|
||||
-- discord rich presence
|
||||
"andweeb/presence.nvim",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
config = function()
|
||||
require("presence"):setup()
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
|
||||
-- Live command preview for stuff like :norm
|
||||
{
|
||||
"smjonas/live-command.nvim",
|
||||
config = function()
|
||||
require("live-command").setup({
|
||||
commands = {
|
||||
Norm = { cmd = "norm" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
-- cond = false,
|
||||
},
|
||||
{
|
||||
"mbbill/undotree",
|
||||
cmd = "UndotreeToggle",
|
||||
init = function()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>u",
|
||||
"<cmd>UndotreeToggle<cr>",
|
||||
{ desc = "[U]ndo tree" }
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
63
home/features/neovim/config/lua/my/plugins/iron.lua
Normal file
63
home/features/neovim/config/lua/my/plugins/iron.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"hkupty/iron.nvim", -- repl support
|
||||
cond = env.vscode.not_active(),
|
||||
cmd = "IronRepl",
|
||||
}
|
||||
|
||||
function M.init()
|
||||
-- iron also has a list of commands, see :h iron-commands for all available commands
|
||||
vim.keymap.set("n", "<space>iss", "<cmd>IronRepl<cr>")
|
||||
vim.keymap.set("n", "<space>ir", "<cmd>IronRestart<cr>")
|
||||
vim.keymap.set("n", "<space>if", "<cmd>IronFocus<cr>")
|
||||
vim.keymap.set("n", "<space>ih", "<cmd>IronHide<cr>")
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>i"] = {
|
||||
name = "[I]ron repl",
|
||||
s = { name = "[s]end" },
|
||||
m = { name = "[m]ark" },
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local iron = require("iron.core")
|
||||
|
||||
iron.setup({
|
||||
config = {
|
||||
-- Your repl definitions come here
|
||||
repl_definition = {},
|
||||
-- How the repl window will be displayed
|
||||
-- See below for more information
|
||||
repl_open_cmd = require("iron.view").right(40),
|
||||
},
|
||||
-- Iron doesn't set keymaps by default anymore.
|
||||
-- You can set them here or manually add keymaps to the functions in iron.core
|
||||
keymaps = {
|
||||
send_motion = "<space>isc",
|
||||
visual_send = "<space>is",
|
||||
send_file = "<space>isf",
|
||||
send_line = "<space>isl",
|
||||
send_mark = "<space>ism",
|
||||
mark_motion = "<space>imc",
|
||||
mark_visual = "<space>imc",
|
||||
remove_mark = "<space>imd",
|
||||
cr = "<space>is<cr>",
|
||||
interrupt = "<space>is<space>",
|
||||
exit = "<space>isq",
|
||||
clear = "<space>isr",
|
||||
},
|
||||
-- If the highlight is on, you can change how it looks
|
||||
-- For the available options, check nvim_set_hl
|
||||
highlight = { italic = true },
|
||||
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
home/features/neovim/config/lua/my/plugins/lean.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/lean.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local env = require("my.helpers.env")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"Julian/lean.nvim", -- lean support
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
ft = "lean",
|
||||
config = function()
|
||||
require("lean").setup({
|
||||
abbreviations = { builtin = true, cmp = true },
|
||||
lsp = {
|
||||
on_attach = lspconfig.on_attach,
|
||||
capabilities = lspconfig.capabilities(),
|
||||
},
|
||||
lsp3 = false,
|
||||
mappings = true,
|
||||
})
|
||||
end,
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
return M
|
241
home/features/neovim/config/lua/my/plugins/lspconfig.lua
Normal file
241
home/features/neovim/config/lua/my/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,241 @@
|
|||
local helpers = require("my.helpers")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local lspconfig = {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "BufReadPre",
|
||||
dependencies = {
|
||||
"folke/neoconf.nvim",
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
config = true,
|
||||
},
|
||||
"simrat39/rust-tools.nvim",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local M = {
|
||||
lspconfig,
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
opts = {
|
||||
input_buffer_type = "dressing",
|
||||
},
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
}
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
-- {{{ Keymap helpers
|
||||
local opts = function(desc)
|
||||
return { noremap = true, silent = true, desc = desc, buffer = bufnr }
|
||||
end
|
||||
|
||||
local nmap = function(from, to, desc)
|
||||
vim.keymap.set("n", from, to, opts(desc))
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Auto format
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = false, bufnr = bufnr })
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
nmap("<leader>F", format, "[F]ormat")
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }),
|
||||
buffer = bufnr,
|
||||
callback = format,
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Go to declaration / references / implementation
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
|
||||
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
|
||||
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences")
|
||||
-- }}}
|
||||
-- {{{ Hover
|
||||
-- Note: diagnostics are already covered in keymaps.lua
|
||||
if client.supports_method("textDocument/hover") then
|
||||
nmap("K", vim.lsp.buf.hover, "Hover")
|
||||
end
|
||||
nmap("L", vim.lsp.buf.signature_help, "Signature help")
|
||||
-- }}}
|
||||
-- {{{ Code actions
|
||||
nmap("<leader>c", vim.lsp.buf.code_action, "[C]ode actions")
|
||||
nmap("<leader>li", "<cmd>LspInfo<cr>", "[L]sp [i]nfo")
|
||||
|
||||
vim.keymap.set("n", "<leader>rn", function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end, helpers.mergeTables(opts("[R]e[n]ame"), { expr = true }))
|
||||
|
||||
vim.keymap.set(
|
||||
"v",
|
||||
"<leader>c",
|
||||
":'<,'> lua vim.lsp.buf.range_code_action()",
|
||||
opts("[C]ode actions")
|
||||
)
|
||||
-- }}}
|
||||
-- {{{ Workspace stuff
|
||||
nmap(
|
||||
"<leader>wa",
|
||||
vim.lsp.buf.add_workspace_folder,
|
||||
"[W]orkspace [A]dd Folder"
|
||||
)
|
||||
nmap(
|
||||
"<leader>wr",
|
||||
vim.lsp.buf.remove_workspace_folder,
|
||||
"[W]orkspace [R]emove Folder"
|
||||
)
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
-- }}}
|
||||
end
|
||||
|
||||
-- {{{ General server config
|
||||
---@type lspconfig.options
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
local servers = {
|
||||
-- {{{ Typescript
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
tsserver = {
|
||||
on_attach = function(client, bufnr)
|
||||
-- We handle formatting using null-ls and prettierd
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
M.on_attach(client, bufnr)
|
||||
end,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Purescript
|
||||
purescriptls = {
|
||||
settings = {
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
purescript = {
|
||||
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
|
||||
formatter = "purs-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Lua
|
||||
lua_ls = {
|
||||
cmd = {
|
||||
"lua-language-server",
|
||||
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
|
||||
},
|
||||
settings = {
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
Lua = {
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Latex
|
||||
texlab = {
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
args = {
|
||||
-- Here by default:
|
||||
"-pdf",
|
||||
"-interaction=nonstopmode",
|
||||
"-synctex=1",
|
||||
"%f",
|
||||
-- Required for syntax highlighting inside the generated pdf aparently
|
||||
"-shell-escape",
|
||||
},
|
||||
executable = "latexmk",
|
||||
forwardSearchAfter = true,
|
||||
onSave = true,
|
||||
},
|
||||
chktex = {
|
||||
onOpenAndSave = true,
|
||||
onEdit = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Nix
|
||||
rnix = {},
|
||||
nil_ls = {},
|
||||
nixd = {},
|
||||
-- }}}
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
cssls = {},
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
jsonls = {},
|
||||
dhall_lsp_server = {},
|
||||
typst_lsp = {},
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
elmls = {},
|
||||
-- {{{ Inactive
|
||||
-- pylsp = {},
|
||||
-- pyright = {},
|
||||
-- }}}
|
||||
}
|
||||
-- }}}
|
||||
-- {{{ Capabilities
|
||||
M.capabilities = function()
|
||||
local c = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Add folding capabilities
|
||||
c.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
return c
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Nice diagnostic icons
|
||||
-- See https://github.com/folke/dot/blob/master/config/nvim/lua/config/plugins/lsp/diagnostics.lua
|
||||
local function diagnostics_icons()
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
end
|
||||
|
||||
--}}}
|
||||
-- {{{ Main config function
|
||||
function lspconfig.config()
|
||||
diagnostics_icons()
|
||||
-- -- {{{ Change on-hover borders
|
||||
vim.lsp.handlers["textDocument/hover"] =
|
||||
vim.lsp.with(vim.lsp.handlers.hover, { border = "single" })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
-- -- }}}
|
||||
|
||||
local capabilities = M.capabilities()
|
||||
-- Setup basic language servers
|
||||
for lsp, details in pairs(servers) do
|
||||
if details.on_attach == nil then
|
||||
-- Default setting for on_attach
|
||||
details.on_attach = M.on_attach
|
||||
end
|
||||
|
||||
require("lspconfig")[lsp].setup({
|
||||
on_attach = details.on_attach,
|
||||
settings = details.settings, -- Specific per-language settings
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
|
||||
},
|
||||
cmd = details.cmd,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
--}}}
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/lualine.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/lualine.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
theme = "auto",
|
||||
disabled_filetypes = {
|
||||
"undotree",
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "branch" },
|
||||
lualine_b = { "filename" },
|
||||
lualine_c = { "filetype" },
|
||||
lualine_x = { "diagnostics" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
-- Integration with other plugins
|
||||
extensions = { "nvim-tree" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
34
home/features/neovim/config/lua/my/plugins/luasnip.lua
Normal file
34
home/features/neovim/config/lua/my/plugins/luasnip.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"L3MON4D3/LuaSnip", -- snippeting engine
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local function reload()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
vim.keymap.set("i", "<Tab>", function()
|
||||
if luasnip.jumpable(1) then
|
||||
return "<cmd>lua require('luasnip').jump(1)<cr>"
|
||||
else
|
||||
return "<Tab>"
|
||||
end
|
||||
end, { expr = true })
|
||||
|
||||
vim.keymap.set("i", "<S-Tab>", function()
|
||||
luasnip.jump(-1)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>rs", reload, {
|
||||
desc = "[R]eload [s]nippets",
|
||||
})
|
||||
|
||||
reload()
|
||||
end
|
||||
|
||||
return M
|
61
home/features/neovim/config/lua/my/plugins/magma.lua
Normal file
61
home/features/neovim/config/lua/my/plugins/magma.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
local M = {
|
||||
"dccsillag/magma-nvim",
|
||||
cmd = "MagmaInit",
|
||||
config = function()
|
||||
local prefix = "<leader>M"
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
[prefix] = {
|
||||
desc = "[M]agma",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "e",
|
||||
"<cmd>MagmaEvaluateOperator<cr>",
|
||||
{ expr = true, silent = true, desc = "[E]valuate motion" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "ee",
|
||||
"<cmd>MagmaEvaluateLine<cr>",
|
||||
{ silent = true, desc = "[E]valuate line" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "r",
|
||||
"<cmd>MagmaReevaluateCell<cr>",
|
||||
{ silent = true, desc = "[R]e-evaluate cell" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "d",
|
||||
"<cmd>MagmaDelete<cr>",
|
||||
{ silent = true, desc = "[D]elete cell" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
prefix .. "o",
|
||||
"<cmd>MagmaShowOutput<cr>",
|
||||
{ silent = true, desc = "Show [o]utput" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"v",
|
||||
prefix .. "e",
|
||||
"<cmd><C-u>MagmaEvaluateVisual<cr>",
|
||||
{ silent = true, desc = "[E]vluate visual selection" }
|
||||
)
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/plugins/mini-files.lua
Normal file
31
home/features/neovim/config/lua/my/plugins/mini-files.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local K = require("my.keymaps")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"echasnovski/mini.files",
|
||||
version = "main",
|
||||
event = "VeryLazy",
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local files = require("mini.files")
|
||||
|
||||
files.setup({
|
||||
windows = {
|
||||
preview = false,
|
||||
},
|
||||
mappings = {
|
||||
go_in_plus = "l",
|
||||
},
|
||||
})
|
||||
|
||||
K.nmap("<C-S-F>", function()
|
||||
if not files.close() then
|
||||
files.open(vim.api.nvim_buf_get_name(0))
|
||||
files.reveal_cwd()
|
||||
end
|
||||
end, "[S]earch [F]iles")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,8 @@
|
|||
local M = {
|
||||
"echasnovski/mini.operators",
|
||||
version = false,
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
|
||||
return M
|
43
home/features/neovim/config/lua/my/plugins/mini-surround.lua
Normal file
43
home/features/neovim/config/lua/my/plugins/mini-surround.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local M = {
|
||||
"echasnovski/mini.surround",
|
||||
version = "main",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("mini.surround").setup({
|
||||
mappings = {
|
||||
add = "<tab>s", -- Add surrounding in Normal and Visul modes
|
||||
delete = "<tab>d", -- Delete surrounding
|
||||
find = "<tab>f", -- Find surrounding (to the right)
|
||||
find_left = "<tab>F", -- Find surrounding (to the left)
|
||||
highlight = "<tab>h", -- Highlight surrounding
|
||||
replace = "<tab>r", -- Replace surrounding
|
||||
update_n_lines = "", -- Update `n_lines`
|
||||
},
|
||||
custom_surroundings = {
|
||||
["b"] = {
|
||||
input = { "%b()", "^.%s*().-()%s*.$" },
|
||||
output = { left = "(", right = ")" },
|
||||
},
|
||||
["B"] = {
|
||||
input = { "%b{}", "^.%s*().-()%s*.$" },
|
||||
output = { left = "{", right = "}" },
|
||||
},
|
||||
["r"] = {
|
||||
input = { "%b[]", "^.%s*().-()%s*.$" },
|
||||
output = { left = "[", right = "]" },
|
||||
},
|
||||
["q"] = {
|
||||
input = { '".-"', "^.().*().$" },
|
||||
output = { left = '"', right = '"' },
|
||||
},
|
||||
["a"] = {
|
||||
input = { "'.-'", "^.().*().$" },
|
||||
output = { left = "'", right = "'" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
12
home/features/neovim/config/lua/my/plugins/neoconf.lua
Normal file
12
home/features/neovim/config/lua/my/plugins/neoconf.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"folke/neoconf.nvim",
|
||||
cmd = "Neoconf",
|
||||
opts = {
|
||||
-- import existing settings from other plugins
|
||||
import = {
|
||||
vscode = true, -- local .vscode/settings.json
|
||||
coc = false, -- global/local coc-settings.json
|
||||
nlsp = false, -- global/local nlsp-settings.nvim json settings
|
||||
},
|
||||
},
|
||||
}
|
26
home/features/neovim/config/lua/my/plugins/neogit.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/neogit.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"TimUntersberger/neogit",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
cmd = "Neogit",
|
||||
cond = env.firenvim.not_active() and env.vscode.not_active(),
|
||||
init = function()
|
||||
vim.keymap.set("n", "<C-g>", "<cmd>Neogit<cr>", { desc = "Open neo[g]it" })
|
||||
end,
|
||||
config = function()
|
||||
require("neogit").setup({})
|
||||
|
||||
-- {{{ Disable folds inside neogit
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "NeogitStatus" },
|
||||
group = vim.api.nvim_create_augroup("NeogitStatusOptions", {}),
|
||||
callback = function()
|
||||
vim.opt.foldenable = false
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
54
home/features/neovim/config/lua/my/plugins/neorg.lua
Normal file
54
home/features/neovim/config/lua/my/plugins/neorg.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local M = {
|
||||
"nvim-neorg/neorg",
|
||||
build = ":Neorg sync-parsers",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-neorg/neorg-telescope" },
|
||||
ft = "norg",
|
||||
config = function()
|
||||
require("neorg").setup({
|
||||
load = {
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.integrations.telescope"] = {},
|
||||
-- {{{ Completions
|
||||
["core.completion"] = {
|
||||
config = {
|
||||
engine = "nvim-cmp",
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Dirman
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/Neorg",
|
||||
["uni-notes"] = "~/Projects/uni-notes",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Keybinds
|
||||
["core.keybinds"] = {
|
||||
config = {
|
||||
hook = function(keybinds)
|
||||
-- Binds the `gtd` key in `norg` mode to execute `:echo 'Hello'`
|
||||
keybinds.map("norg", "n", "gtd", "<cmd>echo 'Hello!'<CR>")
|
||||
end,
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
},
|
||||
})
|
||||
|
||||
-- {{{ Lazy cmp loading
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceNeorg", {}),
|
||||
pattern = "*.norg",
|
||||
callback = function()
|
||||
require("cmp").setup.buffer({ sources = { { name = "neorg" } } })
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
44
home/features/neovim/config/lua/my/plugins/null-ls.lua
Normal file
44
home/features/neovim/config/lua/my/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"jose-elias-alvarez/null-ls.nvim", -- generic language server
|
||||
event = "BufReadPre",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
cond = env.vscode.not_active(),
|
||||
enable = false,
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local sources = {
|
||||
-- {{{ Typescript formatting
|
||||
-- null_ls.builtins.formatting.prettierd, -- format ts files
|
||||
null_ls.builtins.formatting.prettier, -- format ts files
|
||||
-- }}}
|
||||
-- {{{ Lua formatting
|
||||
-- null_ls.builtins.formatting, -- format lua code
|
||||
null_ls.builtins.formatting.stylua, -- format lua code
|
||||
-- }}}
|
||||
-- {{{ Python
|
||||
-- Formatting:
|
||||
-- null_ls.builtins.formatting.black,
|
||||
-- null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.yapf.with({
|
||||
extra_args = { [[--style="{ indent_width: 2 }"]] },
|
||||
}),
|
||||
-- Diagnostics
|
||||
null_ls.builtins.diagnostics.ruff, -- Linting
|
||||
-- null_ls.builtins.diagnostics.mypy, -- Type checking
|
||||
-- }}}
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = lspconfig.on_attach,
|
||||
debug = true,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
20
home/features/neovim/config/lua/my/plugins/nvim-tree.lua
Normal file
20
home/features/neovim/config/lua/my/plugins/nvim-tree.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
config = true,
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.init()
|
||||
-- Toggle nerdtree with Control-n
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<C-n>",
|
||||
":NvimTreeToggle<CR>",
|
||||
{ desc = "Toggle [n]vim-tree" }
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
32
home/features/neovim/config/lua/my/plugins/obsidian.lua
Normal file
32
home/features/neovim/config/lua/my/plugins/obsidian.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local env = require("my.helpers.env")
|
||||
local vault = "/home/adrielus/Projects/stellar-sanctum"
|
||||
|
||||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = {
|
||||
dir = vault,
|
||||
notes_subdir = "chaos",
|
||||
daily_notes = {
|
||||
folder = "daily",
|
||||
date_format = "%Y-%m-%d",
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = true,
|
||||
min_chars = 2,
|
||||
new_notes_location = "current_dir",
|
||||
prepend_note_id = true,
|
||||
},
|
||||
mappings = {},
|
||||
disable_frontmatter = true,
|
||||
},
|
||||
keys = {
|
||||
{ "<C-O>", "<cmd>ObsidianQuickSwitch<cr>" },
|
||||
},
|
||||
cond = env.vscode.not_active()
|
||||
and env.firenvim.not_active()
|
||||
and vim.loop.cwd() == vault,
|
||||
}
|
25
home/features/neovim/config/lua/my/plugins/rust-tools.lua
Normal file
25
home/features/neovim/config/lua/my/plugins/rust-tools.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local K = require("my.keymaps")
|
||||
local lspconfig = require("my.plugins.lspconfig")
|
||||
|
||||
local M = {
|
||||
"simrat39/rust-tools.nvim",
|
||||
config = function()
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
K.nmap(
|
||||
"<leader>lc",
|
||||
"<cmd>RustOpenCargo<cr>",
|
||||
"Open [c]argo.toml",
|
||||
true,
|
||||
true
|
||||
)
|
||||
|
||||
lspconfig.on_attach(client, bufnr)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
76
home/features/neovim/config/lua/my/plugins/telescope.lua
Normal file
76
home/features/neovim/config/lua/my/plugins/telescope.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local telescope = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
version = "0.1.x",
|
||||
cond = env.vscode.not_active(),
|
||||
}
|
||||
|
||||
local M = telescope
|
||||
|
||||
local function find_files_by_extension(extension)
|
||||
return "find_files find_command=rg,--files,--glob=**/*." .. extension
|
||||
end
|
||||
|
||||
local function with_theme(base, theme)
|
||||
return base .. " theme=" .. theme
|
||||
end
|
||||
|
||||
local defaultTheme = "ivy"
|
||||
|
||||
local keybinds = {
|
||||
{ "<C-P>", "find_files", "Find files" },
|
||||
{ "<Leader>ft", find_files_by_extension("tex"), "[F]ind [t]ex files" },
|
||||
{ "<Leader>fl", find_files_by_extension("lua"), "[F]ind [l]ua files" },
|
||||
{ "<Leader>fn", find_files_by_extension("nix"), "[F]ind [n]ix files" },
|
||||
{
|
||||
"<Leader>fp",
|
||||
find_files_by_extension("purs"),
|
||||
"[F]ind [p]urescript files",
|
||||
},
|
||||
{ "<Leader>d", "diagnostics", "[D]iagnostics" },
|
||||
{ "<C-F>", "live_grep", "[F]ind in project" },
|
||||
{ "<Leader>t", "builtin", "[T]elescope pickers" },
|
||||
}
|
||||
|
||||
local function mkAction(action)
|
||||
if not string.find(action, "theme=") then
|
||||
action = with_theme(action, defaultTheme)
|
||||
end
|
||||
|
||||
if not string.find(action, "winblend=") and env.neovide.active() then
|
||||
action = action .. " winblend=45"
|
||||
end
|
||||
|
||||
return "<cmd>Telescope " .. action .. "<cr>"
|
||||
end
|
||||
|
||||
function telescope.init()
|
||||
for _, mapping in pairs(keybinds) do
|
||||
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
|
||||
end
|
||||
end
|
||||
|
||||
function telescope.config()
|
||||
local settings = {
|
||||
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
|
||||
pickers = { find_files = { hidden = true } },
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope").setup(settings)
|
||||
require("telescope").load_extension("fzf")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,22 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
local T = require("nix.theme")
|
||||
|
||||
local M = {
|
||||
"uloco/bluloco.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "rktjmp/lush.nvim" },
|
||||
enabled = H.theme_contains("Bluloco"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local bluloco = require("bluloco")
|
||||
|
||||
bluloco.setup({
|
||||
transparent = T.transparency.enable,
|
||||
style = H.variant("Bluloco"),
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme bluloco")
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,30 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
local T = require("nix.theme")
|
||||
|
||||
local M = {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
enabled = H.theme_contains("Catppuccin"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local catppuccin = require("catppuccin")
|
||||
vim.g.catppuccin_flavour = H.variant("Catppuccin")
|
||||
|
||||
catppuccin.setup({
|
||||
transparent_background = T.transparency.enable,
|
||||
integrations = { nvimtree = true, telescope = true },
|
||||
})
|
||||
|
||||
vim.cmd([[highlight NotifyINFOIcon guifg=#d6b20f]])
|
||||
vim.cmd([[highlight NotifyINFOTitle guifg=#d6b20f]])
|
||||
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
|
||||
if T.transparency.enable then
|
||||
vim.cmd([[highlight FloatBorder blend=0]])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,14 @@
|
|||
local theme = require("nix.theme").name
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.theme_contains(name)
|
||||
return string.find(theme, name) ~= nil
|
||||
end
|
||||
|
||||
function M.variant(name)
|
||||
-- +1 for 1-indexed strings and +1 for the space between name and variant
|
||||
return string.lower(string.sub(theme, string.len(name) + 2))
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
require("my.plugins.themes.catppuccin"),
|
||||
require("my.plugins.themes.rosepine"),
|
||||
require("my.plugins.themes.bluloco"),
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
local H = require("my.plugins.themes.helpers")
|
||||
|
||||
local M = {
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
lazy = false,
|
||||
enabled = H.theme_contains("Rosé Pine"),
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local variant = H.variant("Rosé Pine")
|
||||
|
||||
if variant == "dawn" then
|
||||
vim.o.background = "light"
|
||||
else
|
||||
vim.o.background = "dark"
|
||||
end
|
||||
|
||||
local dark_variants = {
|
||||
[""] = "main",
|
||||
moon = "moon",
|
||||
}
|
||||
|
||||
require("rose-pine").setup({
|
||||
dark_variant = dark_variants[variant],
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end
|
||||
|
||||
return M
|
105
home/features/neovim/config/lua/my/plugins/treesitter.lua
Normal file
105
home/features/neovim/config/lua/my/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,105 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = "BufReadPost",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
--{{{Languages
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"elixir",
|
||||
"fish",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"jsonc",
|
||||
"latex",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"nix",
|
||||
"python",
|
||||
"rust",
|
||||
"scss",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
sync_install = false,
|
||||
--}}}
|
||||
--{{{ Highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "kotlin" },
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
--}}}
|
||||
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",
|
||||
},
|
||||
},
|
||||
--}}}
|
||||
},
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- show context on closing parenthesis
|
||||
"haringsrob/nvim_context_vt",
|
||||
event = "BufReadPost",
|
||||
cond = env.vscode.not_active(),
|
||||
},
|
||||
{
|
||||
-- show context at top of file
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
event = "BufReadPost",
|
||||
cond = env.vscode.not_active(),
|
||||
opts = { enable = true },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
66
home/features/neovim/config/lua/my/plugins/venn.lua
Normal file
66
home/features/neovim/config/lua/my/plugins/venn.lua
Normal file
|
@ -0,0 +1,66 @@
|
|||
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 Hydra = require("hydra")
|
||||
|
||||
Hydra({
|
||||
name = "Draw Diagram",
|
||||
hint = venn_hint,
|
||||
config = {
|
||||
color = "pink",
|
||||
invoke_on_body = true,
|
||||
hint = {
|
||||
border = "single",
|
||||
},
|
||||
on_enter = function()
|
||||
vim.o.virtualedit = "all"
|
||||
end,
|
||||
},
|
||||
mode = "n",
|
||||
desc = "[V]enn mode",
|
||||
body = "<leader>V",
|
||||
heads = {
|
||||
{ "H", "<C-v>h:VBox<CR>" },
|
||||
{ "J", "<C-v>j:VBox<CR>" },
|
||||
{ "K", "<C-v>k:VBox<CR>" },
|
||||
{ "L", "<C-v>l:VBox<CR>" },
|
||||
{ "f", ":VBox<CR>", { mode = "v" } },
|
||||
{ "<Esc>", nil, { exit = true } },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M.init()
|
||||
require("which-key").register({
|
||||
["<leader>V"] = { name = "[V]enn mode" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
home/features/neovim/config/lua/my/plugins/vimtex.lua
Normal file
26
home/features/neovim/config/lua/my/plugins/vimtex.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local M = {
|
||||
"lervag/vimtex", -- latex support
|
||||
ft = "tex",
|
||||
enabled = false
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.Tex_DefaultTargetFormat = "pdf"
|
||||
vim.g.vimtex_compiler_latexmk = {
|
||||
options = {
|
||||
"-pdf",
|
||||
"-shell-escape",
|
||||
"-verbose",
|
||||
"-file-line-error",
|
||||
"-synctex=1",
|
||||
"-interaction=nonstopmode",
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.vimtex_fold_enabled = 0
|
||||
vim.g.vimtex_imaps_enabled = 0
|
||||
vim.g.vimtex_syntax_conceal_disable = 1
|
||||
end
|
||||
|
||||
return M
|
40
home/features/neovim/config/lua/my/plugins/vimux.lua
Normal file
40
home/features/neovim/config/lua/my/plugins/vimux.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local K = require("my.keymaps")
|
||||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"preservim/vimux", -- interact with tmux from within vim
|
||||
cmd = { "VimuxPromptCommand", "VimuxRunCommand", "VimuxRunLastCommand" },
|
||||
-- TODO: only enable when actually inside tmux
|
||||
cond = env.vscode.not_active()
|
||||
-- and env.neovide.not_active()
|
||||
and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.init()
|
||||
--{{{ Register keybinds
|
||||
K.nmap(
|
||||
"<leader>vp",
|
||||
":VimuxPromptCommand<CR>",
|
||||
"[V]imux: [p]rompt for command"
|
||||
)
|
||||
K.nmap("<leader>vc", ':VimuxRunCommand "clear"<CR>', "[V]imux: [c]lear pane")
|
||||
K.nmap(
|
||||
"<leader>vl",
|
||||
":VimuxRunLastCommand<CR>",
|
||||
"[V]imux: rerun [l]ast command"
|
||||
)
|
||||
--}}}
|
||||
--{{{ Register which-key docs
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
["<leader>v"] = {
|
||||
name = "[V]imux",
|
||||
},
|
||||
})
|
||||
end
|
||||
--}}}
|
||||
end
|
||||
|
||||
return M
|
31
home/features/neovim/config/lua/my/plugins/whichkey.lua
Normal file
31
home/features/neovim/config/lua/my/plugins/whichkey.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local M = {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({
|
||||
window = {
|
||||
winblend = 0,
|
||||
pumblend = 0,
|
||||
border = "single",
|
||||
},
|
||||
layout = { align = "center" },
|
||||
})
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = {
|
||||
f = { name = "[F]iles" },
|
||||
g = { name = "[G]o to" },
|
||||
r = { name = "[R]ename / [R]eplace / [R]eload" },
|
||||
l = { name = "[L]ocal" },
|
||||
w = { name = "[W]orkspace" },
|
||||
y = { name = "[Y]ank" },
|
||||
s = { name = "[S]ettings" },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue