-
Notifications
You must be signed in to change notification settings - Fork 6
[IDEA] markdown smart paste? #190
Copy link
Copy link
Closed
Description
https://www.reddit.com/r/neovim/comments/1pzu7rb/smart_paste_in_markdown_that_fetches_the_title/
got invited to open this, but there's quite some hacky stuff in the code, I'll just document some of my thoughts here and let you decide want to do
- I used
vim.pastecallback, which allows to just paste with<C-S-V>instead of providing an custom action, it is cool and great, but there's catch, I know of this way of overiding the callback from the code of some of those img pasting plugins, I assume they would also be doing something if it sees an url, not sure, but there's slight chance this approach would conflict with other, because we are not sure which plugin loaded first, so that is the catch - I also don't feel very comfortable that this could be the default behavior of a plugin I installed (as a script I wrote it is fine), because it involves a blocking operation (could be async but then the cursor position could be messy). in the middle of my pasting, which should be clean and simple operation, also
<C-S-V>is not a vim mapping if I am not mistaken, it is just your terminal streaming text into neovim, and in many editors like ms word this mapping means paste as plain text, without modification, and here we are modifying it and blocking the editor, so that is a design decision there if you want to really add this - I am not familiar with html, so the extraction logic can be better or cleaner, I don't know, to be more robust maybe you can use
vim.lpegor treesitter to extract, so really delivering this as a solid feature could be some work, so I'll just leave it to you or others who want to do it for now.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels