wmitchell
wmitchell

Reputation: 5735

Vim updating currently viewed file

Im just curious if im viewing a file e.g. x.log which is currently being updated ie a log file. Is there a way to effectively refresh it rather than :q and vim x.log it again ?

Upvotes: 3

Views: 453

Answers (4)

skeept
skeept

Reputation: 12423

Also you can do :set autoread if you are just viewing the file without changing it.

Upvotes: 3

Dave Kirby
Dave Kirby

Reputation: 26592

:edit with no other parameters will reload the current file.

:edit! to discard changes first.

Also gvim will prompt you to reload a file if you switch to another program and back, and it detects that the file has changed.

Upvotes: 3

Walter H
Walter H

Reputation: 151

:e reloads the current file. Use :e! if you made any changes. You can assign a key to it like this:

nmap <F1> :e^M

Where ^M is a literal control-M (use control-V in vi).

Upvotes: 1

Colin Newell
Colin Newell

Reputation: 3163

The command :e with no parameters will do that.

Upvotes: 7

Related Questions