So I am pretty sure this is happening with the latest neovim I installed because its only happening in directories that I open with neovim. I don’t have a clue what is causing this but when I list the directories I find '~' in places it should not be. I remove them, and then they come back the next time I work in the directories.
Okay so I finally figured out what this is. My init.lua file is setting the global option for the undodir to ~/.config/nvim/undodir and for whatever reason, it is being misinterpreted and whenever I undo something it is looking for this path in the directory I am working in and therefore it creates ./'~'/.config/nvim/undodir. What I can’t figure out is why that is being interpreted that way instead of actually using the home directory. Should I change it to $HOME/.config/nvim/undodir?
Thanks @mjlbach that did the trick. I thought just setting the string value would work like it does in vim but I see that does not work as I thought it would. I think that fixed the issue!
os.getenv("HOME") is same no need to get through vim function for that . If using vim function vim.fn.glob() is probably better choice as it expands ‘~’ .
except neovim config is not in $HOME/.config but $XDG_CONFIG_HOME and if its not set os.getenv("XDG_CONFIG_HOME") handling gets messier plus it’s less portable (eg., on windows)