style: apply formatting

This commit is contained in:
2026-04-13 23:24:31 +02:00
parent 959cec7051
commit 5468a5a628
17 changed files with 115 additions and 107 deletions
+3 -3
View File
@@ -21,9 +21,9 @@ return {
"clang-tidy",
"--quiet",
"--checks=-*,"
.. "clang-analyzer-*,"
.. "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,"
.. "-clang-analyzer-security.insecureAPI.strcpy",
.. "clang-analyzer-*,"
.. "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,"
.. "-clang-analyzer-security.insecureAPI.strcpy",
"%file%",
},
events = { "BufWritePost" },
+1 -2
View File
@@ -1,3 +1,2 @@
---@type vim.lsp.Config
return {
}
return {}
+1 -3
View File
@@ -1,4 +1,2 @@
---@type vim.lsp.Config
return {
}
return {}
+1 -3
View File
@@ -1,4 +1,2 @@
---@type vim.lsp.Config
return {
}
return {}
+1 -2
View File
@@ -1,3 +1,2 @@
---@type vim.lsp.Config
return {
}
return {}
+6 -6
View File
@@ -96,7 +96,7 @@ require("pack").setup({
{
"https://github.com/tree-sitter/tree-sitter-php",
ts_parser = {
{ lang = "php", location = "php" },
{ lang = "php", location = "php" },
{ lang = "php_only", location = "php_only" },
},
},
@@ -125,7 +125,7 @@ require("pack").setup({
"https://github.com/tree-sitter/tree-sitter-typescript",
ts_parser = {
{ lang = "typescript", location = "typescript" },
{ lang = "tsx", location = "tsx" },
{ lang = "tsx", location = "tsx" },
},
},
{
@@ -157,9 +157,9 @@ ts.setup({
"gotmpl",
"html",
"json",
"lua", -- builtin
"lua", -- builtin
"luadoc",
"markdown", -- builtin
"markdown", -- builtin
"markdown_inline", -- builtin
"php",
"python",
@@ -170,10 +170,10 @@ ts.setup({
"svelte",
"tsx",
"typescript",
"vim", -- builtin
"vim", -- builtin
"vimdoc", -- builtin
"xml",
"yaml",
"zsh",
}
},
})
+30 -30
View File
@@ -70,27 +70,27 @@ vim.api.nvim_create_autocmd("FileType", {
pattern = { "c" },
callback = function()
vim.o.errorformat = "%-Gmake: *** [Makefile:,"
.. "%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,"
.. "%-Gg%\\?make: *** [%f:%l:%m,"
.. "%-G%f:%l: (Each undeclared identifier is reported only once,"
.. "%-G%f:%l: for each function it appears in.),"
.. "%-GIn file included from %f:%l:%c:,"
.. "%-GIn file included from %f:%l:%c\\,,"
.. "%-GIn file included from %f:%l:%c,"
.. "%-GIn file included from %f:%l,"
.. "%-G%*[ ]from %f:%l:%c,"
.. "%-G%*[ ]from %f:%l:,"
.. "%-G%*[ ]from %f:%l\\,,"
.. "%-G%*[ ]from %f:%l,"
.. "%-G%f:%l:%c: note: '%*[^']' declared here,"
.. "%D%*\\a[%*\\d]: Entering directory %*[`']%f',"
.. "%X%*\\a[%*\\d]: Leaving directory %*[`']%f',"
.. "%D%*\\a: Entering directory %*[`']%f',"
.. "%X%*\\a: Leaving directory %*[`']%f',"
.. "%DMaking %*\\a in %f,"
.. "%f:%l:%c: %t%*[^:]: %m,"
.. "%*[^:]: %f:%l: %m,"
.. "%-G%.%#"
.. "%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,"
.. "%-Gg%\\?make: *** [%f:%l:%m,"
.. "%-G%f:%l: (Each undeclared identifier is reported only once,"
.. "%-G%f:%l: for each function it appears in.),"
.. "%-GIn file included from %f:%l:%c:,"
.. "%-GIn file included from %f:%l:%c\\,,"
.. "%-GIn file included from %f:%l:%c,"
.. "%-GIn file included from %f:%l,"
.. "%-G%*[ ]from %f:%l:%c,"
.. "%-G%*[ ]from %f:%l:,"
.. "%-G%*[ ]from %f:%l\\,,"
.. "%-G%*[ ]from %f:%l,"
.. "%-G%f:%l:%c: note: '%*[^']' declared here,"
.. "%D%*\\a[%*\\d]: Entering directory %*[`']%f',"
.. "%X%*\\a[%*\\d]: Leaving directory %*[`']%f',"
.. "%D%*\\a: Entering directory %*[`']%f',"
.. "%X%*\\a: Leaving directory %*[`']%f',"
.. "%DMaking %*\\a in %f,"
.. "%f:%l:%c: %t%*[^:]: %m,"
.. "%*[^:]: %f:%l: %m,"
.. "%-G%.%#"
end,
})
@@ -105,15 +105,15 @@ vim.api.nvim_create_autocmd("FileType", {
pattern = { "rust" },
callback = function()
vim.bo.errorformat = "%Enote: test %m at %f:%l:%c,"
.. "%E%\\%%(%.%#panicked%\\)%\\@=%m at %f:%l:%c:,"
.. "%-Gerror: test failed\\, %.%#,"
.. "%-G%*[^:]: %.%# generated %*\\d %.%#,"
.. "%-Gnote: run with `RUST_BACKTRACE=%.%#,"
.. "%-G%\\s%#Running%.%#,"
.. vim.bo.errorformat:gsub(
"%%E left:%%m,%%C right:%%m %%f:%%l:%%c,",
""
)
.. "%E%\\%%(%.%#panicked%\\)%\\@=%m at %f:%l:%c:,"
.. "%-Gerror: test failed\\, %.%#,"
.. "%-G%*[^:]: %.%# generated %*\\d %.%#,"
.. "%-Gnote: run with `RUST_BACKTRACE=%.%#,"
.. "%-G%\\s%#Running%.%#,"
.. vim.bo.errorformat:gsub(
"%%E left:%%m,%%C right:%%m %%f:%%l:%%c,",
""
)
end,
})
+18 -6
View File
@@ -246,10 +246,17 @@ function Linter.validate(config)
vim.validate("config", config, "table")
vim.validate("cmd", config.cmd, list_of("string"), "list of strings")
vim.validate(
"events", config.events, list_of("string"), true, "list of strings"
"events",
config.events,
list_of("string"),
true,
"list of strings"
)
vim.validate(
"clear_events", config.clear_events, list_of("string"), true,
"clear_events",
config.clear_events,
list_of("string"),
true,
"list of strings"
)
vim.validate("stdin", config.stdin, "boolean", true)
@@ -257,12 +264,15 @@ function Linter.validate(config)
vim.validate("stderr", config.stderr, "boolean", true)
vim.validate("pattern", config.pattern, "string", true)
vim.validate(
"groups", config.groups, list_of("string"), true, "list of strings"
"groups",
config.groups,
list_of("string"),
true,
"list of strings"
)
vim.validate("severity_map", config.severity_map, function(t)
return util.is_map(t, "string", "number")
end, true, "map of string to number"
)
end, true, "map of string to number")
vim.validate("debounce", config.debounce, "number", true)
vim.validate("source", config.source, "string", true)
vim.validate("json", config.json, "table", true)
@@ -430,7 +440,9 @@ function Linter.add(bufnr, config)
end, config.debounce)
vim.api.nvim_create_autocmd(config.events, {
buffer = linter.bufnr,
callback = function() debouncer:call() end,
callback = function()
debouncer:call()
end,
group = linter.augroup,
})
+2 -2
View File
@@ -21,7 +21,7 @@ require("blink.cmp").setup({
align_to = "simple_label",
columns = {
{ "simple_label" },
{ "kind_icon", "label_description", gap = 1 },
{ "kind_icon", "label_description", gap = 1 },
},
components = {
simple_label = {
@@ -35,7 +35,7 @@ require("blink.cmp").setup({
0,
#ctx.label,
group = ctx.deprecated
and "BlinkCmpLabelDeprecated"
and "BlinkCmpLabelDeprecated"
or "BlinkCmpLabel",
},
}
+2 -12
View File
@@ -4,12 +4,7 @@ require("gitsigns").setup({
},
on_attach = function(bufnr)
local gs = require("gitsigns")
vim.keymap.set(
"n",
"<leader>gv",
gs.select_hunk,
{ buffer = bufnr }
)
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
vim.keymap.set("x", "<leader>gs", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
@@ -21,12 +16,7 @@ require("gitsigns").setup({
":Gitsigns reset_hunk<CR>",
{ buffer = bufnr }
)
vim.keymap.set(
"n",
"<leader>g?",
gs.preview_hunk,
{ buffer = bufnr }
)
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gb", function()
gs.blame_line({ full = true, ignore_whitespace = true })
end, { buffer = bufnr })
+1 -2
View File
@@ -1,5 +1,5 @@
local log = require("log")
local dap = require("dap")
local log = require("log")
vim.api.nvim_set_hl(0, "DebugPC", {
bg = "NONE",
@@ -149,4 +149,3 @@ vim.keymap.set("n", "<F3>", dap.step_over)
vim.keymap.set("n", "<F4>", dap.step_out)
vim.keymap.set("n", "<F5>", dap.continue)
vim.keymap.set("n", "<F9>", dap.terminate)
+1 -1
View File
@@ -35,7 +35,7 @@ local function disable_highlights()
end
vim.keymap.set("n", "<leader>tt", function()
require("nvim-tree.api").tree.toggle({ find_file = true, focus = false, })
require("nvim-tree.api").tree.toggle({ find_file = true, focus = false })
end)
---@class nvim_tree.api.decorator.UserDecorator
+2 -3
View File
@@ -30,7 +30,7 @@ local languages = {
local ts = require("nvim-treesitter")
ts.setup({
install_dir = string.format("%s/nvim-treesitter", vim.fn.stdpath("data"))
install_dir = string.format("%s/nvim-treesitter", vim.fn.stdpath("data")),
})
ts.install(languages):await(function(err)
if err then
@@ -62,6 +62,5 @@ ts.install(languages):await(function(err)
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
end,
})
end
)
end)
end)
+3 -1
View File
@@ -30,4 +30,6 @@ require("oil").setup({
},
})
vim.keymap.set("n", "<leader>fe", function() vim.cmd.Oil("--float") end)
vim.keymap.set("n", "<leader>fe", function()
vim.cmd.Oil("--float")
end)
+2 -2
View File
@@ -1,6 +1,6 @@
local telescope = require("telescope")
local builtin = require("telescope.builtin")
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")
local telescope = require("telescope")
local utils = require("telescope.utils")
telescope.setup({
+15 -5
View File
@@ -42,12 +42,22 @@ end, { nargs = "*", desc = "Pretty git log via fugitive" })
vim.keymap.set("n", "<leader>gl", vim.cmd.Glog)
vim.keymap.set("n", "<leader>gd", vim.cmd.Gvdiffsplit)
vim.keymap.set("n", "<leader>gD", function() vim.cmd.Gvdiffsplit("HEAD") end)
vim.keymap.set("n", "<leader>gD", function()
vim.cmd.Gvdiffsplit("HEAD")
end)
vim.keymap.set("n", "<leader>gh", vim.cmd.Ghdiffsplit)
vim.keymap.set("n", "<leader>gH", function() vim.cmd.Ghdiffsplit("HEAD") end)
vim.keymap.set("n", "<leader>gc", function() vim.cmd.G("commit") end)
vim.keymap.set("n", "<leader>ga", function() vim.cmd.G("commit --amend") end)
vim.keymap.set("n", "<leader>gp", function() vim.cmd.G("push") end)
vim.keymap.set("n", "<leader>gH", function()
vim.cmd.Ghdiffsplit("HEAD")
end)
vim.keymap.set("n", "<leader>gc", function()
vim.cmd.G("commit")
end)
vim.keymap.set("n", "<leader>ga", function()
vim.cmd.G("commit --amend")
end)
vim.keymap.set("n", "<leader>gp", function()
vim.cmd.G("push")
end)
vim.keymap.set("n", "<leader>gg", toggle_git_status)
vim.api.nvim_create_autocmd("User", {
+26 -24
View File
@@ -21,11 +21,7 @@ end
local function start_treesitter(buf)
local ok, err = pcall(vim.treesitter.start, buf)
if not ok then
log.error(
"Failed to enable treesitter for buffer %d: %s",
buf,
err
)
log.error("Failed to enable treesitter for buffer %d: %s", buf, err)
return
end
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
@@ -38,7 +34,8 @@ end
local function activate_open_buffers(lang)
local fts = vim.treesitter.language.get_filetypes(lang)
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(buf)
if
vim.api.nvim_buf_is_loaded(buf)
and vim.list_contains(fts, vim.bo[buf].filetype)
then
start_treesitter(buf)
@@ -49,8 +46,7 @@ end
---@param plugin ow.Pack.Plugin
---@param spec ow.TS.ParserSpec
function M.build(plugin, spec)
local cwd = spec.location
and vim.fs.joinpath(plugin.path, spec.location)
local cwd = spec.location and vim.fs.joinpath(plugin.path, spec.location)
or plugin.path
local out = parser_path(plugin, spec.lang)
vim.fn.mkdir(vim.fs.dirname(out), "p")
@@ -78,26 +74,32 @@ function M.build(plugin, spec)
if spec.generate then
local cmd = {
"tree-sitter", "generate",
"--abi", tostring(vim.treesitter.language_version),
"tree-sitter",
"generate",
"--abi",
tostring(vim.treesitter.language_version),
}
if spec.from_json ~= false then
table.insert(cmd, "src/grammar.json")
end
vim.system(cmd, {
cwd = cwd,
env = { TREE_SITTER_JS_RUNTIME = "native" },
}, vim.schedule_wrap(function(r)
if r.code ~= 0 then
log.error(
"Failed to generate parser for %s: %s",
spec.lang,
r.stderr or ""
)
return
end
do_build()
end))
vim.system(
cmd,
{
cwd = cwd,
env = { TREE_SITTER_JS_RUNTIME = "native" },
},
vim.schedule_wrap(function(r)
if r.code ~= 0 then
log.error(
"Failed to generate parser for %s: %s",
spec.lang,
r.stderr or ""
)
return
end
do_build()
end)
)
else
do_build()
end