style: apply formatting
This commit is contained in:
@@ -1,3 +1,2 @@
|
|||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
return {
|
return {}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
return {
|
return {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
return {
|
return {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,3 +1,2 @@
|
|||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
return {
|
return {}
|
||||||
}
|
|
||||||
|
|||||||
@@ -175,5 +175,5 @@ ts.setup({
|
|||||||
"xml",
|
"xml",
|
||||||
"yaml",
|
"yaml",
|
||||||
"zsh",
|
"zsh",
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
+18
-6
@@ -246,10 +246,17 @@ function Linter.validate(config)
|
|||||||
vim.validate("config", config, "table")
|
vim.validate("config", config, "table")
|
||||||
vim.validate("cmd", config.cmd, list_of("string"), "list of strings")
|
vim.validate("cmd", config.cmd, list_of("string"), "list of strings")
|
||||||
vim.validate(
|
vim.validate(
|
||||||
"events", config.events, list_of("string"), true, "list of strings"
|
"events",
|
||||||
|
config.events,
|
||||||
|
list_of("string"),
|
||||||
|
true,
|
||||||
|
"list of strings"
|
||||||
)
|
)
|
||||||
vim.validate(
|
vim.validate(
|
||||||
"clear_events", config.clear_events, list_of("string"), true,
|
"clear_events",
|
||||||
|
config.clear_events,
|
||||||
|
list_of("string"),
|
||||||
|
true,
|
||||||
"list of strings"
|
"list of strings"
|
||||||
)
|
)
|
||||||
vim.validate("stdin", config.stdin, "boolean", true)
|
vim.validate("stdin", config.stdin, "boolean", true)
|
||||||
@@ -257,12 +264,15 @@ function Linter.validate(config)
|
|||||||
vim.validate("stderr", config.stderr, "boolean", true)
|
vim.validate("stderr", config.stderr, "boolean", true)
|
||||||
vim.validate("pattern", config.pattern, "string", true)
|
vim.validate("pattern", config.pattern, "string", true)
|
||||||
vim.validate(
|
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)
|
vim.validate("severity_map", config.severity_map, function(t)
|
||||||
return util.is_map(t, "string", "number")
|
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("debounce", config.debounce, "number", true)
|
||||||
vim.validate("source", config.source, "string", true)
|
vim.validate("source", config.source, "string", true)
|
||||||
vim.validate("json", config.json, "table", true)
|
vim.validate("json", config.json, "table", true)
|
||||||
@@ -430,7 +440,9 @@ function Linter.add(bufnr, config)
|
|||||||
end, config.debounce)
|
end, config.debounce)
|
||||||
vim.api.nvim_create_autocmd(config.events, {
|
vim.api.nvim_create_autocmd(config.events, {
|
||||||
buffer = linter.bufnr,
|
buffer = linter.bufnr,
|
||||||
callback = function() debouncer:call() end,
|
callback = function()
|
||||||
|
debouncer:call()
|
||||||
|
end,
|
||||||
group = linter.augroup,
|
group = linter.augroup,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,7 @@ require("gitsigns").setup({
|
|||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local gs = require("gitsigns")
|
local gs = require("gitsigns")
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr })
|
||||||
"n",
|
|
||||||
"<leader>gv",
|
|
||||||
gs.select_hunk,
|
|
||||||
{ buffer = bufnr }
|
|
||||||
)
|
|
||||||
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
|
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
|
||||||
vim.keymap.set("x", "<leader>gs", function()
|
vim.keymap.set("x", "<leader>gs", function()
|
||||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
@@ -21,12 +16,7 @@ require("gitsigns").setup({
|
|||||||
":Gitsigns reset_hunk<CR>",
|
":Gitsigns reset_hunk<CR>",
|
||||||
{ buffer = bufnr }
|
{ buffer = bufnr }
|
||||||
)
|
)
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr })
|
||||||
"n",
|
|
||||||
"<leader>g?",
|
|
||||||
gs.preview_hunk,
|
|
||||||
{ buffer = bufnr }
|
|
||||||
)
|
|
||||||
vim.keymap.set("n", "<leader>gb", function()
|
vim.keymap.set("n", "<leader>gb", function()
|
||||||
gs.blame_line({ full = true, ignore_whitespace = true })
|
gs.blame_line({ full = true, ignore_whitespace = true })
|
||||||
end, { buffer = bufnr })
|
end, { buffer = bufnr })
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local log = require("log")
|
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
local log = require("log")
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "DebugPC", {
|
vim.api.nvim_set_hl(0, "DebugPC", {
|
||||||
bg = "NONE",
|
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", "<F4>", dap.step_out)
|
||||||
vim.keymap.set("n", "<F5>", dap.continue)
|
vim.keymap.set("n", "<F5>", dap.continue)
|
||||||
vim.keymap.set("n", "<F9>", dap.terminate)
|
vim.keymap.set("n", "<F9>", dap.terminate)
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ local function disable_highlights()
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>tt", function()
|
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)
|
end)
|
||||||
|
|
||||||
---@class nvim_tree.api.decorator.UserDecorator
|
---@class nvim_tree.api.decorator.UserDecorator
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ local languages = {
|
|||||||
|
|
||||||
local ts = require("nvim-treesitter")
|
local ts = require("nvim-treesitter")
|
||||||
ts.setup({
|
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)
|
ts.install(languages):await(function(err)
|
||||||
if err then
|
if err then
|
||||||
@@ -62,6 +62,5 @@ ts.install(languages):await(function(err)
|
|||||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
+3
-1
@@ -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)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local telescope = require("telescope")
|
|
||||||
local builtin = require("telescope.builtin")
|
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
local telescope = require("telescope")
|
||||||
local utils = require("telescope.utils")
|
local utils = require("telescope.utils")
|
||||||
|
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
|
|||||||
@@ -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>gl", vim.cmd.Glog)
|
||||||
vim.keymap.set("n", "<leader>gd", vim.cmd.Gvdiffsplit)
|
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", vim.cmd.Ghdiffsplit)
|
||||||
vim.keymap.set("n", "<leader>gH", function() vim.cmd.Ghdiffsplit("HEAD") end)
|
vim.keymap.set("n", "<leader>gH", function()
|
||||||
vim.keymap.set("n", "<leader>gc", function() vim.cmd.G("commit") end)
|
vim.cmd.Ghdiffsplit("HEAD")
|
||||||
vim.keymap.set("n", "<leader>ga", function() vim.cmd.G("commit --amend") end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>gp", function() vim.cmd.G("push") 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.keymap.set("n", "<leader>gg", toggle_git_status)
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
|||||||
+15
-13
@@ -21,11 +21,7 @@ end
|
|||||||
local function start_treesitter(buf)
|
local function start_treesitter(buf)
|
||||||
local ok, err = pcall(vim.treesitter.start, buf)
|
local ok, err = pcall(vim.treesitter.start, buf)
|
||||||
if not ok then
|
if not ok then
|
||||||
log.error(
|
log.error("Failed to enable treesitter for buffer %d: %s", buf, err)
|
||||||
"Failed to enable treesitter for buffer %d: %s",
|
|
||||||
buf,
|
|
||||||
err
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
|
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
|
||||||
@@ -38,7 +34,8 @@ end
|
|||||||
local function activate_open_buffers(lang)
|
local function activate_open_buffers(lang)
|
||||||
local fts = vim.treesitter.language.get_filetypes(lang)
|
local fts = vim.treesitter.language.get_filetypes(lang)
|
||||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
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)
|
and vim.list_contains(fts, vim.bo[buf].filetype)
|
||||||
then
|
then
|
||||||
start_treesitter(buf)
|
start_treesitter(buf)
|
||||||
@@ -49,8 +46,7 @@ end
|
|||||||
---@param plugin ow.Pack.Plugin
|
---@param plugin ow.Pack.Plugin
|
||||||
---@param spec ow.TS.ParserSpec
|
---@param spec ow.TS.ParserSpec
|
||||||
function M.build(plugin, spec)
|
function M.build(plugin, spec)
|
||||||
local cwd = spec.location
|
local cwd = spec.location and vim.fs.joinpath(plugin.path, spec.location)
|
||||||
and vim.fs.joinpath(plugin.path, spec.location)
|
|
||||||
or plugin.path
|
or plugin.path
|
||||||
local out = parser_path(plugin, spec.lang)
|
local out = parser_path(plugin, spec.lang)
|
||||||
vim.fn.mkdir(vim.fs.dirname(out), "p")
|
vim.fn.mkdir(vim.fs.dirname(out), "p")
|
||||||
@@ -78,16 +74,21 @@ function M.build(plugin, spec)
|
|||||||
|
|
||||||
if spec.generate then
|
if spec.generate then
|
||||||
local cmd = {
|
local cmd = {
|
||||||
"tree-sitter", "generate",
|
"tree-sitter",
|
||||||
"--abi", tostring(vim.treesitter.language_version),
|
"generate",
|
||||||
|
"--abi",
|
||||||
|
tostring(vim.treesitter.language_version),
|
||||||
}
|
}
|
||||||
if spec.from_json ~= false then
|
if spec.from_json ~= false then
|
||||||
table.insert(cmd, "src/grammar.json")
|
table.insert(cmd, "src/grammar.json")
|
||||||
end
|
end
|
||||||
vim.system(cmd, {
|
vim.system(
|
||||||
|
cmd,
|
||||||
|
{
|
||||||
cwd = cwd,
|
cwd = cwd,
|
||||||
env = { TREE_SITTER_JS_RUNTIME = "native" },
|
env = { TREE_SITTER_JS_RUNTIME = "native" },
|
||||||
}, vim.schedule_wrap(function(r)
|
},
|
||||||
|
vim.schedule_wrap(function(r)
|
||||||
if r.code ~= 0 then
|
if r.code ~= 0 then
|
||||||
log.error(
|
log.error(
|
||||||
"Failed to generate parser for %s: %s",
|
"Failed to generate parser for %s: %s",
|
||||||
@@ -97,7 +98,8 @@ function M.build(plugin, spec)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
do_build()
|
do_build()
|
||||||
end))
|
end)
|
||||||
|
)
|
||||||
else
|
else
|
||||||
do_build()
|
do_build()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user