comparison .chezmoitemplates/init.lua @ 579:4e25c3d4470d

handle HOME on windows
author zegervdv <zegervdv@me.com>
date Thu, 24 Mar 2022 09:25:43 +0100
parents 50e9c21e8e95
children ea43c828daa1
comparison
equal deleted inserted replaced
578:8e3088140ac6 579:4e25c3d4470d
2 -- Neovim dotfiles 2 -- Neovim dotfiles
3 -- 3 --
4 -- 4 --
5 local execute = vim.api.nvim_command 5 local execute = vim.api.nvim_command
6 local fn = vim.fn 6 local fn = vim.fn
7
8 local home = os.getenv('HOME')
9 if home == nil then
10 home = os.getenv('USERPROFILE')
11 end
7 12
8 -- Bootstrap package manager 13 -- Bootstrap package manager
9 local install_path = fn.stdpath 'data' .. '/site/pack/packer/opt/packer.nvim' 14 local install_path = fn.stdpath 'data' .. '/site/pack/packer/opt/packer.nvim'
10 15
11 if fn.empty(fn.glob(install_path)) > 0 then 16 if fn.empty(fn.glob(install_path)) > 0 then
709 714
710 opt.pastetoggle = '<F2>' -- Enable paste mode 715 opt.pastetoggle = '<F2>' -- Enable paste mode
711 716
712 opt.undofile = true -- Persistently remember undos 717 opt.undofile = true -- Persistently remember undos
713 opt.undolevels = 1000 718 opt.undolevels = 1000
714 if os.getenv 'HOME' ~= nil then 719 opt.undodir = home .. '/.config/nvim/tmp/undo//'
715 opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//'
716 end
717 opt.swapfile = false -- Disable swap files 720 opt.swapfile = false -- Disable swap files
718 opt.backup = true -- Keep backups 721 opt.backup = true -- Keep backups
719 if os.getenv 'HOME' ~= nil then 722 opt.backupdir = home .. '/.config/nvim/tmp/backup//'
720 opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//'
721 end
722 723
723 -- Files to ignore from completion 724 -- Files to ignore from completion
724 opt.wildignore:append { 725 opt.wildignore:append {
725 '*/tmp/*', 726 '*/tmp/*',
726 '*.so', 727 '*.so',
941 lsp.esbonio.setup { 942 lsp.esbonio.setup {
942 on_attach = on_attach, 943 on_attach = on_attach,
943 capabilities = capabilities, 944 capabilities = capabilities,
944 root_dir = root_dir, 945 root_dir = root_dir,
945 -- Assume esbonio is installed with --user 946 -- Assume esbonio is installed with --user
946 cmd = { os.getenv 'HOME' .. '/.local/bin/esbonio' }, 947 cmd = { home .. '/.local/bin/esbonio' },
947 } 948 }
948 949
949 null_ls.setup { 950 null_ls.setup {
950 sources = { 951 sources = {
951 null_ls.builtins.formatting.black, 952 null_ls.builtins.formatting.black,