From a978993d21a1d97f4817313eb5696ee1e29d8527 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Sat, 6 Jan 2024 01:34:43 -0500 Subject: [PATCH] [neovim] Fix the LSPSaga/fugitive conflict This mostly fixes the issue of the mismatch between fugitive's blame window and LSPSaga's breadcrumbs. --- neovim/init.lua | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index 6883487..673b2b0 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -68,6 +68,7 @@ vim.keymap.set( function () -- This restores the UI to the saved layout 'idelayout' (if saved on command line) -- TODO: Wrap the function body in an if statement to verify existence of idelayout + -- (This depends on command line commands' being executed before this $VIMRC is loaded vim.cmd("exec idelayout") end, { desc = "Revert window layout" } @@ -105,9 +106,9 @@ require("lazy").setup({ version = "*", -- Use for stability; omit to use `main` branch for the latest features event = "VeryLazy", config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) end }, { @@ -315,8 +316,7 @@ require('mason').setup() require('mason-lspconfig').setup() --[[ lualine -Lualine provides the status bar as well as the tabline. Not sure whether -it also provides the buffer breadcrumbs. +Lualine provides the status bar as well as the tabline. --]] require('lualine').setup { options = { theme = 'dracula' }, @@ -618,6 +618,24 @@ end vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944") vim.cmd("highlight NonText gui=bold guifg=#999999") +--[[ +Resolve conflict between fugitive and LSPSaga, wherein the latter's +breadcrumbs cause a mismatch between the buffer and fugitive's :Git blame +window. To kill the winbar (the top line where the breadcrumbs and this +blame title live), enter `:set winbar&`. +--]] +local group = vim.api.nvim_create_augroup("fugitiveSagaConflict", { clear = true }) +vim.api.nvim_create_autocmd( + 'FileType', + { + group = group, + pattern = 'fugitiveblame', + callback = function() + vim.api.nvim_set_option_value('winbar', 'fugitive: :Git blame', { scope = 'local' }) + end, + } +) + -- Switch syntax highlighting on vim.cmd("syntax enable")