This commit is contained in:
2023-11-03 21:04:02 +01:00
commit 3b1035fd35
14 changed files with 372 additions and 0 deletions

60
plugins/colors.lua Normal file
View File

@@ -0,0 +1,60 @@
local function int_lerp(a, b, c)
return math.floor((1 - c) * a + c * b + 0.5)
end
local function rgb_lerp(a, b, c)
return {
int_lerp(a[1], b[1], c),
int_lerp(a[2], b[2], c),
int_lerp(a[3], b[3], c),
}
end
local function hex_to_rgb(hex)
local ret = {}
for i = 2,6,2 do -- Skip '#'
local s = hex:sub(i, i + 1)
table.insert(ret, tonumber(s, 16))
end
return ret
end
local function rgb_to_hex(rgb)
return string.format("#%x%x%x", unpack(rgb))
end
local function hex_lerp(a, b, c)
a = hex_to_rgb(a);
b = hex_to_rgb(b);
return rgb_to_hex(rgb_lerp(a, b, c))
end
return {
{
"AstroNvim/astrotheme",
optional = true,
opts = {
style = {
simple_syntax_colors = true,
inactive = false,
},
palettes = {
astrobox = {},
},
highlights = {
global = {
modify_hl_groups = function(hl, c)
hl.DiffAdd = { bg = hex_lerp(hl.DiffAdd.bg, c.ui.base, 0.8)}
hl.DiffDelete = { bg = hex_lerp(hl.DiffDelete.bg, c.ui.base, 0.8)}
hl.DiffChange = { bg = hex_lerp(c.ui.blue, c.ui.base, 0.8)}
hl.DiffText = { bg = hex_lerp(hl.DiffText.bg, c.ui.base, 0.8)}
end,
},
astrobox = {},
},
},
},
{
url = "https://git.niverton.tk/niverton/Astrobox.git"
},
}

29
plugins/community.lua Normal file
View File

@@ -0,0 +1,29 @@
-- Filter by hostname
local home = vim.fn.hostname() == "comanche"
local work = not home
return {
"AstroNvim/astrocommunity",
-- Language packs
{ enabled = true, import = "astrocommunity.pack.cpp" },
{ enabled = true, import = "astrocommunity.pack.lua" },
{ enabled = true, import = "astrocommunity.pack.markdown" },
-- { enabled = true, import = "astrocommunity.pack.rust" },
{ enabled = home, import = "astrocommunity.pack.bash" },
{ enabled = home, import = "astrocommunity.pack.html-css" },
{ enabled = home, import = "astrocommunity.pack.java" },
{ enabled = work, import = "astrocommunity.pack.cs" },
{ enabled = work, import = "astrocommunity.pack.ps1" },
-- { enable = home, import = "astrocommunity.pack.wgsl" }, -- WebGLShaderLanguage
-- DAP
{ import = "astrocommunity.debugging.telescope-dap-nvim" },
{ import = "astrocommunity.debugging.nvim-dap-virtual-text" },
{ import = "astrocommunity.debugging.nvim-dap-repl-highlights" },
-- Others
-- TODO usefull?
{ import = "astrocommunity.debugging.nvim-bqf" },
}

82
plugins/heirline.lua Normal file
View File

@@ -0,0 +1,82 @@
return {
"rebelot/heirline.nvim",
opts = function(_, opts)
local status = require "astronvim.utils.status"
opts.statusline = {
hl = { fg = "fg", bg = "bg" },
status.component.mode { mode_text = { hl = { bold = true }, padding = { left = 1, right = 1 } } },
status.component.file_info {
filetype = false,
filename = {
modify = ":~:."
},
file_modified = {}
},
status.component.diagnostics(),
status.component.fill(),
status.component.cmd_info(),
status.component.fill(),
status.component.lsp(),
status.component.treesitter{ padding = { right = 1 } }, -- Extra space to separate from next component
status.component.git_diff(),
status.component.git_branch(),
status.component.nav { scrollbar = false },
}
local get_file_path = status.provider.filename {
modify = ":~:.:h" -- Relative path and cut filename
}
-- Fix path separation on windows
local path_func = get_file_path
if vim.fn.has("win32") then
path_func = function(self)
local str = get_file_path(self)
return string.gsub(str, "\\", "/")
end
end
opts.winbar = {
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
fallthrough = false,
{
condition = function() return not status.condition.is_active() end,
{
-- Set display priority to hide when component is too big to
-- fit
flexible = 1,
status.component.separated_path {
flexible = 2,
max_depth = 5,
path_func = path_func,
},
status.component.separated_path {
flexible = 3,
max_depth = 3,
path_func = path_func,
},
status.component.separated_path {
flexible = 4,
max_depth = 1,
path_func = path_func,
},
{
-- Hide
provider = ""
}
},
status.component.file_info {
file_icon = { hl = status.hl.file_icon "winbar", padding = { left = 0 } },
file_modified = false,
file_read_only = false,
hl = status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
},
},
status.component.breadcrumbs(),
}
return opts
end,
}

16
plugins/init.lua Normal file
View File

@@ -0,0 +1,16 @@
return {
{ "echasnovski/mini.align", event = "User AstroFile", config = function() require("mini.align").setup {} end },
{
"serenevoid/kiwi.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
{ name = "main", path = "~/kiwi/main" },
},
keys = {
{ "<leader>ww", ':lua require("kiwi").open_wiki_index()<cr>', desc = "Open Wiki index" },
{ "<leader>t", ':lua require("kiwi").todo.toggle()<cr>', desc = "Toggle Markdown Task" },
},
lazy = true,
},
{ "tpope/vim-abolish", event = "User AstroFile" },
}

10
plugins/luasnip.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
{
"L3MON4D3/LuaSnip",
optional = true,
config = function(plugin, opts)
require "plugins.configs.luasnip"(plugin, opts)
require("luasnip.loaders.from_vscode").lazy_load { paths = { "./lua/user/snippets" } }
end,
}
}