vi 编辑器如何记住上一个文件的当前行
假设我正在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不知道普通的旧
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.您可以在许多程序中看到这种行为。您关闭 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 theUp Arrow
keyVi in particular? Definitely has a file somewhere.