Why would neovim want to cd to unmounted directories on quit?

I had a strange problem this morning where whenever i tried to quit my neovim instance, it would indefinitely hang and I would need to exit my terminal window. I used strace -r nvim to discover that my nvim was hanging because it was trying to chdir to a directory on an unmounted filesystem. Strangely, this happened even when I ran nvim -u NORC. However, with nvim --clean I had no issues.

Any ideas what would be causing this to happen and how I could avoid it?

Interestingly, the hang would also happen when I used “ctrl-o” to go back to a previous cursor position.

:help shada since you are mentioning ctrl-o meaning the jumplist. The issue most certainly is marks, probably marks that were in files the once mounted directory and now nvim hangs trying to get the file to move to them or store them.

Try clearing your shada, jumplist and marks.

Also if you test with nvim -i NONE you won’t see the issue.