Sketch out tempest neovim runtime
This commit is contained in:
parent
a456fe3781
commit
659fb33ca7
18 changed files with 783 additions and 390 deletions
home/features/neovim
|
@ -6,28 +6,6 @@ require("my.abbreviations.math").setup()
|
|||
|
||||
vim.opt.conceallevel = 0
|
||||
|
||||
-- {{{ Older functions for calculating things inside vim
|
||||
-- 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 = {
|
||||
-- Other fancy symvols
|
||||
{ "tmat", "^T" }, -- Tranpose of a matrix
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"LuaSnip": { "branch": "master", "commit": "409535b8fc54c650eb845b0c35e0cc7f08810284" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "63a860e7ed3ae41ee92481ea65a48fb35431ae21" },
|
||||
"catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" },
|
||||
"clipboard-image.nvim": { "branch": "main", "commit": "af8fdaad7e6fed0741e18dbf2f57bdc7494adaee" },
|
||||
"clipboard-image": { "branch": "main", "commit": "485de5493d196154db30f85665f8ac480ce116a2" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||
|
@ -10,7 +10,7 @@
|
|||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"conform": { "branch": "master", "commit": "5bf1405fd234d469243ea6f394e0aeec9ea53bd8" },
|
||||
"crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" },
|
||||
"crates": { "branch": "main", "commit": "b8ea20fda2e1029fbbb1bae7a9eab35c84037ca0" },
|
||||
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
|
@ -19,7 +19,7 @@
|
|||
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" },
|
||||
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
|
||||
"haskell-tools.nvim": { "branch": "master", "commit": "b19df600da8ef5fb4fb280815415ebd2a4228f0f" },
|
||||
"haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" },
|
||||
"hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
|
||||
"hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" },
|
||||
"idris2-nvim": { "branch": "main", "commit": "3a2b4d2b5ffeab9e47298456c59c31b4e1ddebc9" },
|
||||
|
@ -48,7 +48,7 @@
|
|||
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" },
|
||||
"nvim-tree": { "branch": "master", "commit": "7d1760f892951dd6a118dae1d7a1d8df5f029edf" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "0791b5ebb590a2d44e20640c52679df1fc42e8ab" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "a17c31268b56d53624fdc9cb03a225d4a17cabdb" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" },
|
||||
|
@ -59,6 +59,7 @@
|
|||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"purescript-vim": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" },
|
||||
"rasi.vim": { "branch": "main", "commit": "eac9969cf935cd4380987dc99bfa10d69d3f34a6" },
|
||||
"rust-tools": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"scrap.nvim": { "branch": "main", "commit": "16db44ae9403ec9c4b140394f294475d1af80a18" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "7aad6019dee974a01333523a5b8e122b7e7da454" },
|
||||
|
|
|
@ -6,10 +6,7 @@ local M = {}
|
|||
M.unicode = {
|
||||
-- {{{ Logic
|
||||
{ "frl", "∀" }, -- [f]o[r]al[l]
|
||||
|
||||
|
||||
|
||||
{ "exs", "∃" }, -- [e][x]ist[s]
|
||||
{ "exs", "∃" }, -- [e][x]ist[s]
|
||||
{ "land", "∧" }, -- [l]ogical [and]
|
||||
{ "Land", "⋀" }, -- arbitrary [l]ogical [and]
|
||||
{ "lor", "∨" }, -- [l]ogical [or]
|
||||
|
@ -23,6 +20,7 @@ M.unicode = {
|
|||
-- }}}
|
||||
-- {{{ Set theory
|
||||
{ "nolla", "∅" },
|
||||
{ "carprod", "×" }, -- cartesian product
|
||||
{ "sect", "∩" }, -- set intersection
|
||||
{ "Sect", "⋂" }, -- arbitrary set intersection
|
||||
{ "dsect", "⊓" }, -- disjoint set intersection (whatever that means lol)
|
||||
|
|
|
@ -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,42 +0,0 @@
|
|||
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
|
|
@ -117,7 +117,6 @@ function M.config()
|
|||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
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
|
|
@ -1,32 +0,0 @@
|
|||
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
|
|
@ -30,27 +30,13 @@ local M = {
|
|||
function M.on_attach(client, bufnr)
|
||||
-- {{{ Keymap helpers
|
||||
local opts = function(desc)
|
||||
return { noremap = true, silent = true, desc = desc, buffer = bufnr }
|
||||
return { 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")
|
||||
|
@ -131,7 +117,7 @@ local servers = {
|
|||
Lua = {
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
format = {
|
||||
enable = true
|
||||
enable = true,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
|
@ -215,9 +201,9 @@ 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.with(vim.lsp.handlers.hover, { border = "single" })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
|
||||
-- -- }}}
|
||||
|
||||
local capabilities = M.capabilities()
|
||||
|
@ -230,7 +216,7 @@ function lspconfig.config()
|
|||
|
||||
require("lspconfig")[lsp].setup({
|
||||
on_attach = details.on_attach,
|
||||
settings = details.settings, -- Specific per-language settings
|
||||
settings = details.settings, -- Specific per-language settings
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
|
||||
},
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
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
|
|
@ -1,26 +0,0 @@
|
|||
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
|
132
home/features/neovim/config/lua/my/runtime.lua
Normal file
132
home/features/neovim/config/lua/my/runtime.lua
Normal file
|
@ -0,0 +1,132 @@
|
|||
local M = {}
|
||||
|
||||
-- {{{ General helpers
|
||||
local function string_chars(str)
|
||||
local chars = {}
|
||||
for i = 1, #str do
|
||||
table.insert(chars, str:sub(i, i))
|
||||
end
|
||||
return chars
|
||||
end
|
||||
|
||||
local function with_default(default, given)
|
||||
if given == nil then
|
||||
return default
|
||||
else
|
||||
return given
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ API wrappers
|
||||
-- {{{ Keymaps
|
||||
function M.set_keymap(opts, context)
|
||||
if context == nil then
|
||||
context = {}
|
||||
end
|
||||
|
||||
local buffer = nil
|
||||
|
||||
if context.bufnr ~= nil then
|
||||
buffer = context.bufnr
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
string_chars(with_default("n", opts.mode)),
|
||||
opts.mapping,
|
||||
opts.action,
|
||||
{
|
||||
desc = opts.desc,
|
||||
buffer = with_default(buffer, opts.buffer),
|
||||
expr = opts.expr,
|
||||
silent = with_default(true, opts.silent),
|
||||
}
|
||||
)
|
||||
end
|
||||
-- }}}
|
||||
-- {{{ Autocmds
|
||||
function M.create_autocmd(opts)
|
||||
local callback
|
||||
|
||||
if type(opts.callback) == "function" then
|
||||
callback = opts.callback
|
||||
end
|
||||
|
||||
if type(opts.callback) == "table" then
|
||||
callback = function(event)
|
||||
M.configure(opts.callback, event)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(opts.event, {
|
||||
group = vim.api.nvim_create_augroup(opts.group, {}),
|
||||
pattern = opts.pattern,
|
||||
callback = callback,
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
-- }}}
|
||||
-- {{{ Main config runtime
|
||||
local function recursive_assign(source, destination)
|
||||
for key, value in pairs(source) do
|
||||
if type(value) == "table" then
|
||||
destination[key] = destination[key] or {}
|
||||
recursive_assign(value, destination[key])
|
||||
else
|
||||
destination[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.configure(opts, context)
|
||||
if type(opts.vim) == "table" then
|
||||
recursive_assign(opts, vim)
|
||||
end
|
||||
|
||||
if type(opts.keys) == "table" then
|
||||
local keys = opts.keys
|
||||
|
||||
-- Detect single key passed instead of array
|
||||
if keys.mapping ~= nil then
|
||||
keys = { keys }
|
||||
end
|
||||
|
||||
for _, keymap in ipairs(keys) do
|
||||
M.set_keymap(keymap, context)
|
||||
end
|
||||
end
|
||||
|
||||
if type(opts.autocmds) == "table" then
|
||||
local autocmds = opts.autocmds
|
||||
|
||||
-- Detect single autocmd passed instead of array
|
||||
if autocmds.pattern ~= nil then
|
||||
autocmds = { autocmds }
|
||||
end
|
||||
|
||||
for _, autocmd in ipairs(autocmds) do
|
||||
M.create_autocmd(autocmd)
|
||||
end
|
||||
end
|
||||
|
||||
if type(opts.setup) == "table" then
|
||||
for key, arg in pairs(opts.setup) do
|
||||
require(key).setup(arg)
|
||||
end
|
||||
end
|
||||
|
||||
if
|
||||
type(context) == "table"
|
||||
and context.opts ~= nil
|
||||
and context.lazy ~= nil
|
||||
then
|
||||
-- This is a terrible way to do it :/
|
||||
require(context.lazy.name).setup(context.opts)
|
||||
end
|
||||
|
||||
if type(opts.callback) == "function" then
|
||||
opts.callback(context)
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return M
|
|
@ -62,8 +62,8 @@ let
|
|||
# Latex setup
|
||||
texlive.combined.scheme-full # Latex stuff
|
||||
python38Packages.pygments # required for latex syntax highlighting
|
||||
sage
|
||||
sagetex # sage in latex
|
||||
# sage
|
||||
# sagetex # sage in latex
|
||||
|
||||
# required for the telescope fzf extension
|
||||
gnumake
|
||||
|
@ -208,28 +208,32 @@ in
|
|||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ Custom module testing
|
||||
# {{{ Plugins
|
||||
satellite.neovim.styluaConfig = ../../../stylua.toml;
|
||||
satellite.neovim.env.module = "my.helpers.env";
|
||||
satellite.neovim.runtime = {
|
||||
env = "my.helpers.env";
|
||||
languageServerOnAttach = "my.plugins.lspconfig";
|
||||
tempest = "my.runtime";
|
||||
};
|
||||
|
||||
# {{{ Nvim-tree
|
||||
# {{{ ui
|
||||
# {{{ nvim-tree
|
||||
satellite.neovim.lazy.nvim-tree = {
|
||||
package = "kyazdani42/nvim-tree.lua";
|
||||
|
||||
env.blacklist = [ "vscode" "firenvim" ];
|
||||
setup = true;
|
||||
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
|
||||
|
||||
keys.mapping = "<C-n>";
|
||||
keys.desc = "Toggle [n]vim-tree";
|
||||
keys.action = "<cmd>NvimTreeToggle<cr>";
|
||||
};
|
||||
# }}}
|
||||
# {{{ Lualine
|
||||
# {{{ lualine
|
||||
satellite.neovim.lazy.lualine = {
|
||||
package = "nvim-lualine/lualine.nvim";
|
||||
name = "lualine";
|
||||
|
||||
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
|
||||
env.blacklist = [ "vscode" "firenvim" ];
|
||||
event = "VeryLazy";
|
||||
|
||||
opts = {
|
||||
|
@ -254,71 +258,17 @@ in
|
|||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ Winbar
|
||||
# {{{ winbar
|
||||
satellite.neovim.lazy.winbar = {
|
||||
package = "fgheng/winbar.nvim";
|
||||
name = "winbar";
|
||||
|
||||
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
|
||||
env.blacklist = [ "vscode" "firenvim" ];
|
||||
event = "VeryLazy";
|
||||
|
||||
opts.enabled = true;
|
||||
};
|
||||
# }}}
|
||||
# {{{ Flash
|
||||
satellite.neovim.lazy.flash = {
|
||||
package = "folke/flash.nvim";
|
||||
name = "flash";
|
||||
|
||||
cond = nlib.blacklistEnv [ "vscode" ];
|
||||
keys =
|
||||
let keybind = mode: mapping: action: desc: {
|
||||
inherit mapping desc mode;
|
||||
action = nlib.thunk /* lua */ ''require("flash").${action}()'';
|
||||
};
|
||||
in
|
||||
[
|
||||
(keybind "nxo" "s" "jump" "Flash")
|
||||
(keybind "nxo" "S" "treesitter" "Flash Treesitter")
|
||||
(keybind "o" "r" "remote" "Remote Flash")
|
||||
(keybind "ox" "R" "treesitter_search" "Treesitter Search")
|
||||
(keybind "c" "<C-S>" "toggle" "Toggle Flash Search")
|
||||
];
|
||||
|
||||
# Disable stuff like f/t/F/T
|
||||
opts.modes.char.enabled = false;
|
||||
};
|
||||
# }}}
|
||||
# {{{ Conform.nvim
|
||||
satellite.neovim.lazy.conform = {
|
||||
package = "stevearc/conform.nvim";
|
||||
name = "conform";
|
||||
|
||||
cond = nlib.blacklistEnv [ "vscode" ];
|
||||
event = "BufReadPost";
|
||||
|
||||
opts.format_on_save.lsp_fallback = true;
|
||||
opts.formatters_by_ft = {
|
||||
lua = [ "stylua" ];
|
||||
python = [ "ruff_format" ];
|
||||
javascript = [ [ "prettierd" "prettier" ] ];
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ Neoconf
|
||||
satellite.neovim.lazy.neoconf = {
|
||||
package = "folke/neoconf.nvim";
|
||||
name = "neoconf";
|
||||
|
||||
cmd = "Neoconf";
|
||||
opts.import = {
|
||||
vscode = true; # local .vscode/settings.json
|
||||
coc = false; # global/local coc-settings.json
|
||||
nlsp = false; # global/local nlsp-settings.nvim json settings
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ Harpoon
|
||||
# {{{ harpoon
|
||||
satellite.neovim.lazy.harpoon = {
|
||||
package = "ThePrimeagen/harpoon";
|
||||
keys =
|
||||
|
@ -355,4 +305,212 @@ in
|
|||
};
|
||||
# }}}
|
||||
# }}}
|
||||
# {{{ editing
|
||||
# {{{ flash
|
||||
satellite.neovim.lazy.flash = {
|
||||
package = "folke/flash.nvim";
|
||||
|
||||
env.blacklist = [ "vscode" ];
|
||||
keys =
|
||||
let keybind = mode: mapping: action: desc: {
|
||||
inherit mapping desc mode;
|
||||
action = nlib.thunk /* lua */ ''require("flash").${action}()'';
|
||||
};
|
||||
in
|
||||
[
|
||||
(keybind "nxo" "s" "jump" "Flash")
|
||||
(keybind "nxo" "S" "treesitter" "Flash Treesitter")
|
||||
(keybind "o" "r" "remote" "Remote Flash")
|
||||
(keybind "ox" "R" "treesitter_search" "Treesitter Search")
|
||||
(keybind "c" "<C-S>" "toggle" "Toggle Flash Search")
|
||||
];
|
||||
|
||||
# Disable stuff like f/t/F/T
|
||||
opts.modes.char.enabled = false;
|
||||
};
|
||||
# }}}
|
||||
# {{{ clipboard-image
|
||||
satellite.neovim.lazy.clipboard-image = {
|
||||
package = "postfen/clipboard-image.nvim";
|
||||
|
||||
env.blacklist = [ "firenvim" ];
|
||||
cmd = "PasteImg";
|
||||
|
||||
keys = {
|
||||
mapping = "<leader>p";
|
||||
action = "<cmd>PasteImg<cr>";
|
||||
desc = "[P]aste image from clipboard";
|
||||
};
|
||||
|
||||
opts.default.img_name = nlib.import ./plugins/clipboard-image.lua "img_name";
|
||||
opts.tex = {
|
||||
img_dir = [ "%:p:h" "img" ];
|
||||
affix = "\\includegraphics[width=\\textwidth]{%s}";
|
||||
};
|
||||
opts.typst = {
|
||||
img_dir = [ "%:p:h" "img" ];
|
||||
affix = ''#image("%s", width: 100)'';
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# }}}
|
||||
# {{{ ide
|
||||
# {{{ conform
|
||||
satellite.neovim.lazy.conform = {
|
||||
package = "stevearc/conform.nvim";
|
||||
|
||||
env.blacklist = [ "vscode" ];
|
||||
event = "BufReadPost";
|
||||
|
||||
opts.format_on_save.lsp_fallback = true;
|
||||
opts.formatters_by_ft = let prettier = [ [ "prettierd" "prettier" ] ]; in
|
||||
{
|
||||
lua = [ "stylua" ];
|
||||
python = [ "ruff_format" ];
|
||||
|
||||
javascript = prettier;
|
||||
typescript = prettier;
|
||||
javascriptreact = prettier;
|
||||
typescriptreact = prettier;
|
||||
html = prettier;
|
||||
css = prettier;
|
||||
markdown = prettier;
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ neoconf
|
||||
satellite.neovim.lazy.neoconf = {
|
||||
package = "folke/neoconf.nvim";
|
||||
|
||||
cmd = "Neoconf";
|
||||
|
||||
opts.import = {
|
||||
vscode = true; # local .vscode/settings.json
|
||||
coc = false; # global/local coc-settings.json
|
||||
nlsp = false; # global/local nlsp-settings.nvim json settings
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# }}}
|
||||
# {{{ language support
|
||||
# {{{ haskell
|
||||
satellite.neovim.lazy.haskell-tools = {
|
||||
package = "mrcjkb/haskell-tools.nvim";
|
||||
dependencies.lua = [ "nvim-lua/plenary.nvim" ];
|
||||
version = "^2";
|
||||
|
||||
env.blacklist = [ "vscode" ];
|
||||
ft = [ "haskell" "lhaskell" "cabal" "cabalproject" ];
|
||||
|
||||
setup.vim.g.haskell_tools = {
|
||||
hls = {
|
||||
on_attach = nlib.lua /* lua */ ''require("my.plugins.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;
|
||||
};
|
||||
};
|
||||
|
||||
# I think this wasn't showing certain docs as I expected (?)
|
||||
tools.hover.enable = false;
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ rust
|
||||
# {{{ rust-tools
|
||||
satellite.neovim.lazy.rust-tools = {
|
||||
package = "simrat39/rust-tools.nvim";
|
||||
|
||||
env.blacklist = [ "vscode" ];
|
||||
ft = "rust";
|
||||
|
||||
opts.server.on_attach = nlib.languageServerOnAttach {
|
||||
keys = {
|
||||
mapping = "<leader>lc";
|
||||
action = "<cmd>RustOpenCargo<cr>";
|
||||
desc = "Open [c]argo.toml";
|
||||
};
|
||||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ crates
|
||||
satellite.neovim.lazy.crates = {
|
||||
package = "saecki/crates.nvim";
|
||||
dependencies.lua = [ "nvim-lua/plenary.nvim" ];
|
||||
|
||||
env.blacklist = [ "vscode" ];
|
||||
event = "BufReadPost Cargo.toml";
|
||||
|
||||
# {{{ Set up null_ls source
|
||||
opts.null_ls = {
|
||||
enabled = true;
|
||||
name = "crates";
|
||||
};
|
||||
# }}}
|
||||
|
||||
setup.autocmds = [
|
||||
# {{{ Load cmp source on insert
|
||||
{
|
||||
event = "InsertEnter";
|
||||
group = "CargoCmpSource";
|
||||
pattern = "Cargo.toml";
|
||||
callback = nlib.thunkString /* lua */ ''
|
||||
require("cmp").setup.buffer({ sources = { { name = "crates" } } })
|
||||
'';
|
||||
}
|
||||
# }}}
|
||||
# {{{ Load keybinds on attach
|
||||
{
|
||||
event = "BufReadPost";
|
||||
group = "CargoKeybinds";
|
||||
pattern = "Cargo.toml";
|
||||
# {{{ Register which-key info
|
||||
callback.callback = nlib.contextThunk /* lua */ ''
|
||||
require("which-key").register({
|
||||
["<leader>lc"] = {
|
||||
name = "[l]ocal [c]rates",
|
||||
bufnr = context.bufnr
|
||||
},
|
||||
})
|
||||
'';
|
||||
# }}}
|
||||
|
||||
callback.keys =
|
||||
let
|
||||
# {{{ Keymap helpers
|
||||
keymap = mapping: action: desc: {
|
||||
inherit mapping desc;
|
||||
action = nlib.lua ''require("crates").${action}'';
|
||||
};
|
||||
|
||||
keyroot = "<leader>lc";
|
||||
# }}}
|
||||
in
|
||||
# {{{ Keybinds
|
||||
[
|
||||
(keymap "${keyroot}t" "toggle" "[c]rates [t]oggle")
|
||||
(keymap "${keyroot}r" "reload" "[c]rates [r]efresh")
|
||||
|
||||
(keymap "${keyroot}H" "open_homepage" "[c]rate [H]omephage")
|
||||
(keymap "${keyroot}R" "open_repository" "[c]rate [R]epository")
|
||||
(keymap "${keyroot}D" "open_documentation" "[c]rate [D]ocumentation")
|
||||
(keymap "${keyroot}C" "open_crates_io" "[c]rate [C]rates.io")
|
||||
|
||||
(keymap "${keyroot}v" "show_versions_popup" "[c]rate [v]ersions")
|
||||
(keymap "${keyroot}f" "show_features_popup" "[c]rate [f]eatures")
|
||||
(keymap "${keyroot}d" "show_dependencies_popup" "[c]rate [d]eps")
|
||||
(keymap "K" "show_popup" "[c]rate popup")
|
||||
];
|
||||
# }}}
|
||||
}
|
||||
# }}}
|
||||
];
|
||||
};
|
||||
# }}}
|
||||
# }}}
|
||||
# }}}
|
||||
# }}}
|
||||
}
|
||||
|
|
15
home/features/neovim/plugins/clipboard-image.lua
Normal file
15
home/features/neovim/plugins/clipboard-image.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
function M.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
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue