From 0ac3c4d6314df5fe40571a83e157a425ab7ce16d Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sat, 15 Jul 2023 16:55:32 +0100 Subject: docs(lua): move function docs to lua files --- runtime/lua/vim/_meta/regex.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 runtime/lua/vim/_meta/regex.lua (limited to 'runtime/lua/vim/_meta/regex.lua') diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua new file mode 100644 index 0000000000..afa78772da --- /dev/null +++ b/runtime/lua/vim/_meta/regex.lua @@ -0,0 +1,34 @@ +--- @meta + +--- @defgroup lua-regex +--- +--- @brief Vim regexes can be used directly from Lua. Currently they only allow +--- matching within a single line. + +--- Parse the Vim regex {re} and return 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 + +--- @class vim.regex +local regex = {} + +--- Match the string against the regex. If the string should match the regex +--- precisely, surround the regex with `^` and `$`. If the was a match, the +--- byte indices for the beginning and end of the match is returned. When +--- there is no match, `nil` is returned. As any integer is truth-y, +--- `regex:match()` can be directly used as a condition in an if-statement. +--- @param str string +function regex:match_str(str) end + +--- Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and {end} +--- are supplied, match only this byte index range. Otherwise see +--- |regex:match_str()|. If {start} is used, then the returned byte indices +--- will be relative {start}. +--- @param bufnr integer +--- @param line_idx integer +--- @param start? integer +--- @param end_? integer +function regex:match_line(bufnr, line_idx, start, end_) end -- cgit From c2d7c2826ca77b0ca31bec511fdcdf1e4abaf946 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 17 Jul 2023 15:13:54 +0100 Subject: docs(lua): change *lua-foo* -> *vim.foo* --- runtime/lua/vim/_meta/regex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta/regex.lua') diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua index afa78772da..0af1bccea5 100644 --- a/runtime/lua/vim/_meta/regex.lua +++ b/runtime/lua/vim/_meta/regex.lua @@ -1,6 +1,6 @@ --- @meta ---- @defgroup lua-regex +--- @defgroup vim.regex --- --- @brief Vim regexes can be used directly from Lua. Currently they only allow --- matching within a single line. -- cgit From 69d49727d7766d799aa1989bf67e763258b868e6 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 17 Jul 2023 16:32:56 +0100 Subject: fix: luacheck --- runtime/lua/vim/_meta/regex.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta/regex.lua') diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua index 0af1bccea5..4bca67797a 100644 --- a/runtime/lua/vim/_meta/regex.lua +++ b/runtime/lua/vim/_meta/regex.lua @@ -1,5 +1,7 @@ --- @meta +-- luacheck: no unused args + --- @defgroup vim.regex --- --- @brief Vim regexes can be used directly from Lua. Currently they only allow @@ -13,7 +15,7 @@ function vim.regex(re) end --- @class vim.regex -local regex = {} +local regex = {} -- luacheck: no unused --- Match the string against the regex. If the string should match the regex --- precisely, surround the regex with `^` and `$`. If the was a match, the -- cgit From b034378cf58bea18ea1bdb4d63692a1336b5752b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 3 Aug 2023 08:35:10 -0700 Subject: docs: luaref cleanup #24541 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - drop "luaref-" prefix in favor of "lua-" or nothing, where possible. - remove redundant "luaref--lang…" and "luaref-api…" tags. --- runtime/lua/vim/_meta/regex.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/_meta/regex.lua') diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua index 4bca67797a..ab4f46d43f 100644 --- a/runtime/lua/vim/_meta/regex.lua +++ b/runtime/lua/vim/_meta/regex.lua @@ -18,9 +18,9 @@ function vim.regex(re) end local regex = {} -- luacheck: no unused --- Match the string against the regex. If the string should match the regex ---- precisely, surround the regex with `^` and `$`. If the was a match, the ---- byte indices for the beginning and end of the match is returned. When ---- there is no match, `nil` is returned. As any integer is truth-y, +--- precisely, surround the regex with `^` and `$`. If there was a match, the +--- byte indices for the beginning and end of the match are returned. When +--- there is no match, `nil` is returned. Because any integer is "truthy", --- `regex:match()` can be directly used as a condition in an if-statement. --- @param str string function regex:match_str(str) end -- cgit From a6e74c1f0a2bbf03f5b99c167b549018f4c8fb0d Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 14 Sep 2023 06:05:27 +0200 Subject: docs: fix typos and other small fixes (#25005) Co-authored-by: nuid64 Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com> Co-authored-by: XTY Co-authored-by: Empa Co-authored-by: kyu08 <49891479+kyu08@users.noreply.github.com> --- runtime/lua/vim/_meta/regex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta/regex.lua') diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua index ab4f46d43f..58aa2be8c2 100644 --- a/runtime/lua/vim/_meta/regex.lua +++ b/runtime/lua/vim/_meta/regex.lua @@ -21,7 +21,7 @@ local regex = {} -- luacheck: no unused --- precisely, surround the regex with `^` and `$`. If there was a match, the --- byte indices for the beginning and end of the match are returned. When --- there is no match, `nil` is returned. Because any integer is "truthy", ---- `regex:match()` can be directly used as a condition in an if-statement. +--- `regex:match_str()` can be directly used as a condition in an if-statement. --- @param str string function regex:match_str(str) end -- cgit