From cbe513fca6dd294190538c48486f619efc7f79c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 24 Aug 2026 08:15:34 +0800 Subject: [PATCH] vim-patch:63d08d4: runtime(doc): update :h write-plugin and readdir() example 1) The complete example plugin at :h write-plugin the end of the documentation didn't reflect the snippets provided during the tutorial. In most of the Add() function, interpolated strings are used, but the final result used concatenated strings. 2) The example provided in readdir() to get a list of files ending in ".txt" didn't properly escape the dot in the regular expression: readdir(dirname, {n -> n =~ '.txt$'}) This would match any file ending with "txt" that is at least 4 characters long, instead it should be: readdir(dirname, {n -> n =~ '\.txt$'}) closes: vim/vim#21123 https://github.com/vim/vim/commit/63d08d43862ed195da78cfb1bebe2c0ed02f80b7 Co-authored-by: Josep Puigdemont --- runtime/doc/vimfn.txt | 2 +- runtime/lua/vim/_meta/vimfn.gen.lua | 2 +- src/nvim/eval.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index 26668fbb6e..19e3e4948b 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -8277,7 +8277,7 @@ readdir({directory} [, {expr}]) *readdir()* Each time {expr} is evaluated |v:val| is set to the entry name. When {expr} is a function the name is passed as the argument. For example, to get a list of files ending in ".txt": >vim - echo readdir(dirname, {n -> n =~ '.txt$'}) + echo readdir(dirname, {n -> n =~ '\.txt$'}) < To skip hidden and backup files: >vim echo readdir(dirname, {n -> n !~ '^\.\|\~$'}) diff --git a/runtime/lua/vim/_meta/vimfn.gen.lua b/runtime/lua/vim/_meta/vimfn.gen.lua index b42f17f9c7..8109219a3e 100644 --- a/runtime/lua/vim/_meta/vimfn.gen.lua +++ b/runtime/lua/vim/_meta/vimfn.gen.lua @@ -7425,7 +7425,7 @@ function vim.fn.readblob(fname, offset, size) end --- Each time {expr} is evaluated |v:val| is set to the entry name. --- When {expr} is a function the name is passed as the argument. --- For example, to get a list of files ending in ".txt": >vim ---- echo readdir(dirname, {n -> n =~ '.txt$'}) +--- echo readdir(dirname, {n -> n =~ '\.txt$'}) ---