Skip to content

Commit

Permalink
fix: aerial ignores diff windows (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Oct 11, 2023
1 parent c2ed3b9 commit c383f45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/aerial/autocommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ M.on_enter_buffer = util.throttle(function()
local config = require("aerial.config")
local fold = require("aerial.fold")
local window = require("aerial.window")
backends.attach()
if util.is_ignored_win() then
return
end
backends.attach()

local mybuf = vim.api.nvim_get_current_buf()

Expand Down
7 changes: 6 additions & 1 deletion lua/aerial/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,17 @@ end
---@return boolean
---@return nil|string
M.is_ignored_win = function(winid)
winid = winid or 0
if not winid or winid == 0 then
winid = vim.api.nvim_get_current_win()
end
local bufnr = vim.api.nvim_win_get_buf(winid)
local ignore_buf, message = M.is_ignored_buf(bufnr)
if ignore_buf then
return ignore_buf, message
end
if vim.wo[winid].diff then
return true, "Viewing a diff"
end
local ignore = config.ignore
if ignore.wintypes then
local wintype = vim.fn.win_gettype(winid)
Expand Down

0 comments on commit c383f45

Please sign in to comment.