1
0
Fork 0

nvim config updates

This commit is contained in:
Arthur K. 2026-01-30 15:47:24 +03:00
parent 559939e2f4
commit adc494721a
Signed by: wzray
GPG key ID: B97F30FDC4636357
20 changed files with 1108 additions and 30 deletions

View file

@ -0,0 +1,67 @@
return {
'sindrets/diffview.nvim',
config = function()
vim.keymap.set('n', '<leader>dv', ':DiffviewOpen<CR>', { silent = true })
vim.api.nvim_create_autocmd("User", {
pattern = "DiffviewViewEnter",
callback = function()
vim.keymap.del('n', 'Ā')
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(buf)
and vim.api.nvim_buf_get_name(buf) == ""
and vim.bo[buf].buftype == "" then
vim.api.nvim_buf_delete(buf, { force = true })
end
end
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "DiffviewViewLeave",
callback = function()
vim.keymap.set('n', 'Ā', ':NvimTreeToggle<CR>', { silent = true })
end,
})
local actions = require("diffview.actions")
require('diffview').setup({
view = {
merge_tool = {
disable_diagnostics = false
},
},
keymaps = {
view = {
-- The `view` bindings are active in the diff buffers, only when the current
-- tabpage is a Diffview.
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
{ "n", "Ā", actions.toggle_files, { desc = "Toggle the file panel." } },
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle through available layouts." } },
{ "n", "<M-p>", actions.prev_conflict, { desc = "In the merge-tool: jump to the previous conflict" } },
{ "n", "<M-n>", actions.next_conflict, { desc = "In the merge-tool: jump to the next conflict" } },
{ "n", "gh", actions.conflict_choose("ours"), { desc = "Choose the OURS version of a conflict" } },
{ "n", "gl", actions.conflict_choose("theirs"), { desc = "Choose the THEIRS version of a conflict" } },
{ "n", "gb", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } },
{ "n", "ga", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } },
{ "n", "gx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } },
{ "n", "gH", actions.conflict_choose_all("ours"), { desc = "Choose the OURS version of a conflict for the whole file" } },
{ "n", "gL", actions.conflict_choose_all("theirs"), { desc = "Choose the THEIRS version of a conflict for the whole file" } },
{ "n", "gB", actions.conflict_choose_all("base"), { desc = "Choose the BASE version of a conflict for the whole file" } },
{ "n", "gA", actions.conflict_choose_all("all"), { desc = "Choose all the versions of a conflict for the whole file" } },
{ "n", "gX", actions.conflict_choose_all("none"), { desc = "Delete the conflict region for the whole file" } },
},
file_panel = {
{ "n", "Ā", actions.toggle_files, { desc = "Toggle the file panel" } },
}
}
})
end
}