mirror of
https://github.com/neovim/neovim.git
synced 2025-11-26 20:20:42 +00:00
docs: lsp, emoji, startup #33683
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
---
|
||||
--- >lua
|
||||
--- if vim.uv.fs_stat(file) then
|
||||
--- vim.print("file exists")
|
||||
--- vim.print('file exists')
|
||||
--- end
|
||||
--- <
|
||||
|
||||
@@ -19,21 +19,21 @@ local sysname = uv.os_uname().sysname:lower()
|
||||
local iswin = not not (sysname:find('windows') or sysname:find('mingw'))
|
||||
local os_sep = iswin and '\\' or '/'
|
||||
|
||||
--- Iterate over all the parents of the given path.
|
||||
--- Iterate over all the parents of the given path (not expanded/resolved, the caller must do that).
|
||||
---
|
||||
--- Example:
|
||||
---
|
||||
--- ```lua
|
||||
--- 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
|
||||
--- 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)
|
||||
--- print('Found git repository at', root_dir)
|
||||
--- end
|
||||
--- ```
|
||||
---
|
||||
@@ -55,7 +55,7 @@ function M.parents(start)
|
||||
start
|
||||
end
|
||||
|
||||
--- Return the parent directory of the given path
|
||||
--- Gets the parent directory of the given path (not expanded/resolved, the caller must do that).
|
||||
---
|
||||
---@since 10
|
||||
---@generic T : string|nil
|
||||
@@ -234,16 +234,17 @@ end
|
||||
--- Examples:
|
||||
---
|
||||
--- ```lua
|
||||
--- -- list all test directories under the runtime directory
|
||||
--- local test_dirs = vim.fs.find(
|
||||
--- {'test', 'tst', 'testdir'},
|
||||
--- {limit = math.huge, type = 'directory', path = './runtime/'}
|
||||
--- -- List all test directories under the runtime directory.
|
||||
--- local dirs = vim.fs.find(
|
||||
--- { 'test', 'tst', 'testdir' },
|
||||
--- { limit = math.huge, type = 'directory', path = './runtime/' }
|
||||
--- )
|
||||
---
|
||||
--- -- get all files ending with .cpp or .hpp inside lib/
|
||||
--- local cpp_hpp = vim.fs.find(function(name, path)
|
||||
--- -- Get all "lib/*.cpp" and "lib/*.hpp" files, using Lua patterns.
|
||||
--- -- Or use `vim.glob.to_lpeg(…):match(…)` for glob/wildcard matching.
|
||||
--- local files = vim.fs.find(function(name, path)
|
||||
--- return name:match('.*%.[ch]pp$') and path:match('[/\\]lib$')
|
||||
--- end, {limit = math.huge, type = 'file'})
|
||||
--- end, { limit = math.huge, type = 'file' })
|
||||
--- ```
|
||||
---
|
||||
---@since 10
|
||||
|
||||
Reference in New Issue
Block a user