10 aug 2026

This commit is contained in:
2026-08-10 13:18:23 +02:00
parent 91773e0a00
commit a775122059
36 changed files with 433 additions and 461 deletions
+236 -250
View File
@@ -3,296 +3,282 @@ local cmp_lsp = require "cmp_nvim_lsp"
local cmp_kinds = require("assets.icons").icons.kinds
local function flatten_to_array(t)
local res = {}
local function _flatten(tbl)
for _, v in ipairs(tbl) do
if type(v) == "table" then
_flatten(v)
else
table.insert(res, v)
end
end
end
_flatten(t)
return res
local res = {}
local function _flatten(tbl)
for _, v in ipairs(tbl) do
if type(v) == "table" then
_flatten(v)
else
table.insert(res, v)
end
end
end
_flatten(t)
return res
end
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities()
)
local capabilities =
vim.tbl_deep_extend("force", {}, vim.lsp.protocol.make_client_capabilities(), cmp_lsp.default_capabilities())
require("fidget").setup {}
require("mason").setup()
require("mason-lspconfig").setup {
automatic_enable = true,
ensure_installed = {
"lua_ls",
"qmlls",
"rust_analyzer",
"gopls",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities,
}
end,
automatic_enable = true,
ensure_installed = {
"lua_ls",
"qmlls",
"rust_analyzer",
"gopls",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities,
}
end,
["tailwindcss"] = function()
local lspconfig = require "lspconfig"
lspconfig.tailwindcss.setup {
capabilities = capabilities,
}
end,
["tailwindcss"] = function()
local lspconfig = require "lspconfig"
lspconfig.tailwindcss.setup {
capabilities = capabilities,
}
end,
["css-lsp"] = function()
local lspconfig = require "lspconfig"
lspconfig.cssls.setup {
capabilities = capabilities,
}
end,
["css-lsp"] = function()
local lspconfig = require "lspconfig"
lspconfig.cssls.setup {
capabilities = capabilities,
}
end,
zls = function()
local lspconfig = require "lspconfig"
lspconfig.zls.setup {
capabilities = capabilities,
root_dir = lspconfig.util.root_pattern(
".git",
"build.zig",
"zls.json"
),
settings = {
zls = {
enable_inlay_hints = true,
enable_snippets = true,
warn_style = true,
},
},
}
vim.g.zig_fmt_parse_errors = 0
vim.g.zig_fmt_autosave = 0
end,
["lua_ls"] = function()
local lspconfig = require "lspconfig"
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "Lua 5.1" },
diagnostics = {
globals = {
"bit",
"vim",
"it",
"describe",
"before_each",
"after_each",
},
},
},
},
}
end,
},
zls = function()
local lspconfig = require "lspconfig"
lspconfig.zls.setup {
capabilities = capabilities,
root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"),
settings = {
zls = {
enable_inlay_hints = true,
enable_snippets = true,
warn_style = true,
},
},
}
vim.g.zig_fmt_parse_errors = 0
vim.g.zig_fmt_autosave = 0
end,
["lua_ls"] = function()
local lspconfig = require "lspconfig"
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "Lua 5.1" },
diagnostics = {
globals = {
"bit",
"vim",
"it",
"describe",
"before_each",
"after_each",
},
},
},
},
}
end,
},
}
cmp.setup {
preselect = "None",
formatting = {
fields = { "kind", "abbr" },
format = function(entry, vim_item)
vim_item.kind = cmp_kinds[vim_item.kind] or ""
if entry.completion_item.detail then
vim_item.menu = entry.completion_item.detail
end
return vim_item
end,
},
completion = { completeopt = "menu,menuone" },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
preselect = "None",
formatting = {
fields = { "kind", "abbr" },
format = function(entry, vim_item)
vim_item.kind = cmp_kinds[vim_item.kind] or ""
if entry.completion_item.detail then
vim_item.menu = entry.completion_item.detail
end
return vim_item
end,
},
completion = { completeopt = "menu,menuone" },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
view = {
entries = "custom",
},
view = {
entries = "custom",
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = cmp.config.sources {
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "copilot" },
},
sources = cmp.config.sources {
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "copilot" },
},
}
vim.diagnostic.config {
virtual_text = false,
virtual_lines = false,
signs = true,
underline = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = true,
header = "",
prefix = "",
},
virtual_text = false,
virtual_lines = false,
signs = true,
underline = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = true,
header = "",
prefix = "",
},
}
local lspconfig = vim.lsp.config
lspconfig("texlab", {
cmd = { "texlab" },
filetypes = { "tex", "bib", "plaintex" },
root_markers = {
".git",
".latexmkrc",
"latexmkrc",
".texlabroot",
"texlabroot",
"Tectonic.toml",
},
settings = {
texlab = {
rootDirectory = nil,
build = {
executable = "latexmk",
args = {
"-pdf",
"-interaction=nonstopmode",
"-synctex=1",
"%f",
},
onSave = true,
forwardSearchAfter = true,
},
forwardSearch = {
executable = "zathura",
args = {
"--synctex-editor-command",
[[ nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]]
.. vim.v.servername,
"--synctex-forward",
"%l:1:%f",
"%p",
},
},
chktex = {
onEdit = false,
onOpenAndSave = true,
},
diagnosticsDelay = 300,
latexFormatter = "latexindent",
latexindent = {
["local"] = nil,
modifyLineBreaks = false,
},
bibtexFormatter = "texlab",
formatterLineLength = 80,
},
},
cmd = { "texlab" },
filetypes = { "tex", "bib", "plaintex" },
root_markers = {
".git",
".latexmkrc",
"latexmkrc",
".texlabroot",
"texlabroot",
"Tectonic.toml",
},
settings = {
texlab = {
rootDirectory = nil,
build = {
executable = "latexmk",
args = {
"-pdf",
"-interaction=nonstopmode",
"-synctex=1",
"%f",
},
onSave = true,
forwardSearchAfter = true,
},
forwardSearch = {
executable = "zathura",
args = {
"--synctex-editor-command",
[[ nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername,
"--synctex-forward",
"%l:1:%f",
"%p",
},
},
chktex = {
onEdit = false,
onOpenAndSave = true,
},
diagnosticsDelay = 300,
latexFormatter = "latexindent",
latexindent = {
["local"] = nil,
modifyLineBreaks = false,
},
bibtexFormatter = "texlab",
formatterLineLength = 80,
},
},
})
lspconfig("qmlls", {
cmd = { "qmlls6", "qmlls" },
filetypes = { "qml", "qmljs" },
root_markers = { ".git" },
cmd = { "qmlls6", "qmlls" },
filetypes = { "qml", "qmljs" },
root_markers = { ".git" },
})
lspconfig("jsonls", {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
})
lspconfig("yamlls", {
settings = {
yaml = {
schemaStore = {
enable = false,
url = "",
},
schemas = require("schemastore").yaml.schemas(),
},
},
settings = {
yaml = {
schemaStore = {
enable = false,
url = "",
},
schemas = require("schemastore").yaml.schemas(),
},
},
})
local lspenable = vim.lsp.enable
local servers = {
"html",
"bashls",
"pyright",
"ts_ls",
"texlab",
"sourcekit",
"qmlls",
"tailwindcss",
"systemd-lsp",
require("mason-lspconfig").get_installed_servers(),
"html",
"bashls",
"pyright",
"ts_ls",
"texlab",
"sourcekit",
"qmlls",
"tailwindcss",
"systemd-lsp",
require("mason-lspconfig").get_installed_servers(),
}
local flat_servers = flatten_to_array(servers)
for _, server in ipairs(flat_servers) do
lspconfig(server, {
on_attach = function(client, bufnr)
if client.name == "typos_lsp" or client.name == "copilot" then
return
end
require("workspace-diagnostics").populate_workspace_diagnostics(
client,
bufnr
)
end,
capabilities = capabilities,
})
lspenable(server)
lspconfig(server, {
on_attach = function(client, bufnr)
if client.name == "typos_lsp" or client.name == "copilot" then
return
end
end,
capabilities = capabilities,
})
lspenable(server)
end
+1 -1
View File
@@ -13,7 +13,7 @@ M.plugin = {
vim.g.neoformat_enabled_bash = { "shfmt" }
vim.g.neoformat_enabled_zsh = { "shfmt" }
vim.g.neoformat_enabled_rust = { "rustfmt" }
vim.g.neoformat_enabled_pwsh = { "pwshfmt" }
vim.g.neoformat_enabled_ps1 = { "pwshfmt" }
end,
}
+30
View File
@@ -0,0 +1,30 @@
require("undotree").setup {
float_diff = true,
layout = "left_bottom",
position = "left",
ignore_filetype = { "undotree", "undotreeDiff", "qf", "TelescopePrompt", "spectre_panel", "tsplayground" },
window = {
winblend = 30,
},
keymaps = {
["move_next"] = "j",
["move_prev"] = "k",
["move2parent"] = "gj",
["move_change_next"] = "J",
["move_change_prev"] = "K",
["action_enter"] = "<cr>",
["enter_diffbuf"] = "p",
["quit"] = "q",
},
-- Deprecated
-- keymaps = {
-- ['j'] = "move_next",
-- ['k'] = "move_prev",
-- ['gj'] = "move2parent",
-- ['J'] = "move_change_next",
-- ['K'] = "move_change_prev",
-- ['<cr>'] = "action_enter",
-- ['p'] = "enter_diffbuf",
-- ['q'] = "quit",
-- },
}
+11
View File
@@ -0,0 +1,11 @@
vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_floating_corner_radius = 0.4
vim.o.guifont = "0xProto Nerd Font Mono:h12"
vim.g.neovide_refresh_rate = 144
vim.g.neovide_refresh_rate_idle = 144
vim.g.neovide_no_idle = true
vim.g.neovide_floating_blur_amount_x = 0
vim.g.neovide_floating_blur_amount_y = 0
vim.g.neovide_cursor_animation_length = 0.08
vim.g.neovide_cursor_short_animation_length = 0.04
vim.g.neovide_scroll_animation_length = 0.15
@@ -1,20 +1,23 @@
vim.notify = require('notify')
local icons = require("assets.icons").icons
local dap = require('dap')
require('notify').setup({
-- background_colour = "#000000",
render = "wrapped-default",
animation = "slide",
timeout = 6000,
max_width = 50,
minimum_width = 50,
level = "info",
fps = 60,
icons = {
ERROR = "",
WARN = "",
INFO = "",
ERROR = icons.diagnostics.Error,
WARN = icons.diagnostics.Warn,
INFO = icons.diagnostics.Info,
DEBUG = "",
TRACE = "",
},
},
on_open = function(win)
-- vim.api.nvim_win_set_option(win, 'wrap', true)
vim.api.nvim_win_set_option(win, 'breakat', ' ')
-15
View File
@@ -1,15 +0,0 @@
local i = {}
function M.foldexpr()
local lnum = vim.v.lnum
local line = vim.fn.getline( lnum )
if line:find( "<think>", 1, true ) then
return "a1"
elseif line:find( "</think>", 1, true ) then
return "s1"
else
return "="
end
end
return M
-19
View File
@@ -1,19 +0,0 @@
require('undotree').setup({
float_diff = true,
layout = "left_bottom",
position = "left",
ignore_filetype = { 'undotree', 'undotreeDiff', 'qf', 'TelescopePrompt', 'spectre_panel', 'tsplayground' },
window = {
winblend = 30,
},
keymaps = {
['j'] = "move_next",
['k'] = "move_prev",
['gj'] = "move2parent",
['J'] = "move_change_next",
['K'] = "move_change_prev",
['<cr>'] = "action_enter",
['p'] = "enter_diffbuf",
['q'] = "quit",
},
})