linux - 如何在 linux 中的 emacs 或 Vim 等编辑器中查看程序的控制台输出?

标签 linux emacs console vi

假设我有一个简单的程序: (伪代码)

for(i=0;i<1000;i++)
{
   print(i + "\n");
   sleep(1);
}


Output:
0
1
2

有没有办法在 emacs 或 Vi 等编辑器中查看此输出的变化? 我想要的行为就像对不断写入的文件执行“tail -f”。

最佳答案

这实际上是内置于 emacs :)

M-x auto-revert-tail-mode

从 C-h f auto-revert-tail-mode :

When Tail mode is enabled, the tail of the file is constantly followed, as with the shell command `tail -f'. This means that whenever the file grows on disk (presumably because some background process is appending to it from time to time), this is reflected in the current buffer.

关于linux - 如何在 linux 中的 emacs 或 Vim 等编辑器中查看程序的控制台输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7360881/

相关文章:

php - ZF2 控制台路由无限参数

winapi - 如何构建 VB6 控制台应用程序

linux - sftp 文件年龄 : reading files transferred from sftp that aren't complete yet

linux - 删除重复的 shell 命令

java - 如何使用单个命令在 UNIX 文件系统中提取 JAR 并使用 JAR 命令指定其目标目录?

emacs - 取消缩进代码片段

c++ - emacs 完成或 IntelliSense 与 Visual Studio 相同

linux - 在 tmux 显示消息中显示选项的当前值

Emacs/Slime 键绑定(bind)/发送命令到 Swank 服务器

c - 如何在 C 中隐藏控制台?