vi 编辑器如何记住上一个文件的当前行

发布于 2024-12-19 18:15:58 字数 99 浏览 5 评论 0原文

假设我正在 vi 编辑器中读取文件。我在第 50 行,然后退出了。一段时间后,我在 vi 编辑器中重新打开该文件。我注意到光标位于关闭文件之前所在的同一行。 VI编辑器如何记住这一点?

Suppose I am reading a file in vi editor. I am at line number 50 and I quit. After some time I reopen the file in vi editor. I notice that the cursor is at the same line where I was before closing the file.
How does VI editor remember this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢好甜 2024-12-26 18:15:58

不知道普通的旧vi。然而,vim 会将您使用它编辑的文件的当前行号保存在主目录中名为 .viminfo 的文件中。至少,Linux 中是这么做的。

Don't know about plain old vi. vim, however, saves the current line number of the files you edit with it in a file called .viminfo in your home directory. At least, that's what it does in Linux.

╰沐子 2024-12-26 18:15:58

您可以在许多程序中看到这种行为。您关闭 IDE,当您重新打开它时,它会打开您的上一个项目。你可以杀死你的火狐,当你重新打开它时,你的所有页面都会重新加载。

很简单,他们把它保存在自己的地方。

在 Windows 应用程序中保存这些信息的常见位置之一是注册表。您可以在 Windows 中运行 regedt32 并查看其中的所有数据。对于 Linux-y 应用程序,通常会在您的家中创建隐藏文件 (~)。您可以转到 Linux 中的主目录并打开文件 .bash_history 并查看您可以使用 向上箭头 键访问的旧 bash 命令,

特别是 Vi?肯定在某处有文件。

You can see this behavior in many programs. You close your IDE and when you reopen it, it opens your last project. Your can kill your firefox and when you reopen it, you get all your pages reloaded.

It is simple, they save it somewhere for themselves.

One of the common places to save these information in Windows-y applications is the registry. You can run regedt32 in your windows and see all those data there. With Linux-y applications, it is common to create a hidden file in your home (~). You can go to your home directory in your Linux and open file .bash_history and see your old bash commands that you can access with the Up Arrow key

Vi in particular? Definitely has a file somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文