在vi编辑器中,wq和x有什么不同?

16

我一直使用 :wq 命令保存文件。今天我发现可以用命令 :x 来完成同样的操作。但我在任何vi教程或vi快速参考中都没有找到过这个命令。这两个命令之间有什么区别吗?

2个回答

26

help :x

    *:x* *:xit*
:[range]x[it][!] [++opt] [file]
            Like ":wq", but write only when changes have been
            made.
            When 'hidden' is set and there are more windows, the
            current buffer becomes hidden, after writing the file.

0
这两者之间的区别非常简单- :x仅在文件被修改时保存更改,而:wq无论如何都会更改修改时间。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接