Skip to content

Conversation

simonhughxyz
Copy link

@simonhughxyz simonhughxyz commented Mar 25, 2025

This PR adds two new attachment handlers to improve how attachments are opened and viewed:

open_handler: replaces the old open_cmd config option and is a callback function to open attachments externally. By default, it calls xdg-open, just like the old setup.

view_handler: a new config option which is a callback function for viewing attachments directly inside Vim. By default it runs a view-handler shell command, which you can customize.

This change makes it easier to handle attachments in different ways depending on the context, either externally or within Vim.

By making them callback function it gives users the option to handle opening or viewing attachment entirely within their lua config.

I included a example shell script in the readme for view-handler. All it needs to do is to convert the file to text.

This PR is a breaking change as it removes the old open_cmd!

Previously, attachments could only be opened externally using `xdg-open`.
This update adds an option to view attachments directly in a Neovim buffer,
allowing users to preview text-based attachments without leaving Neovim.

Attachments like plain text, markdown, and PDFs (if converted) can now
be displayed in a buffer
BREAKING CHANGE: The `open_cmd` config option has been renamed to `open_handler`
to align with the `view_handler` config option. It is now a callback function.

Users will need to update their configuration to use `open_handler` instead of `open_cmd`.
The README configuration options now show that the handler config
options are callback functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant