LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to auto refresh a file that open by vi command (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-auto-refresh-a-file-that-open-by-vi-command-930446/)

casualzone 02-21-2012 02:59 AM

how to auto refresh a file that open by vi command
 
i would like to monitor a file called fileA. A program will write into this files. how could I auto refresh the fileA that open by vi command?

catkin 02-21-2012 03:25 AM

Assuming you are using vim, there are several solutions here.

fatmac 02-21-2012 03:40 AM

Just thinking aloud; 'tail -f' might work for what you want.

casualzone 02-22-2012 03:14 AM

i try:

:set autoread

it does not work...

catkin 02-22-2012 10:51 PM

It doesn't work for me either but this does:
Code:

:set nolz | while 1 | e | redraw | $ | sleep 1 | endw
EDIT: terminate it with Ctrl+C

casualzone 02-22-2012 11:24 PM

hi catkin,
it is working!
thx

btw, could you explain on the command, the command is a bit long

catkin 02-22-2012 11:44 PM

I found it by netsearching and am not familiar with the vi commands used.

:help nolz explains the first part.

The rest is a macro with an infinite loop, with a 1 second delay. Use :help e, :help redraw and and :help $ for the rest.

casualzone 02-23-2012 02:29 AM

thx

AnanthaP 02-25-2012 03:27 AM

lz seems to be lazyredraw. So nolz is not to do lazy draw.

I found it in this thread:
http://vim.1045645.n5.nabble.com/Fin...td1192575.html
post #7


All times are GMT -5. The time now is 04:57 PM.