I know that vim retains some meta information about a file (like cursor position before you last closed it, file type if you have manually set it)
How can I reset this information? I'm in a very weird situation where I have a file x and I have a file y that is just a symlink to x.
I'm getting a weird error whenever I try to edit y but I don't encounter it when editing x directly, indicating that this has something to do with the file state rather than the error being legitimate (error message is about a plugin but removing that plugin doesn't stop vim from trying to invoke functions in that plugin in the file y, though it does not give any error in file x or any other symlinks of x)
How do I just reset the file y? I've tried deleting and restoring it, to no avail. I cannot rename it, it's a configuration file so it must be present in a certain location.
Answers to some follow up questions:
- Are the file extensions same? Yes, and so is
:set ft?. - Are any plugins that save / restore session state? I have inspected the plugins and does not seem that's the case
- Is
:scriptnamessame between both the files? Yes
~/.viminfodoes not seem to reset file state (vim still remembers last edit position). – Peeyush Kushwaha Nov 24 '20 at 10:36error detected while processing function AutoPairsInsert: line 1: E121: Undefined variable: b:autopairs_enabledbut IMO that's garbage. I removed autopairs extension, removed syntax highlight extension for the file, changed file type, all to no avail – Peeyush Kushwaha Nov 24 '20 at 10:39:scriptnamesfrom bothxandyto see which Vim scripts get loaded with each and then see whether there's a difference. Do filesxandyhave different extensions that would trigger different filetypes? (Also, try:set ft?to inspect it with each file.) Do you have any plug-in that's restoring views or sessions? Please [edit] your question to include answers to these follow ups. – filbranden Nov 24 '20 at 16:16.viminfodidn't, sadly. Was it supposed to? – Peeyush Kushwaha Nov 25 '20 at 16:49.viminfofile (but thought I did). When I did it now, it did reset the last edit position and ALSO fixed the issue! You may post it as an answer and I'll accept it – Peeyush Kushwaha Nov 25 '20 at 16:55:bdon both files? Then reopen them. Then maybe save statewshadafor nvim. – eyal karni Nov 30 '20 at 12:26