How to use "tail -f" in Vim's 8.1 :terminal command window?

32 views
Skip to first unread message

Igor

unread,
Nov 23, 2019, 10:34:53 AM11/23/19
to vim_use
Hi,
I installed Vim 8.1 on Ubuntu 16.04 using PPA.

1. Now I am editing myfile.txt file in vim.
2. I opened new terminal windows inside vim
with command: :terminal

3. New terminal opens. I typed in:
tail -f myfile.txt
4. I moved back to ordinary Vim window:
Ctrl+w
5. I type in some text and save with :w

PROBLEM: I expect terminal windows refreshes
because of tail -f command, but actually
nothing really happens in :terminal window.

If this is working this would be super-powerful
feature using vim and ssh.

Any idea?

Thanks

Matteo Landi

unread,
Nov 23, 2019, 1:12:28 PM11/23/19
to vim...@googlegroups.com
Did you try the same, tail - f, but from outside vim?

If not wrong, vim is dumping the whole buffer to the file on save (not 'appending' new content) so I wouldn't be surprised it tail - f did not work because of it.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d42999ee-a94b-46a7-80e4-5f7ccf60c51a%40googlegroups.com.

Brian L. Matthews

unread,
Nov 23, 2019, 2:06:23 PM11/23/19
to vim...@googlegroups.com
On 11/23/19 10:12 AM, Matteo Landi wrote:
> Did you try the same, tail - f, but from outside vim?
>
> If not wrong, vim is dumping the whole buffer to the file on save
(not 'appending' new content) so I wouldn't be surprised it tail - f did
not work because of it.
>

And I think by default vim renames the current file then writes to a
completely new file, so the file you're tailing never changes, in fact
it gets deleted. You can modify that behavior with various options
(backup, writebackup, backupcopy). I got tail -f to show something by
setting nobackup (which is the default) and nowritebackup (which isn't),
then modifying a file I was tailing. Because of the way tail works, this
would only do something useful if you're just adding lines to the file,
but it does work.

Brian

Bram Moolenaar

unread,
Nov 23, 2019, 3:58:16 PM11/23/19
to vim...@googlegroups.com, Brian L. Matthews
It works fine for me. It might indeed depend on the value of
'backupcopy'.

--
Nobody will ever need more than 640 kB RAM.
-- Bill Gates, 1983
Windows 98 requires 16 MB RAM.
-- Bill Gates, 1999
Logical conclusion: Nobody will ever need Windows 98.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Gua Chung Lim

unread,
Nov 24, 2019, 1:15:18 AM11/24/19
to vim...@googlegroups.com
* Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> It works fine for me. It might indeed depend on the value of
> 'backupcopy'.
I also tried 'set bkc=yes' in vimrc, it works. But it is not very responsive. Sometimes, tail -f didn't update the changes. But most of the time it does.

--
Gua Chung Lim

"UNIX is basically a simple operating system,
but you have to be a genius to understand the simplicity."
-- Dennis M. Ritchie
Reply all
Reply to author
Forward
0 new messages