rkitover / vimpager

Use Vim as PAGER
http://www.vim.org/scripts/script.php?script_id=1723
Other
774 stars 72 forks source link

Monitor file for changes #247

Closed plurry closed 4 years ago

plurry commented 4 years ago

Is there a way to watch files like less +F or tail -f (or tail -F ideally)?

rkitover commented 4 years ago

Not until I implement streaming which I keep promising to do for years now.

rkitover commented 4 years ago

Actually I can implement this in the meantime:

https://unix.stackexchange.com/a/417939/340856

rkitover commented 4 years ago

Also the less F behavior which is the equivalent of tail -f has already been implemented, even in the distro standard less.vim.

rkitover commented 4 years ago

Given that F does what you want and the behavior for less is similar, and less does not have a command-line option for this, and the -f option for less does an entirely different thing (force) do you think a command-line option would be helpful?

plurry commented 4 years ago

Running less +F file does what running less file then pressing Shift + f does.

For my particular use case, I have a script that opens several tmux panes with different log files. Right now I'm using tail -F, which monitors the file name instead of the file descriptor and is perfect for logs that might get rolled over while you're watching them.

But, it would be nice if I could scroll back through the whole file using a pager instead of the tmux scrollback buffer. And even more than that, I'd like the colors you get when Vim has syntax highlighting for the file.

rkitover commented 4 years ago

I see, so I can implement the +F command-line option.

When this behavior is in effect, do you want the buffer to scroll to the very end on new output or do you want it to retain position and only move to the end when you press G?

plurry commented 4 years ago

Scroll to the end. It's what less does for one thing, and if you're imitating the flag, you might as well imitate the behavior. It's also what I'd prefer anyway.

rkitover commented 4 years ago

I have implemented the +F command-line option and replaced the F tail code with better timer-based code.