1
Fork 0

A bunch of changes, mostly to neovim

- global abbreviations
- better firenvim setup
- magma.nvim (never used it, might unisntall)
This commit is contained in:
Matei Adriel 2023-02-19 02:41:22 +01:00
parent d573e17a00
commit bf7427d8c7
No known key found for this signature in database
11 changed files with 125 additions and 21 deletions

View file

@ -1,5 +1,3 @@
local A = require("my.abbreviations")
-- Use vt to test
vim.keymap.set(
"n",
@ -17,16 +15,3 @@ vim.keymap.set(
)
vim.opt.expandtab = true -- Use spaces for the tab char
local abbreviations = {
{ "land", "/\\" },
{ "lor", "\\/" },
{ "tto", "->" },
{ "iip", "=>" },
{ "frl", "forall" },
{ "ott", "<-" }, -- opposite of tto
}
A.manyLocalAbbr(abbreviations)

View file

@ -60,6 +60,7 @@ local abbreviations = {
{ "iin", "\\in" },
{ "tto", "\\to" },
{ "iip", "\\implies" },
{ "iib", "\\impliedby" },
{ "iff", "\\iff" },
{ "land", "\\land" },
{ "lor", "\\lor" },
@ -117,6 +118,9 @@ local abolishAbbreviations = {
{ "dete{,s}", "determinant{}" },
{ "ort{n,g}", "orto{normal,gonal}" },
{ "l{in,de}", "linearly {independent,dependent}" },
{ "lcon{,s}", "linear combination{}" },
{ "vsm", "\\vecspace" }, -- math vector space
{ "vst{,s}", "vector space{,s}" }, -- text vector space
-- Graph theory
{ "vx{,s}", "vert{ex,ices}" },
@ -210,12 +214,9 @@ local abolishAbbreviations = {
local expanded = scrap.expand_many(abolishAbbreviations)
-- print("Expanded")
A.manyLocalAbbr(abbreviations)
A.manyLocalAbbr(expanded)
print(#expanded .. " abbreviations")
vim.keymap.set(
"n",
"<leader>lc",

View file

@ -27,6 +27,7 @@
"leap": { "branch": "main", "commit": "f565a9c4d92245d8b619235bebeaa73cc38aa40e" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
"magma-nvim": { "branch": "main", "commit": "395b48e2e202d82fca76c15d2dcd8785c125d686" },
"mind.nvim": { "branch": "master", "commit": "e59c52758c399caceb549c698cfa2d65e6bbb9f9" },
"neoconf.nvim": { "branch": "main", "commit": "f67013cf18d9db5cc6c3ce2d5a4051bad75fe628" },
"neodev.nvim": { "branch": "main", "commit": "6a2310ef6386e7a5ad5bdc56c844410bf5de8225" },

View file

@ -0,0 +1,34 @@
local A = require("my.abbreviations")
local scrap = require("scrap")
local M = {}
M.symols = {
-- Unicode:
{ "iin", "" }, -- [I]ncluded [i][n]
{ "mfrl", "" }, -- [M]ath [f]o[r]al[l]
-- Ascii stuff:
{ "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
{ "eq", "=" }, -- [e][q]ual
{ "deq", "==" }, -- [d]ouble [e][q]ual
{ "land", "/\\" }, -- [l]ogial [a][n][d]
{ "lor", "\\/" }, -- [l]ogial [o][r]
}
M.words = {
{ "thrf", "therefore" },
{ "frl", "forall" },
}
function M.setup()
A.manyGlobalAbbr(scrap.expand_many(M.words))
A.manyGlobalAbbr(scrap.expand_many(M.symols, { capitalized = false }))
end
return M

View file

@ -16,4 +16,15 @@ function M.abbr(lhs, rhs)
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

View file

@ -1,6 +1,9 @@
local function makeEnv(cond)
return {
active = cond,
-- I am doing this to get type hints!
active = function()
return cond
end,
not_active = function()
return not cond()
end,
@ -36,5 +39,5 @@ return {
return makeEnv(function()
return a.active() or b.active()
end)
end
end,
}

View file

@ -5,6 +5,7 @@ function M.setup()
require("my.options").setup()
require('my.keymaps').setup()
require('my.lazy').setup()
require('my.abbreviations').setup()
end
return M

View file

@ -14,6 +14,9 @@ function M.config()
},
},
}
-- Disable status line
vim.opt.laststatus = 0
end
return M

View file

@ -3,7 +3,7 @@ local env = require("my.helpers.env")
local M = {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
cond = env.vscode.not_active(),
cond = env.vscode.not_active() and env.firenvim.not_active(),
}
function M.config()

View 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

View file

@ -36,6 +36,10 @@ let
texlive.combined.scheme-full # Latex stuff
python38Packages.pygments # required for latex syntax highlighting
# Required by magma-nvim:
# python310Packages.pynvim
# python310Packages.jupyter
];
in
let