Merge branch 'folke:main' into otherPossibility

This commit is contained in:
Birdee 2024-01-20 14:26:45 -08:00 committed by GitHub
commit c7559279d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 33 additions and 20 deletions

View file

@ -320,7 +320,7 @@ return {
filter = true, filter = true,
}, },
dev = { dev = {
-- directory where you store your local plugin projects ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
path = "~/projects", path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"} patterns = {}, -- For example {"folke"}
@ -666,7 +666,7 @@ In practice this means that step 10 of [Neovim Initialization](https://neovim.io
1. All the plugins' `init()` functions are executed 1. All the plugins' `init()` functions are executed
2. All plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet) 2. All plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet)
3. All files from `/plugin` and `/ftdetect` directories in you rtp are sourced (excluding `/after`) 3. All files from `/plugin` and `/ftdetect` directories in your rtp are sourced (excluding `/after`)
4. All `/after/plugin` files are sourced (this includes `/after` from plugins) 4. All `/after/plugin` files are sourced (this includes `/after` from plugins)
Files from runtime directories are always sourced in alphabetical order. Files from runtime directories are always sourced in alphabetical order.
@ -750,8 +750,8 @@ Any other property will override the property from the parent spec.
- `lock` ➡️ `pin` - `lock` ➡️ `pin`
- `disable=true` ➡️ `enabled = false` - `disable=true` ➡️ `enabled = false`
- `tag='*'` ➡️ `version="*"` - `tag='*'` ➡️ `version="*"`
- `after` **_not needed_** for most use-cases. Use `dependencies` otherwise. - `after` is **_not needed_** for most use-cases. Use `dependencies` otherwise.
- `wants` **_not needed_** for most use-cases. Use `dependencies` otherwise. - `wants` is **_not needed_** for most use-cases. Use `dependencies` otherwise.
- `config` don't support string type, use `fun(LazyPlugin)` instead. - `config` don't support string type, use `fun(LazyPlugin)` instead.
- `module` is auto-loaded. No need to specify - `module` is auto-loaded. No need to specify
- `keys` spec is [different](#%EF%B8%8F-lazy-key-mappings) - `keys` spec is [different](#%EF%B8%8F-lazy-key-mappings)
@ -836,7 +836,7 @@ To uninstall **lazy.nvim**, you need to remove the following files and directori
If your plugin needs a build step, you can create a file `build.lua` or `build/init.lua` If your plugin needs a build step, you can create a file `build.lua` or `build/init.lua`
in the root of your repo. This file will be loaded when the plugin is installed or updated. in the root of your repo. This file will be loaded when the plugin is installed or updated.
This makes it easier for users, so they no longer need to specify a `build` command. This makes it easier for users, as they no longer need to specify a `build` command.
## 📦 Other Neovim Plugin Managers in Lua ## 📦 Other Neovim Plugin Managers in Lua

View file

@ -1,4 +1,4 @@
*lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 November 04 *lazy.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 January 20
============================================================================== ==============================================================================
Table of Contents *lazy.nvim-table-of-contents* Table of Contents *lazy.nvim-table-of-contents*
@ -423,7 +423,7 @@ CONFIGURATION *lazy.nvim-lazy.nvim-configuration*
filter = true, filter = true,
}, },
dev = { dev = {
-- directory where you store your local plugin projects ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
path = "~/projects", path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"} patterns = {}, -- For example {"folke"}
@ -768,7 +768,7 @@ In practice this means that step 10 of |Neovim Initialization| is done by Lazy:
1. All the plugins `init()` functions are executed 1. All the plugins `init()` functions are executed
2. All plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet) 2. All plugins with `lazy=false` are loaded. This includes sourcing `/plugin` and `/ftdetect` files. (`/after` will not be sourced yet)
3. All files from `/plugin` and `/ftdetect` directories in you rtp are sourced (excluding `/after`) 3. All files from `/plugin` and `/ftdetect` directories in your rtp are sourced (excluding `/after`)
4. All `/after/plugin` files are sourced (this includes `/after` from plugins) 4. All `/after/plugin` files are sourced (this includes `/after` from plugins)
Files from runtime directories are always sourced in alphabetical order. Files from runtime directories are always sourced in alphabetical order.
@ -859,8 +859,8 @@ PACKER.NVIM ~
- `lock` `pin` - `lock` `pin`
- `disable=true` `enabled = false` - `disable=true` `enabled = false`
- `tag='*'` `version="*"` - `tag='*'` `version="*"`
- `after` **not needed** for most use-cases. Use `dependencies` otherwise. - `after` is **not needed** for most use-cases. Use `dependencies` otherwise.
- `wants` **not needed** for most use-cases. Use `dependencies` otherwise. - `wants` is **not needed** for most use-cases. Use `dependencies` otherwise.
- `config` dont support string type, use `fun(LazyPlugin)` instead. - `config` dont support string type, use `fun(LazyPlugin)` instead.
- `module` is auto-loaded. No need to specify - `module` is auto-loaded. No need to specify
- `keys` spec is |lazy.nvim-different| - `keys` spec is |lazy.nvim-different|
@ -979,7 +979,7 @@ If your plugin needs a build step, you can create a file `build.lua` or
`build/init.lua` in the root of your repo. This file will be loaded when the `build/init.lua` in the root of your repo. This file will be loaded when the
plugin is installed or updated. plugin is installed or updated.
This makes it easier for users, so they no longer need to specify a `build` This makes it easier for users, as they no longer need to specify a `build`
command. command.

View file

@ -30,7 +30,7 @@ M.defaults = {
filter = true, filter = true,
}, },
dev = { dev = {
-- directory where you store your local plugin projects ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
path = "~/projects", path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"} patterns = {}, -- For example {"folke"}
@ -225,7 +225,9 @@ function M.setup(opts)
table.insert(M.options.install.colorscheme, "habamax") table.insert(M.options.install.colorscheme, "habamax")
M.options.root = Util.norm(M.options.root) M.options.root = Util.norm(M.options.root)
if type(M.options.dev.path) == "string" then
M.options.dev.path = Util.norm(M.options.dev.path) M.options.dev.path = Util.norm(M.options.dev.path)
end
M.options.lockfile = Util.norm(M.options.lockfile) M.options.lockfile = Util.norm(M.options.lockfile)
M.options.readme.root = Util.norm(M.options.readme.root) M.options.readme.root = Util.norm(M.options.readme.root)

View file

@ -41,6 +41,11 @@ function M.parse(value, mode)
ret.mode = mode or "n" ret.mode = mode or "n"
ret.id = vim.api.nvim_replace_termcodes(ret.lhs, true, true, true) ret.id = vim.api.nvim_replace_termcodes(ret.lhs, true, true, true)
if ret.ft then
local ft = type(ret.ft) == "string" and { ret.ft } or ret.ft --[[@as string[] ]]
ret.id = ret.id .. " (" .. table.concat(ft, ", ") .. ")"
end
if ret.mode ~= "n" then if ret.mode ~= "n" then
ret.id = ret.id .. " (" .. ret.mode .. ")" ret.id = ret.id .. " (" .. ret.mode .. ")"
end end

View file

@ -106,11 +106,16 @@ function Spec:add(plugin, results)
end end
-- dev plugins -- dev plugins
if if plugin.dev then
plugin.dev local dir_dev
and (not Config.options.dev.fallback or vim.fn.isdirectory(Config.options.dev.path .. "/" .. plugin.name) == 1) if type(Config.options.dev.path) == "string" then
then dir_dev = Config.options.dev.path .. "/" .. plugin.name
dir = Config.options.dev.path .. "/" .. plugin.name else
dir_dev = Util.norm(Config.options.dev.path(plugin))
end
if not Config.options.dev.fallback or vim.fn.isdirectory(dir_dev) == 1 then
dir = dir_dev
end
elseif plugin.dev == false then elseif plugin.dev == false then
-- explicitely select the default path -- explicitely select the default path
dir = Config.options.root .. "/" .. plugin.name dir = Config.options.root .. "/" .. plugin.name

View file

@ -131,6 +131,7 @@ M.valid = {
"opts", "opts",
"pin", "pin",
"priority", "priority",
"submodules",
"tag", "tag",
"url", "url",
"version", "version",

View file

@ -217,7 +217,7 @@ function M.get_config(repo)
current_section = section:gsub('%s+"', "."):gsub('"+%s*$', "") current_section = section:gsub('%s+"', "."):gsub('"+%s*$', "")
else else
-- Ignore comments and blank lines -- Ignore comments and blank lines
if not line:match("^%s*#") and line:match("%S") then if not line:match("^%s*[#;]") and line:match("%S") then
local key, value = line:match("^%s*(%S+)%s*=%s*(.+)%s*$") local key, value = line:match("^%s*(%S+)%s*=%s*(.+)%s*$")
ret[current_section .. "." .. key] = value ret[current_section .. "." .. key] = value
end end

View file

@ -13,7 +13,7 @@ M.clean = {
assert(dir:find(Config.options.root, 1, true) == 1, self.plugin.dir .. " should be under packpath!") assert(dir:find(Config.options.root, 1, true) == 1, self.plugin.dir .. " should be under packpath!")
local stat = vim.loop.fs_lstat(dir) local stat = vim.loop.fs_lstat(dir)
assert(stat.type == "directory", self.plugin.dir .. " should be a directory!") assert(stat and stat.type == "directory", self.plugin.dir .. " should be a directory!")
Util.walk(dir, function(path, _, type) Util.walk(dir, function(path, _, type)
if type == "directory" then if type == "directory" then