From 46ee50eff4a5612bc075e68151c88b2856d67025 Mon Sep 17 00:00:00 2001 From: Robson Roberto Souza Peixoto Date: Tue, 17 Jan 2023 23:21:16 -0300 Subject: [PATCH] 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. --- init.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ac291dad..c12a50dc 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,23 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd [[packadd packer.nvim]] 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 use 'wbthomason/packer.nvim'