Started rewriting my nixos config
This commit is contained in:
parent
f9f3b19299
commit
1b17dc6cf3
186 changed files with 135 additions and 7404 deletions
dotfiles/neovim/lua/my/helpers
|
@ -1,40 +0,0 @@
|
|||
local function makeEnv(cond)
|
||||
return {
|
||||
active = cond,
|
||||
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 os.getenv("INSIDE_NEOVIDE") == "1"
|
||||
end),
|
||||
firenvim = makeEnv(function()
|
||||
return vim.g.started_by_firenvim ~= nil
|
||||
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
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
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
|
|
@ -1,22 +0,0 @@
|
|||
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
|
||||
|
||||
-- Same as swap, but the key is aprt of an arpeggio chord
|
||||
local function swapArpeggio(key)
|
||||
vim.keymap.set({ "n", "v" }, "<Plug>(arpeggio-default:" .. key .. ")", "g" .. key,
|
||||
{ buffer = true })
|
||||
vim.keymap.set({ "n", "v" }, "g" .. key, key, { buffer = true })
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
swapArpeggio("j")
|
||||
swap("k")
|
||||
swap("0")
|
||||
swap("$")
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue