Add diffview plugin, add more config options to git for diff and merge tool

This commit is contained in:
Evie Litherland-Smith 2023-02-20 10:34:43 +00:00
parent 052a8a4dd4
commit 638d1e18f1
6 changed files with 47 additions and 16 deletions

View file

@ -8,3 +8,17 @@
rebase = false
[color]
ui = true
[diff]
tool = nvimdiff
algorithm = minimal
[difftool]
prompt = no
trustExitCode = yes
[alias]
dt = difftool
mt = mergetool
[merge]
tool = nvimdiff2
[mergetool]
keepBackup = yes
prompt = no

View file

@ -23,4 +23,4 @@ theme:
- red # Red
promptToReturnFromSubprocess: false
# to exit immediately if run outside of the Git repository
notARepository: 'quit'
notARepository: "quit"

View file

@ -1,26 +1,26 @@
-- bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
}
end
vim.opt.rtp:prepend(lazypath)
local plugins = require("plugins")
local opts = require("config.lazy")
local plugins = require "plugins"
local opts = require "config.lazy"
require("lazy").setup(plugins, opts)
-- Set vim options
require("options")
require "options"
-- Define custom keymappings
require("keymaps")
require "keymaps"
-- Remaining vim commands to be converted to lua
require("vimcommands")
require "vimcommands"

View file

@ -0,0 +1,6 @@
require("diffview").setup {
enhanced_diff_hl = true,
file_panel = {
listing_style = "list",
},
}

View file

@ -23,6 +23,12 @@ vim.keymap.set("n", "<leader>g", "<cmd>Neotree git_status<cr>")
vim.keymap.set("n", "<leader>b", "<cmd>Neotree buffers<cr>")
vim.keymap.set("n", "<leader>\\", "<cmd>Neotree reveal<cr>")
-- diffview
vim.keymap.set("n", "<leader>do", "<cmd>DiffviewOpen<cr>")
vim.keymap.set("n", "<leader>dc", "<cmd>DiffviewOpen<cr>")
vim.keymap.set("n", "<leader>dh", "<cmd>DiffviewFileHistory<cr>")
vim.keymap.set("n", "<leader>df", "<cmd>DiffviewFileHistory %<cr>")
-- Trouble
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>")
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>")

View file

@ -100,5 +100,10 @@ local M = {
name = "Comment",
config = function() require "Comment" end,
},
{
"sindrets/diffview.nvim",
dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
config = function() require "config.diffview" end,
},
}
return M