-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for external integrations to hover events (#341)
* feat: add support for external integrations to hover events It's now possible to create a custom integration in your own configuration. This can be useful for creating custom behavior when hovering over a file in yazi. In the future, other events might be supported as well. ```lua vim.api.nvim_create_autocmd('User', { pattern = 'YaziDDSHover', -- see `:help event-args` ---@param event {data: YaziHoverEvent} callback = function(event) vim.notify( vim.inspect({ 'Just received a YaziDDSHover event!', event.data }) ) end, }) ``` * fixup! feat: add support for external integrations to hover events
- Loading branch information
1 parent
4a3def4
commit ed00655
Showing
13 changed files
with
101 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
integration-tests/test-environment/config-modifications/notify_hover_events.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
---@module "yazi" | ||
|
||
require('yazi') | ||
|
||
vim.api.nvim_create_autocmd('User', { | ||
pattern = 'YaziDDSHover', | ||
-- see `:help event-args` | ||
---@param event {data: YaziHoverEvent} | ||
callback = function(event) | ||
vim.notify( | ||
vim.inspect({ 'Just received a YaziDDSHover event!', event.data }) | ||
) | ||
end, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- This file is about emitting events to other Neovim plugins | ||
|
||
local M = {} | ||
|
||
---@alias YaziNeovimEvent | ||
---| "'YaziDDSHover'" A file was hovered over in yazi | ||
|
||
---@param event_name YaziNeovimEvent | ||
---@param event_data table | ||
function M.emit(event_name, event_data) | ||
vim.api.nvim_exec_autocmds('User', { | ||
pattern = event_name, | ||
data = event_data, | ||
}) | ||
end | ||
|
||
return M |
2 changes: 2 additions & 0 deletions
2
lua/yazi/event_handling.lua → ...zi/event_handling/yazi_event_handling.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters