Friday, December 2, 2022

Re: List of changed lines

On Thu, Dec 1, 2022 at 5:04 PM Salman Halim <salmanhalim@gmail.com> wrote:

On Thu, Dec 1, 2022, 15:32 Owajigbanam Ogbuluijah <xigbanam@gmail.com> wrote:
Does :h changes help?

I hadn't thought to look at that. That's interesting. I suspect I'm going to just do the diff stuff similarly to Mundo (as suggested by Christian) or Gundo because I need an exact list of lines that were added or changed, but want to skip any that were deleted. 

I looked at DiffOrig as suggested by Tony Mechelynck and looked up the longest common subsequence algorithm off Wikipedia (basically, how 'diff' works) and wrote a pure Vim9 script that takes two lists of strings and returns two lists, one of all the added and modified lines and one of all the removed lines. This does exactly what I wanted, except that it takes a second or so for my test file, which is over 1500 lines long, and is far too long to wait after every save. I have much longer files, also.

I might upload the Vim9 diff functions because they aren't terribly slow with smaller lists, but I think I'll try the Python difflib, much as Gundo does, to see if it's faster. Otherwise, I might just abandon the idea.

Basically, I can't check the entire file after every save. I need to have some way of restricting the diff regions.

--
 
Salman

I, too, shall something make and glory in the making.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEdrOkBokz61tg3-Wu-eqnnFQN9VL-ugWcn60CAL6qOeBQ%40mail.gmail.com.

No comments: