diff options
author | Squibid <me@zacharyscheiman.com> | 2024-12-23 21:42:38 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-12-23 21:42:38 -0500 |
commit | 6d6568ecfdd8effb1486a2de85cd8cd1897df5cb (patch) | |
tree | fc97a5bb8aa22730ac6af2a6994fc766dd21b3e5 /README.md | |
parent | d6460d53ed47a536f98fcb8a6e6d6cf4cb8d97c3 (diff) | |
parent | 443a091e3e2b0c4fc0fdcaf00d878b1edc86ce91 (diff) | |
download | dep-6d6568ecfdd8effb1486a2de85cd8cd1897df5cb.tar.gz dep-6d6568ecfdd8effb1486a2de85cd8cd1897df5cb.tar.bz2 dep-6d6568ecfdd8effb1486a2de85cd8cd1897df5cb.zip |
Merge branch 'master' into dev
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 107 |
1 files changed, 8 insertions, 99 deletions
@@ -95,6 +95,10 @@ A package must be declared in the following format. -- Defaults to whatever the remote configured as their HEAD, which is usually "master". branch = "develop", + -- [string] Overrides the commit ref to target + -- Defaults to the latest commit on the current branch + commit = "e76cb03", + -- [boolean] Prevents the package from being loaded. disable = true, @@ -287,97 +291,6 @@ require "dep" { } ``` -## Separating code into modules - -Suppose you split your `init.lua` into two files `packages/search.lua` and -`packages/vcs.lua`, which declare the packages [telescope.nvim][6] and [vim-fugitive][7] respectively. - -```lua --- ~/.config/nvim/lua/packages/search.lua: -return { - { - "nvim-telescope/telescope.nvim", - requires = "nvim-lua/plenary.nvim" - } -} -``` - -```lua --- ~/.config/nvim/lua/packages/vcs.lua: -return { - "tpope/vim-fugitive" -} -``` - -Package specifications from other modules can be loaded using the `modules` option. - -```lua -require "dep" { - modules = { - prefix = "packages.", - "search", - "vcs" - } -} - --- the above is equivalent to -require "dep" { - modules = { - "packages.search", - "packages.vcs" - } -} - --- which is equivalent to -local packages = {} - -for _, package in ipairs(require "packages.search") do - table.insert(packages, package) -end - -for _, package in ipairs(require "packages.vcs") do - table.insert(packages, package) -end - -require("dep")(packages) - --- which is ultimately equivalent to -require "dep" { - { - "nvim-telescope/telescope.nvim", - requires = "nvim-lua/plenary.nvim" - }, - "tpope/vim-fugitive" -} - --- all of the above are guaranteed to load plenary.nvim before telescope.nvim. --- order of telescope.nvim and vim-fugitive is consistent but unspecified. -``` - -Entire modules can be marked as disabled, which disables all top-level packages declared in that module. - -```lua -return { - disable = true, - { - "user/package", - disabled = true, -- implied by module - requires = { - { - "user/dependency", - -- disabled = true -- not implied - } - }, - deps = { - { - "user/dependent", - disabled = true -- implied by dependency - } - } - } -} -``` - ## Miscellaneous configuration dep accepts configuration parameters as named fields in the package list. @@ -390,14 +303,10 @@ require "dep" { -- "always": synchronize all packages on startup sync = "new", - -- [array] Specifies the modules to load package specifications from. - -- Defaults to an empty table. - -- Items can be either an array of package specifications, - -- or a string that indicates the name of the module from which the array of package specifications is loaded. - modules = { - -- [string] Prefix string to prepend to all module names. - prefix = "", - }, + -- [function] Callback when dep is (re)loaded + -- if a table is returned it will be read as a table of config specs + load = function() + end -- list of package specs... } |