# HG changeset patch # User zegervdv # Date 1648110343 -3600 # Node ID 4e25c3d4470d27b172408fc5fb0dceb2afaaa56f # Parent 8e3088140ac6ee10344aca9d12e0e25c400c9dca handle HOME on windows diff -r 8e3088140ac6 -r 4e25c3d4470d .chezmoitemplates/init.lua --- a/.chezmoitemplates/init.lua Thu Mar 24 09:22:08 2022 +0100 +++ b/.chezmoitemplates/init.lua Thu Mar 24 09:25:43 2022 +0100 @@ -5,6 +5,11 @@ local execute = vim.api.nvim_command local fn = vim.fn +local home = os.getenv('HOME') +if home == nil then + home = os.getenv('USERPROFILE') +end + -- Bootstrap package manager local install_path = fn.stdpath 'data' .. '/site/pack/packer/opt/packer.nvim' @@ -711,14 +716,10 @@ opt.undofile = true -- Persistently remember undos opt.undolevels = 1000 -if os.getenv 'HOME' ~= nil then - opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//' -end +opt.undodir = home .. '/.config/nvim/tmp/undo//' opt.swapfile = false -- Disable swap files opt.backup = true -- Keep backups -if os.getenv 'HOME' ~= nil then - opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//' -end +opt.backupdir = home .. '/.config/nvim/tmp/backup//' -- Files to ignore from completion opt.wildignore:append { @@ -943,7 +944,7 @@ capabilities = capabilities, root_dir = root_dir, -- Assume esbonio is installed with --user - cmd = { os.getenv 'HOME' .. '/.local/bin/esbonio' }, + cmd = { home .. '/.local/bin/esbonio' }, } null_ls.setup {