diff options
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r-- | runtime/doc/lua.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index dd1843ade3..8f74dca418 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2147,4 +2147,32 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* See also: ~ |nvim_set_keymap()| + +============================================================================== +Lua module: fs *lua-fs* + +parents({start}) *vim.fs.parents()* + Iterate over all the parents of the given file or directory. + + Example: > + + local root_dir + for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do + if vim.fn.isdirectory(dir .. "/.git") == 1 then + root_dir = dir + break + end + end + + if root_dir then + print("Found git repository at", root_dir) + end +< + + Parameters: ~ + {start} (string) Initial file or directory. + + Return: ~ + (function) Iterator + vim:tw=78:ts=8:ft=help:norl: |