I’m currently working on some code in which there’s an
if/else statement in which I’m pretty sure the body of the
if was copy-pasted into the body of the
else. Since a small difference can be hard to catch with the naked eye, I thought it would be great if I could diff the 2 sections just as I might diff 2 files.
While I haven’t really used it, I’m aware that there’s a utility included on many unix systems called
diff that can diff 2 files or even raw text.
Some searches yielded me to this example:
diff <(echo "$sometext") <(echo "$someothertext")
Kakoune provides great mechanisms for sending selections through shell commands. There seems a good opportunity to achieve my goal here.
Does anyone know or have some ideas on how to diff [let’s start with] 2 selections from within Kakoune? Is this doable without any scripting, or what would be a minimal command implementation to accomplish this?
I think there’s great plugin or rc script opportunities here (like the git integration script), but would like to know if anyone knows or could come up with a quick-n-dirty way of using
kak in this way.