Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo doesn't work in Windows #31

Open
jon49 opened this issue Jan 2, 2023 · 2 comments
Open

Undo doesn't work in Windows #31

jon49 opened this issue Jan 2, 2023 · 2 comments

Comments

@jon49
Copy link

jon49 commented Jan 2, 2023

There is no environment variable HOME in windows. So, this fails vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir".

This is the solution:

local home = os.getenv("HOME")
if (home == nil) then
    home = os.getenv("UserProfile")
end
opt.undodir = home .. "/.vim/undodir"
@simsrw73
Copy link

simsrw73 commented Jan 2, 2023

Or vim.fn.expand('~/.vim/undodir')

Better: use vim.fn.stdpath('config') or vim.fn.stdpath('state'). These will also seem to respect $XDG paths, which I define on my Windows as well as Linux machines to keep them similarly organized.

@jon49
Copy link
Author

jon49 commented Jan 3, 2023

vim.fn.expand('~/.vim/undodir') works well. A much better solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants