kimono-koans/httm

feature request: live-preview of file content for text files in interactive mode

arctic-penguin opened this issue · 2 comments

Like this: https://nickjanetakis.com/blog/using-fzf-to-preview-text-files-on-the-command-line-and-within-vim

Use case: the user has written any text file over some time. He has overwritten some past changes. He would like to check if the specific changes are contained in any of the snapshots of the file.

So something like:

  1. $ httm -r my_file.txt
  2. the snapshot selection and the preview window show up
  3. the preview pane shows the file in snapshotted state, and allows for some scrolling and such

Preview could use bat if it is installed to provide syntax highlighting, otherwise less

This could be extended to generate diffs between versions from different snapshots, but that is another story.

Use case: the user has written any text file over some time. He has overwritten some past changes. He would like to check if the specific changes are contained in any of the snapshots of the file.

Check out bowie which already does something similar as a script.

But this is definitely possible! It may require another exec mode but its definitely doable. And I think the questions are only: Is it worth adding if one has bowie already? Do you make it automatic for text? If so how does one easily detect text or binary files? Are there good crates which can diff the output or do we just use diff, perhaps make the preview selectable via an env var and at the command line, like SELECT_PREVIEW_CMD="diff --color (snap} {live} | bat", etc.

Please let me know your thoughts!

Thanks! Appreciate you taking a look at the project.

Completed with: #56