Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(buffer): close the harpoon window when opening netrw inside it #489

Open
wants to merge 3 commits into
base: harpoon2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lua/harpoon/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ function M.setup_autocmds_and_keymaps(bufnr)
require("harpoon").ui:toggle_quick_menu()
end,
})

vim.api.nvim_create_autocmd("FileType", {
group = HarpoonGroup,
pattern = "*",
callback = function(ev)
vim.schedule(function()
local ui = require("harpoon").ui
local current_win = vim.api.nvim_get_current_win()
local current_win_buf = vim.api.nvim_win_get_buf(current_win)
if ui.win_id ~= current_win or ev.buf ~= current_win_buf then
return
end
if not ui.closing and ev.buf ~= ui.bufnr then
require("harpoon").logger:log("toggle by FileType")
ui:toggle_quick_menu()
end
end)
end,
})
end

---@param bufnr number
Expand Down
Loading