aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-08-08 16:36:06 +0100
committerGitHub <noreply@github.com>2023-08-08 16:36:06 +0100
commitc6c21db82b31ea43ce878ab3725dcd901db1e7a1 (patch)
tree6002ddf7e9ef9d2ca40ef0029f501864ff43cbd9 /runtime/doc/lua.txt
parent61ed45486da01dca788f8a444fc2021002f0c947 (diff)
downloadrneovim-c6c21db82b31ea43ce878ab3725dcd901db1e7a1.tar.gz
rneovim-c6c21db82b31ea43ce878ab3725dcd901db1e7a1.tar.bz2
rneovim-c6c21db82b31ea43ce878ab3725dcd901db1e7a1.zip
fix(filetype): add typing and dry (#24573)
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index efde69c8f4..c3e540a4ae 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -2654,10 +2654,10 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
['.*'] = {
priority = -math.huge,
function(path, bufnr)
- local content = vim.filetype.getlines(bufnr, 1)
- if vim.filetype.matchregex(content, [[^#!.*\<mine\>]]) then
+ local content = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] or ''
+ if vim.regex([[^#!.*\<mine\>]]):match_str(content) ~= nil then
return 'mine'
- elseif vim.filetype.matchregex(content, [[\<drawing\>]]) then
+ elseif vim.regex([[\<drawing\>]]):match_str(content) ~= nil then
return 'drawing'
end
end,