Files
neovim/runtime/lua/vim/_meta/regex.lua
T
Justin M. Keyes 65b40e69ac fix(lua): not obvious which _meta/ files are generated #39035
Problem:
- Not obvious which _meta/ are generated and which should be edited
  manually.
- The require guard (`error('Cannot require a meta file')`) is not
  consistently present in all meta files.

Solution:
- Update headers.
- Add require() guard to all meta files.
- Rename generated meta files with `.gen.lua`.
2026-04-14 05:38:47 -04:00

40 lines
1.7 KiB
Lua

--- @meta
-- This file is NOT generated, edit it directly.
error('Cannot require a meta file')
-- luacheck: no unused args
--- @brief Vim regexes can be used directly from Lua. Currently they only allow
--- matching within a single line.
--- Parses the Vim regex `re` and returns a regex object. Regexes are "magic" and case-sensitive by
--- default, regardless of 'magic' and 'ignorecase'. They can be controlled with flags, see |/magic|
--- and |/ignorecase|.
--- @param re string
--- @return vim.regex
function vim.regex(re) end
--- @nodoc
--- @class vim.regex
local regex = {} -- luacheck: no unused
--- Matches string `str` against this regex. To match the string precisely, surround the regex with
--- "^" and "$". Returns the byte indices for the start and end of the match, or `nil` if there is
--- no match. Because any integer is "truthy", `regex:match_str()` can be directly used as
--- a condition in an if-statement.
--- @param str string
--- @return integer? # match start (byte index), or `nil` if no match
--- @return integer? # match end (byte index), or `nil` if no match
function regex:match_str(str) end
--- Matches line at `line_idx` (zero-based) in buffer `bufnr`. Match is restricted to byte index
--- range `start` and `end_` if given, otherwise see |regex:match_str()|. Returned byte indices are
--- relative to `start` if given.
--- @param bufnr integer
--- @param line_idx integer
--- @param start? integer
--- @param end_? integer
--- @return integer? # match start (byte index) relative to `start`, or `nil` if no match
--- @return integer? # match end (byte index) relative to `start`, or `nil` if no match
function regex:match_line(bufnr, line_idx, start, end_) end