1
Fork 0

Many lua changes I guess

This commit is contained in:
Matei Adriel 2022-10-14 13:44:47 +02:00
parent aeefede352
commit 73e033c904
10 changed files with 87 additions and 23 deletions

View file

@ -23,12 +23,3 @@ vim.keymap.set("n", "<leader>ls", function()
end
end, opts("Run .setup() in current file"))
local status, wk = pcall(require, "which-key")
if status then
wk.register({
["<leader>l"] = {
name = "Local commands"
}
})
end

View file

@ -1,7 +1,7 @@
local arpeggio = require("my.plugins.arpeggio")
local A = require("my.abbreviations")
print("Initializing purescript keybinds...")
-- print("Initializing purescript keybinds...")
-- Use vt to test
arpeggio.chordSilent("n", "vt", ":VimuxRunCommand \"clear && spago test\"<CR>",

View file

@ -7,8 +7,8 @@ vim.opt.conceallevel = 0
vim.opt.wrap = true
vim.g.tex_conceal = "abdmg"
-- vim.g.vimtex_syntax_conceal = 1
vim.g.vimtex_imaps_enabled = 0
-- vim.g.vimtex_syntax_conceal = 1
local abbreviations = {
-- Greek chars
@ -28,8 +28,9 @@ local abbreviations = {
{ "ints", "\\mathbb{I}" },
{ "nats", "\\mathbb{N}" },
{ "rats", "\\mathbb{Q}" },
{ "rreal", "\\mathbb{R}" },
{ "ffield", "\\mathbb{F}" },
{ "rrea", "\\mathbb{R}" },
{ "ppri", "\\mathbb{P}" },
{ "ffie", "\\mathbb{F}" },
{ "ccom", "\\mathbb{C}" },
-- Exponents
@ -109,13 +110,17 @@ local abbreviations = {
-- words
{ "rref", "reduced row echalon form" }
{ "rref", "reduced row echalon form" },
{ "thrf", "therefore" }
}
local abolishAbbreviations = {
{ "egv{a,e}{,s}", "eigenv{alue,ector}{}" },
{ "ib{p,s}", "integration by {parts,substitution}" }
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
{ "ib{p,s}", "integration by {parts,substitution}" },
{ "mx{,s}", "matri{x,ces}" }
}
A.manyLocalAbbr(abbreviations)
AB.abolishMany(abolishAbbreviations)
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>", { desc = "Compile current buffer using vimtex" })

View file

@ -38,6 +38,17 @@ function M.setup()
M.move("Q", "yQ")
M.move("<C-^>", "<Leader>a", { desc = "Go to previous file" })
vim.keymap.set({ "n", "v" }, "qn", function()
local buf = vim.api.nvim_win_get_buf(0)
-- Only save if file is writable
if vim.bo[buf].modifiable and not vim.bo[buf].readonly then
vim.cmd [[write]]
end
vim.cmd "q"
end, { desc = "Quit current buffer" })
vim.keymap.set("n", "Q", ":wqa<cr>", { desc = "Save all files and quit" })
vim.keymap.set("n", "<leader>rw", ":%s/<C-r><C-w>/", {
desc = "Replace word in file"

View file

@ -42,12 +42,7 @@ function M.setup()
require("my.plugins.hydra").setup()
require("my.plugins.clipboard-image").setup()
require("mind").setup({
persistence = {
state_path = "~/Mind/mind.json",
data_dir = "~/Mind/data"
}
})
require("my.plugins.mind").setup()
-- require("my.plugins.slam").setup()
end

View file

@ -0,0 +1,32 @@
local mind = require("mind")
local M = {}
function M.setup()
mind.setup({
persistence = {
state_path = "~/Mind/mind.json",
data_dir = "~/Mind/data"
},
ui = {
width = 50
}
})
vim.keymap.set("n", "<leader>m", function()
local buffers = vim.api.nvim_list_bufs()
local should_open = true
for _, buf in pairs(buffers) do
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == "mind" then
should_open = false
vim.cmd("bd " .. buf)
end
end
if should_open then
mind.open_main()
end
end, { desc = "Toggle mind panel" })
end
return M

View file

@ -16,6 +16,7 @@ local keybinds = {
{ "<C-P>", "find_files", "Find files" },
{ "<Leader>ft", find_files_by_extension("tex"), "Find tex files" },
{ "<Leader>fl", find_files_by_extension("lua"), "Find lua files" },
{ "<Leader>fp", find_files_by_extension("purs"), "Find purescript files" },
{ "<Leader>d", "diagnostics", "Diagnostics" },
{ "<C-F>", "live_grep", "Search in project" },
{ "<Leader>t", "builtin", "Show builtin pickers" },

View file

@ -1,9 +1,17 @@
local wk = require("which-key")
local M = {}
function M.setup()
require("which-key").setup({
wk.setup({
triggers = { "<leader>", "d", "y", "q", "z", "g", "c" }
})
wk.register({
["<leader>l"] = {
name = "Local commands"
}
})
end
return M

View file

@ -31,6 +31,12 @@
"tex"
],
"path": "./snippets/latex/core.json"
},
{
"language": [
"lua"
],
"path": "./snippets/lua/core.json"
}
]
}

View file

@ -0,0 +1,15 @@
{
"Lua setup-module": {
"prefix": "msetup",
"description": "Create lua module with setup function inside",
"body": [
"local M = {}",
"",
"function M.setup()",
" $0",
"end",
"",
"return M"
]
}
}