开发者

Vim updating currently viewed file

开发者 https://www.devze.com 2022-12-16 22:19 出处:网络
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 ?The comma

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 ?


The command :e with no parameters will do that.


: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.


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


: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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号