Configure packer_compiled.lua to be stored on XDG_DATA_DIRS

The `packer_compiled.lua` use a lot of values that only works on the host
where the file was compiled.

Put the compiled file on XDG_DATA_DIRS make easier use ~/.config/nvim to both
on Linux and Macos.
This commit is contained in:
Robson Roberto Souza Peixoto 2023-01-17 23:21:16 -03:00
parent 32744c3f66
commit 46ee50eff4
1 changed files with 17 additions and 1 deletions

View File

@ -7,7 +7,23 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
end end
require('packer').startup(function(use) -- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
return
end
local status_util_ok, util = pcall(require, "packer.util")
if not status_util_ok then
return
end
-- Have packer use a popup window
packer.init({
package_root = util.join_paths(vim.fn.stdpath('data'), 'site', 'pack'),
compile_path = util.join_paths(vim.fn.stdpath('data'), 'site', 'plugin', 'packer_compiled.lua'),
})
packer.startup(function(use)
-- Package manager -- Package manager
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'