Fix alignment for Fugitive blame #153
ouuan
started this conversation in
Show and tell
Replies: 2 comments
-
|
stumbled upon this while looking to solve exactly this problem, thank you ouuan! local default_config = require 'dropbar.configs'.opts
require('dropbar').setup {
bar = {
enable = function(buf, win)
return default_config.bar.enable(buf, win)
or vim.bo[buf].ft == 'fugitiveblame'
end,
sources = function(buf, win)
if vim.bo[buf].ft == 'fugitiveblame' then
return {}
end
return default_config.bar.sources(buf, win)
end
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@feakuru A more general method that doesn't depend on dropbar's setup function is: vim.api.nvim_create_autocmd('FileType', {
desc = 'Set buffer-local options for fugitive blame buffers.',
group = vim.api.nvim_create_augroup('FugitiveSettings', {}),
pattern = 'fugitiveblame',
callback = function()
local win_alt = vim.fn.win_getid(vim.fn.winnr('#'))
vim.opt_local.winbar = vim.api.nvim_win_is_valid(win_alt)
and vim.wo[win_alt].winbar ~= ''
and ' '
or ''
end,
})Put this in your fugitive config and it will work even if you switch to other winbar plugins or when the source window does not have winbar enabled. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
By default, Fugitive blame does not have the drop bar, so the line blames are not aligned with the file content.
I use the following config to add a dummy drop bar to fix it:
Beta Was this translation helpful? Give feedback.
All reactions