comparison .chezmoitemplates/init.lua @ 648:c5ed13440614

Set and optionally create backup and undo dirs
author zegervdv <zegervdv@me.com>
date Fri, 02 Sep 2022 07:37:49 +0200
parents eb7d12790ebe
children cc06db32b946
comparison
equal deleted inserted replaced
647:7e98d6e02819 648:c5ed13440614
768 768
769 opt.conceallevel = 0 -- Disable conceal 769 opt.conceallevel = 0 -- Disable conceal
770 770
771 opt.pastetoggle = '<F2>' -- Enable paste mode 771 opt.pastetoggle = '<F2>' -- Enable paste mode
772 772
773 local optdir = function(path)
774 local Path = require 'plenary.path'
775 local full_path = Path:new(vim.fn.stdpath 'cache' .. '/' .. path)
776 if not full_path:exists() then full_path:mkdir { parents = true } end
777 return full_path .. '//'
778 end
779
773 opt.undofile = true -- Persistently remember undos 780 opt.undofile = true -- Persistently remember undos
774 opt.undolevels = 1000 781 opt.undolevels = 1000
775 opt.undodir = home .. '/.config/nvim/tmp/undo//' 782 opt.undodir = optdir 'undo'
776 opt.swapfile = false -- Disable swap files 783 opt.swapfile = false -- Disable swap files
777 opt.backup = true -- Keep backups 784 opt.backup = true -- Keep backups
778 opt.backupdir = home .. '/.config/nvim/tmp/backup//' 785 opt.backupdir = optdir 'backup'
779 786
780 -- Files to ignore from completion 787 -- Files to ignore from completion
781 opt.wildignore:append { 788 opt.wildignore:append {
782 '*/tmp/*', 789 '*/tmp/*',
783 '*.so', 790 '*.so',