[NeoVim] Add diffview

This commit is contained in:
2022-07-12 14:23:56 +02:00
committed by Pierre Jeanjean
parent 96b1e2ecb1
commit 9677587aeb
2 changed files with 27 additions and 4 deletions

View File

@@ -38,7 +38,8 @@ require('feline').setup {
'^fugitive$',
'^fugitiveblame$',
'^qf$',
'^help$'
'^help$',
'^DiffviewFileHistory'
},
buftypes = {
'^terminal$'
@@ -80,13 +81,16 @@ require('neo-tree').setup({
filtered_items = {
visible = true
},
follow_current_file = true,window = {
follow_current_file = true,
window = {
mappings = {
["/"] = "noop",
["g/"] = "fuzzy_finder",
["f"] = "noop",
["ff"] = function() vim.cmd([[Telescope find_files]]) end,
["fg"] = function() vim.cmd([[Telescope live_grep]]) end
["fg"] = function() vim.cmd([[Telescope live_grep]]) end,
["<S-Right>"] = function() end,
["<S-Left>"] = function() end
}
}
},
@@ -216,6 +220,23 @@ require('telescope').setup({
})
require('diffview').setup({
keymaps = {
view = {
["q"] = "<cmd>tabc<CR>"
},
file_panel = {
["q"] = "<cmd>tabc<CR>"
},
file_history_panel = {
["q"] = "<cmd>tabc<CR>"
}
}
})
vim.keymap.set("n", "r", "<cmd>DiffviewOpen<CR>")
vim.keymap.set("n", "R", "<cmd>DiffviewFileHistory %<CR>")
vim.o.clipboard = 'unnamedplus'
vim.o.expandtab = true
vim.o.fileencoding = 'utf-8'
@@ -230,7 +251,7 @@ vim.o.spelllang = 'en'
vim.o.tabstop = 2
if vim.fn.expand('%') == '' then
if vim.fn.expand('%') == '' or vim.fn.isdirectory(vim.fn.expand('%')) ~= 0 then
require("neo-tree.command")._command(vim.fn.getcwd())
else
require("neo-tree.command")._command("show", vim.fn.getcwd())

View File

@@ -44,6 +44,8 @@ return require('packer').startup(function()
use {'nvim-telescope/telescope.nvim', requires = 'nvim-lua/plenary.nvim'}
use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' }
use {
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',