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

1
colorscheme.lua Normal file
View File

@@ -0,0 +1 @@
return "astrobox"

12
highlights/init.lua Normal file
View File

@@ -0,0 +1,12 @@
return function()
-- Remove italic in documentation comments
local docComment = vim.api.nvim_get_hl(0, { name = "Comment" })
docComment.italic = false
docComment.nocombine = true -- Don't merge missing attributes from inherited highlight group
return {
["@comment.doc"] = docComment,
["@comment.documentation"] = docComment,
["@lsp.mod.documentation"] = docComment,
}
end

6
lsp/formatting.lua Normal file
View File

@@ -0,0 +1,6 @@
return {
-- control auto formatting on save
format_on_save = {
enabled = false, -- enable or disable format on save globally
},
}

19
mappings.lua Normal file
View File

@@ -0,0 +1,19 @@
return {
n = {
["<leader><leader>"] = {
function()
vim.cmd([[cclose]])
vim.cmd([[pclose]])
vim.fn.setreg('/', '')
end,
desc = "Clean up"
}
},
t = {
['<Esc>'] = [[<C-\><C-n>]],
['<A-h>'] = [[<C-\><C-N><C-w>h]],
['<A-j>'] = [[<C-\><C-N><C-w>j]],
['<A-k>'] = [[<C-\><C-N><C-w>k]],
['<A-l>'] = [[<C-\><C-N><C-w>l]],
},
}

35
options.lua Normal file
View File

@@ -0,0 +1,35 @@
return {
opt = {
-- laststatus = 2,
background = "dark",
clipboard = "",
cmdheight = 1,
expandtab = true,
foldenable = true,
foldlevelstart = 100,
foldmethod = "syntax",
foldnestmax = 150,
grepprg = "rg --vimgrep",
guifont = "VictorMono Nerd Font, Hack Nerd Font Mono:h10",
listchars = { tab = '> ', extends = '>', precedes = '<', space = '·' },
number = true,
relativenumber = false,
scrolloff = 0,
shiftwidth = 4,
signcolumn = "auto",
spell = false,
tabstop = 4,
textwidth = 80,
wrap = true,
},
g = {
autoformat_enabled = false,
autopairs_enabled = true,
cmp_enabled = true,
diagnostics_enabled = true,
icons_enabled = true,
inlay_hints_enabled = true,
mapleader = " ",
status_diagnostics_enabled = true,
},
}

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,
}
}

33
polish.lua Normal file
View File

@@ -0,0 +1,33 @@
return function()
--[[
local function treesitter_is_parser_installed(filetype)
if not filetype then return false end
local ok, parsers = pcall(require, "nvim-treesitter.parsers")
if not ok then return false end
local name = parsers.filetype_to_parsername[filetype]
return name and #vim.api.nvim_get_runtime_file("parser/" .. name .. ".so", false) > 0
end
-- Set foldmethod to treesitter only on BufEnter if we do have a parser and we're not in diffmode
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}),
callback = function()
if vim.wo.diff then return end
if treesitter_is_parser_installed(vim.bo.filetype) then
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
end
end
})
--]]
-- TODO Move to filetype plugin?
vim.api.nvim_create_autocmd("TermOpen", {
group = vim.api.nvim_create_augroup("term", { clear = true }),
callback = function()
vim.wo.number = false
vim.wo.spell = false
end
})
end

14
snippets/package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "user snippets",
"engines": {
"vscode": "^1.11.0"
},
"contributes": {
"snippets": [
{
"language": "rust",
"path": "./rust.json"
}
]
}
}

43
snippets/rust.json Normal file
View File

@@ -0,0 +1,43 @@
{
"New Yew function component": {
"prefix": "yewfc",
"body": [
"#[derive(PartialEq, Properties)]",
"pub struct ${1:ComponentName}Props {}",
"",
"#[function_component]",
"pub fn $1(props: &${1}Props) -> Html {",
" let ${1}Props {} = props;",
" html! {",
" <${2:div}>$0</${2}>",
" }",
"}"
],
"description": "Create a minimal Yew function component"
},
"New Yew struct component": {
"prefix": "yewsc",
"body": [
"pub struct ${1:ComponentName};",
"",
"pub enum ${1}Msg {",
"}",
"",
"impl Component for ${1} {",
" type Message = ${1}Msg;",
" type Properties = ();",
"",
" fn create(ctx: &Context<Self>) -> Self {",
" Self",
" }",
"",
" fn view(&self, ctx: &Context<Self>) -> Html {",
" html! {",
" $0",
" }",
" }",
"}"
],
"description": "Create a new Yew component with a message enum"
}
}

12
updater.lua Normal file
View File

@@ -0,0 +1,12 @@
return {
remote = "origin",
channel = "nightly",
version = "latest",
branch = "main",
commit = nil,
pin_plugins = nil,
skip_prompts = false,
show_changelog = true,
auto_reload = false,
auto_quit = false,
}