aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-11-04 20:40:30 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2020-02-26 19:39:02 +0100
commit9c00fea585ccab56a6044a174ce8d9a2c605c6cd (patch)
treebeee65c112ff5ca8af52f3189b84e33a596294f3 /runtime/doc/lua.txt
parent08af82b9cbd74016b96db0d133f8f85aa2960d0b (diff)
downloadrneovim-9c00fea585ccab56a6044a174ce8d9a2c605c6cd.tar.gz
rneovim-9c00fea585ccab56a6044a174ce8d9a2c605c6cd.tar.bz2
rneovim-9c00fea585ccab56a6044a174ce8d9a2c605c6cd.zip
lua: add regex support, and `@match` support in treesitter queries
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index c113a70027..800f24b5c9 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -693,6 +693,35 @@ identical identifiers, highlighting both as |hl-WarningMsg|: >
(eq? @WarningMsg.left @WarningMsg.right))
------------------------------------------------------------------------------
+VIM.REGEX *lua-regex*
+
+Vim regexes can be used directly from lua. Currently they only allow
+matching within a single line.
+
+vim.regex({re}) *vim.regex()*
+
+ Parse the regex {re} and return a regex object. 'magic' and
+ 'ignorecase' options are ignored, lua regexes always defaults to magic
+ and ignoring case. The behavior can be changed with flags in
+ the beginning of the string |/magic|.
+
+Regex objects support the following methods:
+
+regex:match_str({str}) *regex:match_str()*
+ 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.
+
+regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()*
+ 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}.
+
+------------------------------------------------------------------------------
VIM *lua-builtin*
vim.api.{func}({...}) *vim.api*