Hi, On Sat, May 6, 2023 at 4:44 AM rickhowe <vim-dev-git...@256bit.org> wrote:
> I am interested in this builtin function as I have developed some plugins > to support word/character level diff in lines (this > <https://github.com/rickhowe/diffchar.vim>) and range/area selectable > diff in buffers (this <https://github.com/rickhowe/spotdiff.vim>). I > implemented the O(NP) comparison algorithm in vim script, but I have been > looking for a builtin function like yours. Several month ago, I noticed > that neovim has vim.diff() function so I switched to use it for neovim in > my script. > > Honestly, I am confused about a return value of your function. vim.diff() > actually returns diff in a unified format as default, from which is very > easy to generate a shortest edit script (SES). > > For example, how easy can I generate this SES from your return value? > Does your plugin use the starting line number and count in the original and new files for a diff hunk (just like shown in a unified diff output)? If it does, then the diff() function return value contains these values. To get these values, you can use [from.startidx, from.endidx - from.startidx + 1, to.startidx, to.endidx - to.startidx + 1] for a diff hunk. I see that the Neovim vim.diff() function returns these values when using the {result_type = 'indices'} option. Regards, Yegappan > list1 = ['a', 'b', 'c', 'a', 'b', 'b', 'a'] > list2 = ['c', 'b', 'a', 'b', 'a', 'c'] > SES = '--=-=+==+' > > > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DkaoNSpF2QO3tLwpRTFY9V8gCyzVDuFfVAf7cmqxH6Hw%40mail.gmail.com.