Skip to content

Commit f03c6bc

Browse files
committed
docs(lockfile): Add lockfile info to readme
1 parent 32669a3 commit f03c6bc

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Have a problem or idea? Make an [issue](https://github.com/wbthomason/packer.nvi
2424
4. [Performing plugin management operations](#performing-plugin-management-operations)
2525
5. [Extending packer](#extending-packer)
2626
6. [Compiling Lazy-Loaders](#compiling-lazy-loaders)
27-
7. [User autocommands](#user-autocommands)
28-
8. [Using a floating window](#using-a-floating-window)
27+
7. [Lockfile](#lockfile)
28+
8. [User autocommands](#user-autocommands)
29+
9. [Using a floating window](#using-a-floating-window)
2930
7. [Profiling](#profiling)
3031
8. [Debugging](#debugging)
3132
9. [Status](#status)
@@ -58,6 +59,7 @@ Have a problem or idea? Make an [issue](https://github.com/wbthomason/packer.nvi
5859
- Uses jobs for async installation
5960
- Support for `git` tags, branches, revisions, submodules
6061
- Support for local plugins
62+
- Lockfile for for keeping plugins in sync between systems
6163

6264
## Requirements
6365
- **You need to be running Neovim v0.5.0+**; `packer` makes use of extmarks and other newly-added Neovim
@@ -193,8 +195,14 @@ end)
193195
-- Perform `PackerUpdate` and then `PackerCompile`
194196
:PackerSync
195197
198+
-- Perform `PackerUpdate` without lockfile.
199+
:PackerUpgrade
200+
196201
-- Loads opt plugin immediately
197202
:PackerLoad completion-nvim ale
203+
204+
-- Updates lockfile from installed plugins.
205+
:PackerLockfile
198206
```
199207

200208
You can configure Neovim to automatically run `:PackerCompile` whenever `plugins.lua` is updated with
@@ -339,6 +347,11 @@ default configuration values (and structure of the configuration table) are:
339347
prompt_revert = 'r',
340348
}
341349
},
350+
lockfile = {
351+
enable = false, -- Should packer apply lockfile to `installer` and `updater`
352+
path = util.join_paths(stdpath 'config', 'lockfile.lua'), -- Default file location for lockfile
353+
update_on_upgrade = false, -- Should packer update the lockfile after upgrading plugins
354+
},
342355
luarocks = {
343356
python_cmd = 'python' -- Set the python command to use for running hererocks
344357
},
@@ -521,7 +534,9 @@ plugins":
521534
- `packer.update(plugins)`: Update the specified plugins, installing any that are missing
522535
- `packer.clean()`: Remove any disabled or no longer managed plugins
523536
- `packer.sync(plugins)`: Perform a `clean` followed by an `update`
537+
- `packer.upgrade(plugins)`: Performs an `update` without applying the lockfile
524538
- `packer.compile(path)`: Compile lazy-loader code and save to `path`.
539+
- `packer.lockfile()`: Updates lockfile based on currently installed plugins
525540
- `packer.snapshot(snapshot_name, ...)`: Creates a snapshot file that will live under `config.snapshot_path/<snapshot_name>`. If `snapshot_name` is an absolute path, then that will be the location where the snapshot will be taken. Optionally, a list of plugins name can be provided to selectively choose the plugins to snapshot.
526541
- `packer.rollback(snapshot_name, ...)`: Rollback plugins status a snapshot file that will live under `config.snapshot_path/<snapshot_name>`. If `snapshot_name` is an absolute path, then that will be the location where the snapshot will be taken. Optionally, a list of plugins name can be provided to selectively choose which plugins to revert.
527542
- `packer.delete(snapshot_name)`: Deletes a snapshot file under `config.snapshot_path/<snapshot_name>`. If `snapshot_name` is an absolute path, then that will be the location where the snapshot will be deleted.
@@ -556,12 +571,18 @@ config/setup functions to bytecode, which has this limitation.
556571
Additionally, if functions are given for these keys, the functions will be passed the plugin
557572
name and information table as arguments.
558573

574+
### Lockfile
575+
576+
`packer` provides a `lockfile` to help manage plugin updates. This is useful for users that store their
577+
configuration in some sort of source repository. Committing packer's lockfile will ensure that packer will
578+
`install` and `update` plugins to known working commits for their configuration.
579+
559580
### User autocommands
560581
`packer` runs most of its operations asyncronously. If you would like to implement automations that
561582
require knowing when the operations are complete, you can use the following `User` autocmds (see
562583
`:help User` for more info on how to use):
563584

564-
- `PackerComplete`: Fires after install, update, clean, and sync asynchronous operations finish.
585+
- `PackerComplete`: Fires after install, update, clean, sync, and upgrade asynchronous operations finish.
565586
- `PackerCompileDone`: Fires after compiling (see [the section on compilation](#compiling-lazy-loaders))
566587

567588
### Using a floating window

0 commit comments

Comments
 (0)