I am scripting the display of the output of a script (well, it is just the program git diff
) with tmux: Once a filesystem change is detected the shell script executes tmux send-keys q enter C-l "git diff" enter
which has it effectively refresh the git diff
view.
You might consider this similar to functionality provided by iTerm's coprocesses.
Problem is, I want it on refresh to scroll back to the same position that it was in.
One of the reasons for using tmux is that the window is actually a totally normal and interactive terminal session that can be interacted with as normal to scroll around to look at the full output.
But I want to obtain the scroll position somehow.
Suppose I want to actually do computation on the text content of the terminal window itself, exactly like iTerm2's coprocess does, but so that I can use it on Linux (over ssh). Does tmux provide this ability?
I'm unsure about capturing this with a script, but less -N
will show line numbers.
And -jn
or --jump-target=n
can jump to a location.