mirror of
https://github.com/jiriks74/presence.nvim
synced 2024-11-23 12:27:50 +01:00
parent
81c3cc0100
commit
f4c1e227be
@ -8,6 +8,7 @@ function presence#SetAutoCmds()
|
||||
autocmd VimLeavePre * lua package.loaded.presence:handle_vim_leave_pre()
|
||||
autocmd WinEnter * lua package.loaded.presence:handle_win_enter()
|
||||
autocmd WinLeave * lua package.loaded.presence:handle_win_leave()
|
||||
autocmd BufEnter * lua package.loaded.presence:handle_buf_enter()
|
||||
autocmd BufAdd * lua package.loaded.presence:handle_buf_add()
|
||||
endif
|
||||
augroup END
|
||||
|
@ -863,6 +863,13 @@ end
|
||||
function Presence:handle_focus_gained()
|
||||
self.log:debug("Handling FocusGained event...")
|
||||
|
||||
-- Skip a potentially extraneous update call on initial startup if tmux is being used
|
||||
-- (See https://github.com/neovim/neovim/issues/14572)
|
||||
if next(self.last_activity) == nil and os.getenv("TMUX") then
|
||||
self.log:debug("Skipping presence update for FocusGained event triggered by tmux...")
|
||||
return
|
||||
end
|
||||
|
||||
if vim.bo.filetype == "qf" then
|
||||
self.log:debug("Skipping presence update for quickfix window...")
|
||||
return
|
||||
@ -921,6 +928,18 @@ function Presence:handle_win_leave()
|
||||
end)
|
||||
end
|
||||
|
||||
-- BufEnter events force-update the presence for the current buffer unless it's a quickfix window
|
||||
function Presence:handle_buf_enter()
|
||||
self.log:debug("Handling BufEnter event...")
|
||||
|
||||
if vim.bo.filetype == "qf" then
|
||||
self.log:debug("Skipping presence update for quickfix window...")
|
||||
return
|
||||
end
|
||||
|
||||
self:update()
|
||||
end
|
||||
|
||||
-- WinLeave events cancel the current buffer presence
|
||||
function Presence:handle_buf_add()
|
||||
self.log:debug("Handling BufAdd event...")
|
||||
|
Loading…
x
Reference in New Issue
Block a user