mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 12:38:33 +00:00
docs(glob): add glob module (#26853)
This commit is contained in:

committed by
GitHub

parent
2bf68df289
commit
5dc0bdfe98
@@ -2990,6 +2990,33 @@ vim.fs.parents({start}) *vim.fs.parents()*
|
|||||||
(string|nil)
|
(string|nil)
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Lua module: vim.glob *vim.glob*
|
||||||
|
|
||||||
|
vim.glob.to_lpeg({pattern}) *vim.glob.to_lpeg()*
|
||||||
|
Parses a raw glob into an |lua-lpeg| pattern.
|
||||||
|
|
||||||
|
This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
|
||||||
|
|
||||||
|
Glob patterns can have the following syntax:
|
||||||
|
• `*` to match one or more characters in a path segment
|
||||||
|
• `?` to match on one character in a path segment
|
||||||
|
• `**` to match any number of path segments, including none
|
||||||
|
• `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and
|
||||||
|
JavaScript files)
|
||||||
|
• `[]` to declare a range of characters to match in a path segment (e.g.,
|
||||||
|
`example.[0-9]` to match on `example.0`, `example.1`, …)
|
||||||
|
• `[!...]` to negate a range of characters to match in a path segment
|
||||||
|
(e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not
|
||||||
|
`example.0`)
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {pattern} (string) The raw glob pattern
|
||||||
|
|
||||||
|
Return: ~
|
||||||
|
vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Lua module: vim.secure *vim.secure*
|
Lua module: vim.secure *vim.secure*
|
||||||
|
|
||||||
|
@@ -2,18 +2,20 @@ local lpeg = vim.lpeg
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
--- Parses a raw glob into an |lpeg| pattern.
|
--- Parses a raw glob into an |lua-lpeg| pattern.
|
||||||
---
|
---
|
||||||
--- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
|
--- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
|
||||||
|
---
|
||||||
--- Glob patterns can have the following syntax:
|
--- Glob patterns can have the following syntax:
|
||||||
--- `*` to match one or more characters in a path segment
|
--- - `*` to match one or more characters in a path segment
|
||||||
--- `?` to match on one character in a path segment
|
--- - `?` to match on one character in a path segment
|
||||||
--- `**` to match any number of path segments, including none
|
--- - `**` to match any number of path segments, including none
|
||||||
--- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
|
--- - `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and JavaScript files)
|
||||||
--- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
|
--- - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
|
||||||
--- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
|
--- - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
|
||||||
|
---
|
||||||
---@param pattern string The raw glob pattern
|
---@param pattern string The raw glob pattern
|
||||||
---@return vim.lpeg.Pattern pattern An |lpeg| representation of the pattern
|
---@return vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern
|
||||||
function M.to_lpeg(pattern)
|
function M.to_lpeg(pattern)
|
||||||
local l = lpeg
|
local l = lpeg
|
||||||
|
|
||||||
|
@@ -164,6 +164,7 @@ CONFIG = {
|
|||||||
'filetype.lua',
|
'filetype.lua',
|
||||||
'keymap.lua',
|
'keymap.lua',
|
||||||
'fs.lua',
|
'fs.lua',
|
||||||
|
'glob.lua',
|
||||||
'secure.lua',
|
'secure.lua',
|
||||||
'version.lua',
|
'version.lua',
|
||||||
'iter.lua',
|
'iter.lua',
|
||||||
@@ -187,6 +188,7 @@ CONFIG = {
|
|||||||
'runtime/lua/vim/_inspector.lua',
|
'runtime/lua/vim/_inspector.lua',
|
||||||
'runtime/lua/vim/snippet.lua',
|
'runtime/lua/vim/snippet.lua',
|
||||||
'runtime/lua/vim/text.lua',
|
'runtime/lua/vim/text.lua',
|
||||||
|
'runtime/lua/vim/glob.lua',
|
||||||
'runtime/lua/vim/_meta/builtin.lua',
|
'runtime/lua/vim/_meta/builtin.lua',
|
||||||
'runtime/lua/vim/_meta/diff.lua',
|
'runtime/lua/vim/_meta/diff.lua',
|
||||||
'runtime/lua/vim/_meta/mpack.lua',
|
'runtime/lua/vim/_meta/mpack.lua',
|
||||||
@@ -251,6 +253,7 @@ CONFIG = {
|
|||||||
'spell': 'vim.spell',
|
'spell': 'vim.spell',
|
||||||
'snippet': 'vim.snippet',
|
'snippet': 'vim.snippet',
|
||||||
'text': 'vim.text',
|
'text': 'vim.text',
|
||||||
|
'glob': 'vim.glob',
|
||||||
},
|
},
|
||||||
'append_only': [
|
'append_only': [
|
||||||
'shared.lua',
|
'shared.lua',
|
||||||
|
Reference in New Issue
Block a user