#StackBounty: #neovim #scrolling #terminal-buffer How to follow the output of a command in a terminal window

Bounty: 200

I recently decided to give a try at neovim and one thing is bothering me:

I use a terminal window to run my code watcher i.e. a never ending command which outputs new lines each time I write a buffer.

If I put my cursor on this window and use G the window will keep track of the output and I will always see the last lines of the output as long as I don’t switch of window.

If I change of tab or of window, the window containing the terminal buffer stops scrolling and I have to go back to this window and use G again to see the end of my output.

If feel like I’m missing something but I wasn’t able to find a solution to this problem. I guess I could have an autocommand on TabEnter and for example which would find a terminal buffer in the new tab and use norm! G in it but that feel kind of overkill (plus that wouldn’t solve the problem if I have two split buffer and I work on the one next to the terminal buffer). Is there a simple solution to this problem?

EDIT Here are the steps to reproduce my issue:

Create a file and continuously write in it from the shell:

  • touch foo
  • while; do; echo 'a' >> foo; sleep 1; done

Start neovim without any config:

  • nvim -u NONE -U NONE

In neovim:

  • :term tail -f foo To open a terminal with a continuous output
  • Go to insert mode and add an empty line to follow the output then go to normal mode and G
  • :tabnew

Wait a few seconds

When going to the first tab, the empty line should have changed of place, for me it doesn’t.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.