Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I finally got around to create a suggestion based on #42
This makes the plugin call the possibly-user-defined function g:PasteImageFunction instead of doing Markdown-specific inserts.
The old behaviour has been separated into the MarkdownPasteImage function, which I have set g:PasteImageFunction to default to.
I've also included two example paste functions: one for latex and another that just pastes the path of the image (in case you just want to save the image and have its path). These are defined within the plugin (which I think makes sense for common languages), put can also be defined by the user in vimrc.
I tagged this as WIP since it is my first vimscript PR, and I have some questions and comments:
I was unsuccessful in my attepts at setting PasteImageFunction based on the filetype (autocmd), but I'm hoping that someone can give some pointers :) For now I have just set the PastImageFunction manually. Here is what I triedThis now magically works. Probably had a problem with my vim settingsLooking forward to hearing what you think!