mirror of
https://github.com/neovim/neovim.git
synced 2026-08-25 00:21:55 +00:00
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
63d08d4386
Co-authored-by: Josep Puigdemont <josep.puigdemont@gmail.com>
This commit is contained in:
@@ -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 !~ '^\.\|\~$'})
|
||||
|
||||
|
||||
2
runtime/lua/vim/_meta/vimfn.gen.lua
generated
2
runtime/lua/vim/_meta/vimfn.gen.lua
generated
@@ -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$'})
|
||||
--- <To skip hidden and backup files: >vim
|
||||
--- echo readdir(dirname, {n -> n !~ '^\.\|\~$'})
|
||||
---
|
||||
|
||||
@@ -8920,7 +8920,7 @@ M.funcs = {
|
||||
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 !~ '^\.\|\~$'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user