Compare commits
2 Commits
62945314e2
...
a7ac4e76ea
Author | SHA1 | Date | |
---|---|---|---|
a7ac4e76ea
|
|||
b20f5d07a6
|
85
lua/conf/plugins/gitsigns.lua
Normal file
85
lua/conf/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
local map = core.misc.map
|
||||
|
||||
return { "lewis6991/gitsigns.nvim",
|
||||
lazy = function(load)
|
||||
load:auto({ "BufEnter", "BufNew" }, {
|
||||
callback = function()
|
||||
local paths = vim.fs.find({ ".git", }, { upward = true })
|
||||
if #paths > 0 then
|
||||
load:cleanup()
|
||||
end
|
||||
end
|
||||
})
|
||||
load:cmd("Gitsigns")
|
||||
end,
|
||||
load = function()
|
||||
local gs = require("gitsigns")
|
||||
|
||||
gs.setup {
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "-" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "┆" }
|
||||
},
|
||||
|
||||
signcolumn = true,
|
||||
numhl = false,
|
||||
linehl = false,
|
||||
word_diff = false,
|
||||
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
|
||||
attach_to_untracked = true,
|
||||
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||
|
||||
preview_config = { border = vim.g.border_style },
|
||||
|
||||
on_attach = function(bufnr)
|
||||
local opts = { buffer = bufnr }
|
||||
|
||||
-- Navigation
|
||||
map("n", "]c", function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
end, { expr = true, buffer = bufnr })
|
||||
|
||||
map("n", "[c", function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
end, { expr = true, buffer = bufnr })
|
||||
|
||||
-- Actions
|
||||
map("n", "<leader>hs", gs.stage_hunk, opts)
|
||||
map("n", "<leader>hr", gs.reset_hunk, opts)
|
||||
map("v", "<leader>hs", function()
|
||||
gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") }
|
||||
end, opts)
|
||||
map("v", "<leader>hr", function()
|
||||
gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") }
|
||||
end, opts)
|
||||
map("n", "<leader>hS", gs.stage_buffer, opts)
|
||||
map("n", "<leader>hu", gs.undo_stage_hunk, opts)
|
||||
map("n", "<leader>hR", gs.reset_buffer, opts)
|
||||
map("n", "<leader>hp", gs.preview_hunk, opts)
|
||||
map("n", "<leader>hb", function() gs.blame_line { full = true } end, opts)
|
||||
map("n", "<leader>tb", gs.toggle_current_line_blame, opts)
|
||||
map("n", "<leader>hd", gs.diffthis, opts)
|
||||
map("n", "<leader>hD", function() gs.diffthis("~") end, opts)
|
||||
map("n", "<leader>td", gs.toggle_deleted, opts)
|
||||
|
||||
-- Text object
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", opts)
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
@@ -1,8 +1,29 @@
|
||||
local nonels_augroup = core.misc.augroup("nullls formatting")
|
||||
|
||||
return {
|
||||
{ "neovim/nvim-lspconfig",
|
||||
reqs = {
|
||||
"mason-org/mason.nvim",
|
||||
"mason-org/mason-lspconfig.nvim"
|
||||
},
|
||||
load = function()
|
||||
core.lsp.setup()
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_added = {
|
||||
"clangd",
|
||||
"mesonlsp",
|
||||
"bashls",
|
||||
"jdtls",
|
||||
"lua_ls",
|
||||
"basedpyright",
|
||||
"black",
|
||||
"debugpy"
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
{ "mason-org/mason.nvim",
|
||||
reqs = "neovim/nvim-lspconfig",
|
||||
load = function()
|
||||
require("mason").setup {
|
||||
ui = {
|
||||
@@ -14,8 +35,6 @@ return {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.mason.ensure_installed()
|
||||
end
|
||||
},
|
||||
|
||||
@@ -30,11 +49,11 @@ return {
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
null_ls.builtins.formatting.black
|
||||
null_ls.builtins.formatting.black,
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
if client:supports_method("textDocument/formatting") then
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = nonels_augroup,
|
||||
buffer = bufnr
|
||||
|
10
lua/conf/plugins/opencode.lua
Normal file
10
lua/conf/plugins/opencode.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return { "NickvanDyke/opencode.nvim",
|
||||
load = function()
|
||||
core.misc.map("n", "<leader>oa", function()
|
||||
require("opencode").ask()
|
||||
end, { desc = "Ask opencode" })
|
||||
core.misc.map("v", "<leader>oa", function()
|
||||
require("opencode").ask("@selection: ")
|
||||
end, { desc = "Ask opencode about selection" })
|
||||
end
|
||||
}
|
@@ -48,6 +48,12 @@ return {
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
core.misc.map("n", "<leader><leader>t", function()
|
||||
pcall(vim.cmd.TSInstall, vim.api.nvim_get_option_value("ft", {
|
||||
buf = vim.api.nvim_get_current_buf()
|
||||
}))
|
||||
end)
|
||||
end
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user