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

Provide a mechanism to perform the equivalent of ":read"'s ++edit flag #11586

Open
jamessan opened this issue Nov 20, 2022 · 2 comments
Open

Comments

@jamessan
Copy link
Contributor

Currently in the vim-gnupg plugin, I use a BufReadCmd to read output from gpg and populate the buffer. This BufReadCmd uses :r ++edit !gpg ... so the fileformat and encoding detection takes place.

I'm looking to change this to instead use a job so I can independently read stdout/stderr, which is required to deal with certain bugs in the plugin. However, manually populating the buffer with the job's output means I can't leverage the ++edit functionality.

In the specific case of BufReadCmd, it may make sense to automatically perform this detection after BufReadCmd executes (assuming other ++ options weren't included in the :e command). If that's not feasible, it would be useful if there were a way to manually execute this detection.

@brammool
Copy link
Contributor

brammool commented Nov 21, 2022 via email

@jamessan
Copy link
Contributor Author

It appears to have the same goal, thus should already be very close to what you want.

Thanks, I'll try to find some time to prototype this.

After your job has filled the buffer, I suppose a function could be called to do the detection. Not sure what to call it, bufdetect() ?

That's as good as anything came to mind for me. As long as it's cross-referenced from BufReadCmd's documentation, I think it'll be found when needed.

We would need to define exactly what happens. Perhaps we also only want to detect a specific option, such as 'fileformat', and not change others.

Agreed. My use case is only for setting up 'fileformat' and 'fileencoding' properly, but I think that aligns with what's typically required for BufReadCmd based plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants