From a4b27cb9aec6603378007453fc31012755a18bdd Mon Sep 17 00:00:00 2001 From: Zaiju Date: Sat, 10 Jun 2023 13:19:35 +1000 Subject: [PATCH 1/2] Fix issues with the packer.init config example There were two issues I noticed with this. One was invalid function calls (`stdpath` instead of `vim.fn.stdpath`) and using undefined modules (`util.join_paths`). The other was having the table represented in absence of context. Am I meant to pass it to packer.init()? Return it like the example from packer.startup()? I've fixed the functions and added the needed require statements. I've also added how I believe it is meant to be passed to the packer.init() making it a drop in example. --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e1a3c412f..336b3a2d8 100644 --- a/README.md +++ b/README.md @@ -282,12 +282,15 @@ specification code (e.g. by sourcing your plugin specification file with `luafil You may pass a table of configuration values to `packer.init()` to customize its operation. The default configuration values (and structure of the configuration table) are: ```lua -{ - ensure_dependencies = true, -- Should packer install plugin dependencies? +local packer = require('packer') +packer.util = require('packer.util') + +packer.init({ + ensure_dependencies = true, -- Should packer install plugin dependencies? snapshot = nil, -- Name of the snapshot you would like to load at startup - snapshot_path = join_paths(stdpath 'cache', 'packer.nvim'), -- Default save directory for snapshots - package_root = util.join_paths(vim.fn.stdpath('data'), 'site', 'pack'), - compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer_compiled.lua'), + snapshot_path = packer.util.join_paths(vim.fn.stdpath 'cache', 'packer.nvim'), -- Default save directory for snapshots + package_root = packer.util.join_paths(vim.fn.stdpath('data'), 'site', 'pack'), + compile_path = packer.util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer_compiled.lua'), plugin_package = 'packer', -- The default package for plugins max_jobs = nil, -- Limit the number of simultaneous jobs. nil means no limit auto_clean = true, -- During sync(), remove unused plugins @@ -348,7 +351,7 @@ default configuration values (and structure of the configuration table) are: threshold = 1, -- integer in milliseconds, plugins which load faster than this won't be shown in profile output }, autoremove = false, -- Remove disabled or unused plugins without prompting the user -} +}) ``` ### Specifying plugins From efe1204f04fd10304dc56633203715a53b31ca05 Mon Sep 17 00:00:00 2001 From: Zaiju Date: Sat, 10 Jun 2023 13:25:31 +1000 Subject: [PATCH 2/2] Make function call consistent. Just adjusting the indent and use of (). --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 336b3a2d8..a63a5b35b 100644 --- a/README.md +++ b/README.md @@ -288,9 +288,9 @@ packer.util = require('packer.util') packer.init({ ensure_dependencies = true, -- Should packer install plugin dependencies? snapshot = nil, -- Name of the snapshot you would like to load at startup - snapshot_path = packer.util.join_paths(vim.fn.stdpath 'cache', 'packer.nvim'), -- Default save directory for snapshots - package_root = packer.util.join_paths(vim.fn.stdpath('data'), 'site', 'pack'), - compile_path = packer.util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer_compiled.lua'), + snapshot_path = packer.util.join_paths(vim.fn.stdpath('cache'), 'packer.nvim'), -- Default save directory for snapshots + package_root = packer.util.join_paths(vim.fn.stdpath('data'), 'site', 'pack'), + compile_path = packer.util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer_compiled.lua'), plugin_package = 'packer', -- The default package for plugins max_jobs = nil, -- Limit the number of simultaneous jobs. nil means no limit auto_clean = true, -- During sync(), remove unused plugins