Monitor file for changes
plurry opened this issue · 8 comments
Is there a way to watch files like less +F
or tail -f
(or tail -F
ideally)?
Not until I implement streaming which I keep promising to do for years now.
Actually I can implement this in the meantime:
Also the less F
behavior which is the equivalent of tail -f
has already been implemented, even in the distro standard less.vim.
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?
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.
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
?
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.
I have implemented the +F
command-line option and replaced the F
tail code with better timer-based code.