Reputation: 953
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?
Upvotes: 0
Views: 441
Reputation: 86535
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.
Upvotes: 1
Reputation: 47563
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.
Upvotes: 0