Backup
This commit is contained in:
parent
7c61e64fa8
commit
01ee066c62
20 changed files with 182 additions and 657 deletions
dotfiles/neovim
|
@ -1,11 +1,9 @@
|
|||
local A = require("my.plugins.arpeggio")
|
||||
|
||||
print("Initializing nix keybinds...")
|
||||
|
||||
-- Use _ug_ to fetchgit stuff
|
||||
A.chordSilent("n", "ug",
|
||||
":lua require('my.helpers.update-nix-fetchgit').update()<CR>",
|
||||
{ settings = "b" })
|
||||
-- Use _<leader>lg_ to fetchgit stuff
|
||||
vim.keymap.set("n", "<leader>lg", function()
|
||||
require("my.helpers").saveCursor(function()
|
||||
vim.cmd(":%!update-nix-fetchgit")
|
||||
end)
|
||||
end, { buffer = true, desc = "Update all fetchgit calls" })
|
||||
|
||||
-- Idk why this isn't here by default
|
||||
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
local arpeggio = require("my.plugins.arpeggio")
|
||||
local A = require("my.abbreviations")
|
||||
|
||||
-- print("Initializing purescript keybinds...")
|
||||
|
||||
-- Use vt to test
|
||||
arpeggio.chordSilent("n", "vt", ":VimuxRunCommand \"clear && spago test\"<CR>",
|
||||
{ settings = "b" })
|
||||
|
|
|
@ -10,6 +10,26 @@ vim.g.tex_conceal = "abdmg"
|
|||
vim.g.vimtex_imaps_enabled = 0
|
||||
-- vim.g.vimtex_syntax_conceal = 1
|
||||
|
||||
vim.keymap.set("n", "<leader>lg", function()
|
||||
if not pcall(function()
|
||||
local a = tonumber(vim.fn.input("A: "))
|
||||
local b = tonumber(vim.fn.input("B: "))
|
||||
|
||||
local g, x, y = require("my.helpers.math.mod").gcd(a, b)
|
||||
|
||||
vim.fn.input("Result: " .. g .. " " .. x .. " " .. y)
|
||||
end) then vim.fn.input("No results exist") end
|
||||
end, { buffer = true, desc = "Gcd calculator" })
|
||||
|
||||
vim.keymap.set("n", "<leader>li", function()
|
||||
if not pcall(function()
|
||||
local class = tonumber(vim.fn.input("Mod class: "))
|
||||
local num = tonumber(vim.fn.input("Number: "))
|
||||
|
||||
vim.fn.input("Result: " .. require("my.helpers.math.mod").modinverse(num, class))
|
||||
end) then vim.fn.input("No results exist") end
|
||||
end, { buffer = true, desc = "Mod inverse calculator" })
|
||||
|
||||
local abbreviations = {
|
||||
-- Greek chars
|
||||
{ "eps", "\\epsilon" },
|
||||
|
@ -22,18 +42,14 @@ local abbreviations = {
|
|||
{ "theta", "\\theta" },
|
||||
{ "gamma", "\\gamma" },
|
||||
{ "lam", "\\lambda" },
|
||||
{ "nuls", "\\varnothing" },
|
||||
|
||||
-- Other fancy symvols
|
||||
{ "nuls", "\\varnothing" }, -- Other fancy symvols
|
||||
{ "ints", "\\mathbb{Z}" },
|
||||
{ "nats", "\\mathbb{N}" },
|
||||
{ "rats", "\\mathbb{Q}" },
|
||||
{ "rrea", "\\mathbb{R}" },
|
||||
{ "ppri", "\\mathbb{P}" },
|
||||
{ "ffie", "\\mathbb{F}" },
|
||||
{ "ccom", "\\mathbb{C}" },
|
||||
|
||||
-- Exponents
|
||||
{ "ccom", "\\mathbb{C}" }, -- Exponents
|
||||
{ "ei", "^{-1}" },
|
||||
{ "e0", "^{0}" },
|
||||
{ "e1", "^{1}" },
|
||||
|
@ -45,17 +61,14 @@ local abbreviations = {
|
|||
{ "ett", "^{t}" },
|
||||
{ "tmat", "^{T}" }, -- Tranpose of a matrix
|
||||
{ "cmat", "^{*}" }, -- Conjugate of a matrix
|
||||
{ "etp", "^{+}" },
|
||||
|
||||
-- Subscripts
|
||||
{"ortco", "^{\\bot}"}, -- Orthogonal complement
|
||||
{ "etp", "^{+}" }, -- Subscripts
|
||||
{ "s0", "_{0}" },
|
||||
{ "s1", "_{1}" },
|
||||
{ "s2", "_{2}" },
|
||||
{ "s3", "_{3}" },
|
||||
{ "s4", "_{4}" },
|
||||
{ "sn", "_{n}" },
|
||||
|
||||
-- Function calls
|
||||
{ "sn", "_{n}" }, -- Function calls
|
||||
{ "fx", "f(x)" },
|
||||
{ "gx", "g(x)" },
|
||||
{ "hx", "h(x)" },
|
||||
|
@ -66,9 +79,7 @@ local abbreviations = {
|
|||
{ "hoa", "h(a)" },
|
||||
{ "dfx", "f'(x)" },
|
||||
{ "dgx", "g'(x)" },
|
||||
{ "dhx", "h'(x)" },
|
||||
|
||||
-- Basic commands
|
||||
{ "dhx", "h'(x)" }, -- Basic commands
|
||||
{ "mangle", "\\measuredangle" },
|
||||
{ "aangle", "\\angle" },
|
||||
{ "creq", "\\\\&=" },
|
||||
|
@ -110,20 +121,24 @@ local abbreviations = {
|
|||
{ "ndiv", "\\not\\|\\:" },
|
||||
|
||||
-- words
|
||||
{ "rref", "reduced row echalon form" },
|
||||
{ "rref", "reduced row echalon form" }
|
||||
}
|
||||
|
||||
-- Todo: convert exponents and subscripts
|
||||
-- to use this more concise notation.
|
||||
local abolishAbbreviations = {
|
||||
{ "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
|
||||
{ "ib{p,s}", "integration by {parts,substitution}" },
|
||||
{ "mx{,s}", "matri{x,ces}" },
|
||||
{ "thrf", "therefore" }
|
||||
{ "thrf", "therefore" },
|
||||
{ "dete{,s}", "determinant{}" },
|
||||
{ "bcla", "by contradiction let's assume" },
|
||||
{ "ort{n,g}", "orto{normal,gonal}" },
|
||||
{ "l{in,de}", "linearly {independent,dependent}" }
|
||||
}
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
AB.abolishMany(abolishAbbreviations)
|
||||
|
||||
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>", {
|
||||
desc = "Compile current buffer using vimtex",
|
||||
buffer = true
|
||||
})
|
||||
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>",
|
||||
{ desc = "Compile current buffer using vimtex", buffer = true })
|
||||
|
|
15
dotfiles/neovim/lua/my/helpers/math/mod.lua
Normal file
15
dotfiles/neovim/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
|
|
@ -3,46 +3,46 @@ local helpers = require("my.helpers")
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local opt = vim.opt -- to set options
|
||||
local opt = vim.opt -- to set options
|
||||
|
||||
-- Disable filetype.vim
|
||||
vim.g.do_filetype_lua = true
|
||||
vim.g.did_load_filetypes = false
|
||||
-- Disable filetype.vim
|
||||
vim.g.do_filetype_lua = true
|
||||
vim.g.did_load_filetypes = false
|
||||
|
||||
-- Basic options
|
||||
opt.joinspaces = false -- No double spaces with join
|
||||
opt.list = true -- Show some invisible characters
|
||||
opt.cmdheight = 0 -- Hide command line when it's not getting used
|
||||
-- Basic options
|
||||
opt.joinspaces = false -- No double spaces with join
|
||||
opt.list = true -- Show some invisible characters
|
||||
opt.cmdheight = 0 -- Hide command line when it's not getting used
|
||||
|
||||
-- Line numbers
|
||||
opt.number = true -- Show line numbers
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
-- Line numbers
|
||||
opt.number = true -- Show line numbers
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
|
||||
-- TODO: only do this for specific filestypes
|
||||
opt.expandtab = true -- Use spaces for the tab char
|
||||
-- TODO: only do this for specific filestypes
|
||||
opt.expandtab = true -- Use spaces for the tab char
|
||||
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.termguicolors = true -- True color support
|
||||
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.smartcase = true -- Do not ignore case with capitals
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.smartcase = true -- Do not ignore case with capitals
|
||||
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
|
||||
opt.wrap = false -- Disable line wrap (by default)
|
||||
opt.wildmode = { 'list', 'longest' } -- Command-line completion mode
|
||||
opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
opt.wrap = false -- Disable line wrap (by default)
|
||||
opt.wildmode = {'list', 'longest'} -- Command-line completion mode
|
||||
opt.completeopt = {"menu", "menuone", "noselect"}
|
||||
|
||||
-- Set leader
|
||||
helpers.global("mapleader", " ")
|
||||
-- Set leader
|
||||
helpers.global("mapleader", " ")
|
||||
|
||||
-- Import other options
|
||||
require("my.options.folding").setup()
|
||||
-- Import other options
|
||||
require("my.options.folding").setup()
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
local M = {}
|
||||
|
||||
|
||||
function M.setup()
|
||||
local paq = require("paq")
|
||||
local themePackages = require("my.theme").deps
|
||||
|
@ -62,6 +61,8 @@ function M.setup()
|
|||
"phaazon/mind.nvim", -- Organize shit as trees
|
||||
"bfredl/nvim-luadev", -- lua repl thingy
|
||||
"akinsho/toggleterm.nvim", -- cool terminal thingy
|
||||
"folke/noice.nvim", -- better ui for cmd line and other stuff
|
||||
"rcarriga/nvim-notify", -- better notifiaction ui
|
||||
|
||||
-- Git stuff
|
||||
"ruifm/gitlinker.nvim", -- generate permalinks for code
|
||||
|
|
|
@ -2,25 +2,19 @@ local M = {}
|
|||
|
||||
function M.setup()
|
||||
local opts = function(desc)
|
||||
return {
|
||||
desc = desc,
|
||||
silent = true
|
||||
}
|
||||
return { desc = desc, silent = true }
|
||||
end
|
||||
vim.keymap.set({ "n", "v", "o" }, "qf", "<Plug>(easymotion-bd-f)", opts("Hop to char"))
|
||||
vim.keymap.set({ "n", "v", "o" }, "qj", "<Plug>(easymotion-overwin-f2)", opts("Hop to char pair"))
|
||||
vim.keymap.set({ "n", "v", "o" }, "qw", ":silent <Plug>(easymotion-bd-w)", opts("Hop to word"))
|
||||
vim.keymap.set({ "n", "v", "o" }, "qL", "silent <Plug>(easymotion-bd-L)", opts("Hop to line (?)"))
|
||||
|
||||
local modes = { "n", "v", "o" }
|
||||
|
||||
vim.keymap.set(modes, "qf", "<Plug>(easymotion-bd-f)", opts("Hop to char"))
|
||||
vim.keymap.set(modes, "qj", "<Plug>(easymotion-overwin-f2)", opts("Hop to char pair"))
|
||||
vim.keymap.set(modes, "qw", "<Plug>(easymotion-bd-w)", opts("Hop to word"))
|
||||
vim.keymap.set(modes, "qL", "<Plug>(easymotion-bd-L)", opts("Hop to line (?)"))
|
||||
|
||||
local status, wk = pcall(require, "which-key")
|
||||
|
||||
if status then
|
||||
wk.register({
|
||||
q = {
|
||||
name = "Easymotion"
|
||||
}
|
||||
})
|
||||
end
|
||||
if status then wk.register({ q = { name = "Easymotion" } }, { mode = "o" }) end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -8,8 +8,6 @@ function M.setup()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
print("Initialized firenvim")
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -23,8 +23,8 @@ function M.setup()
|
|||
|
||||
for key, value in pairs(idrisChords) do
|
||||
arpeggio.chord("n", "i" .. key,
|
||||
":lua require('idris2.code_action')." ..
|
||||
value .. "()<CR>", { settings = "b" })
|
||||
":lua require('idris2.code_action')." .. value .. "()<CR>",
|
||||
{ settings = "b" })
|
||||
end
|
||||
end
|
||||
},
|
||||
|
|
|
@ -21,6 +21,7 @@ function M.setup()
|
|||
require("toggleterm").setup()
|
||||
|
||||
require("my.plugins.neogit").setup()
|
||||
require("my.plugins.noice").setup()
|
||||
end)
|
||||
|
||||
require("my.plugins.dashboard").setup()
|
||||
|
@ -31,6 +32,7 @@ function M.setup()
|
|||
require("my.plugins.null-ls").setup()
|
||||
require("my.plugins.vimtex").setup()
|
||||
require("my.plugins.lean").setup()
|
||||
require("my.plugins.notify").setup()
|
||||
end)
|
||||
|
||||
if env.firevim.active() then
|
||||
|
@ -40,7 +42,6 @@ function M.setup()
|
|||
require("my.plugins.paperplanes").setup()
|
||||
end
|
||||
|
||||
|
||||
require("my.plugins.hydra").setup()
|
||||
require("my.plugins.clipboard-image").setup()
|
||||
require("my.plugins.mind").setup()
|
||||
|
|
|
@ -4,10 +4,7 @@ function M.on_attach(client, bufnr)
|
|||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
print("Initializing formatter...")
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", {}),
|
||||
buffer = bufnr,
|
||||
|
@ -17,8 +14,6 @@ function M.on_attach(client, bufnr)
|
|||
})
|
||||
end
|
||||
|
||||
print("Setting up keybinds...")
|
||||
|
||||
local opts = function(desc)
|
||||
return { noremap = true, silent = true, desc = desc }
|
||||
end
|
||||
|
@ -38,20 +33,17 @@ function M.on_attach(client, bufnr)
|
|||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts("Rename"))
|
||||
vim.keymap.set("n", "<leader>c", vim.lsp.buf.code_action, opts("Code actions"))
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, opts("Format"))
|
||||
|
||||
print("Initialized language server!")
|
||||
end
|
||||
|
||||
local function on_attach_typescript(client, bufnr)
|
||||
-- We handle formatting using null-ls and prettierd
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
|
||||
M.on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
-- General server config
|
||||
local servers = {
|
||||
tsserver = { on_attach = on_attach_typescript },
|
||||
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
|
||||
},
|
||||
dhall_lsp_server = {},
|
||||
sumneko_lua = {
|
||||
settings = {
|
||||
|
@ -79,9 +71,7 @@ local servers = {
|
|||
purescriptls = {
|
||||
settings = {
|
||||
purescript = {
|
||||
censorWarnings = {
|
||||
"UnusedName", "ShadowedName", "UserDefinedWarning"
|
||||
},
|
||||
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
|
||||
formatter = "purs-tidy"
|
||||
}
|
||||
}
|
||||
|
@ -112,9 +102,7 @@ local servers = {
|
|||
}
|
||||
|
||||
function M.setup()
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
|
||||
.protocol
|
||||
.make_client_capabilities())
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
-- Setup basic language servers
|
||||
for lsp, details in pairs(servers) do
|
||||
|
|
34
dotfiles/neovim/lua/my/plugins/noice.lua
Normal file
34
dotfiles/neovim/lua/my/plugins/noice.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local H = require("my.helpers")
|
||||
local M = {}
|
||||
|
||||
local function skip_containing(string, opts)
|
||||
local defaultOptions = { event = "msg_show", kind = "", find = string }
|
||||
local filter = H.mergeTables(defaultOptions, opts or {})
|
||||
return { filter = filter, opts = { skip = true } }
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
-- s - search hit bottom messages
|
||||
-- c - no pattern found and whatnot
|
||||
vim.opt.shortmess:append("scC")
|
||||
-- vim.opt.shortmess = "sc"
|
||||
|
||||
require("noice").setup({
|
||||
cmdline = {
|
||||
view = "cmdline",
|
||||
format = {
|
||||
search_down = { kind = "search", pattern = "^/", icon = "🔎", lang = "regex" },
|
||||
search_up = { kind = "search", pattern = "^%?", icon = "🔎", lang = "regex" }
|
||||
}
|
||||
},
|
||||
routes = {
|
||||
-- Filter out "Written ..." messages
|
||||
skip_containing("written"),
|
||||
skip_containing("search hit", { event = "wmsg" }),
|
||||
skip_containing("pattern not found", { event = "msg_show" })
|
||||
},
|
||||
lsp = { progres = { enabled = false } }
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
7
dotfiles/neovim/lua/my/plugins/notify.lua
Normal file
7
dotfiles/neovim/lua/my/plugins/notify.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.notify = require("notify")
|
||||
end
|
||||
|
||||
return M
|
|
@ -9,12 +9,19 @@ function M.setup()
|
|||
-- null_ls.builtins.formatting.prettierd.with({extra_filetypes = {}}), -- format ts files
|
||||
|
||||
null_ls.builtins.formatting.prettier.with({ extra_filetypes = {} }), -- format ts files
|
||||
-- null_ls.builtins.formatting.lua_format -- format lua code
|
||||
null_ls.builtins.formatting.lua_format.with({
|
||||
-- extra_args = function(params)
|
||||
-- return params.options and params.options.tabSize and
|
||||
-- { "--indent-width=" .. params.options.tabSize }
|
||||
-- end
|
||||
}) -- format lua code
|
||||
}
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources, on_attach = lspconfig.on_attach
|
||||
, debug = true })
|
||||
sources = sources,
|
||||
on_attach = lspconfig.on_attach,
|
||||
debug = true
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,14 +4,12 @@ local M = {}
|
|||
|
||||
function M.setup()
|
||||
wk.setup({
|
||||
triggers = { "<leader>", "d", "y", "q", "z", "g", "c" }
|
||||
triggers = { "<leader>", "d", "y", "q", "z", "g", "c" },
|
||||
show_help = false,
|
||||
show_keys = false
|
||||
})
|
||||
|
||||
wk.register({
|
||||
["<leader>l"] = {
|
||||
name = "Local commands"
|
||||
}
|
||||
})
|
||||
wk.register({ ["<leader>l"] = { name = "Local commands" } })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue