LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2012, 02:59 AM   #1
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Rep: Reputation: 15
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?
 
Old 02-21-2012, 03:25 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Assuming you are using vim, there are several solutions here.
 
Old 02-21-2012, 03:40 AM   #3
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: AntiX.
Posts: 1,720

Rep: Reputation: Disabled
Just thinking aloud; 'tail -f' might work for what you want.
 
Old 02-22-2012, 03:14 AM   #4
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
i try:

:set autoread

it does not work...
 
Old 02-22-2012, 10:51 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
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
 
1 members found this post helpful.
Old 02-22-2012, 11:24 PM   #6
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
hi catkin,
it is working!
thx

btw, could you explain on the command, the command is a bit long
 
Old 02-22-2012, 11:44 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
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.
 
Old 02-23-2012, 02:29 AM   #8
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
thx
 
Old 02-25-2012, 03:27 AM   #9
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 819

Rep: Reputation: 197Reputation: 197
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mutt, IMAP and auto'refresh' markraves Linux - Desktop 1 10-25-2010 04:56 PM
OpenOffice auto open file johngrinham Linux - Software 3 06-25-2008 06:07 AM
Samba shares - no auto refresh c087 Linux - Software 3 08-09-2007 09:38 PM
Auto-refresh feature ppuru LQ Suggestions & Feedback 1 08-12-2004 08:16 AM
Getting Samba to Auto Refresh lsgko Linux - Newbie 2 09-02-2003 05:58 PM


All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration