mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
docs(api): nvim_get_runtime_file preserves 'runtimepath' order #30454
This commit is contained in:

committed by
GitHub

parent
e697c1b43d
commit
29bceb4f75
@@ -954,11 +954,11 @@ nvim_get_proc_children({pid}) *nvim_get_proc_children()*
|
|||||||
Array of child process ids, empty if process not found.
|
Array of child process ids, empty if process not found.
|
||||||
|
|
||||||
nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
|
nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
|
||||||
Find files in runtime directories
|
Finds files in runtime directories, in 'runtimepath' order.
|
||||||
|
|
||||||
"name" can contain wildcards. For example
|
"name" can contain wildcards. For example
|
||||||
nvim_get_runtime_file("colors/*.vim", true) will return all color scheme
|
`nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color
|
||||||
files. Always use forward slashes (/) in the search pattern for
|
scheme files. Always use forward slashes (/) in the search pattern for
|
||||||
subdirectories regardless of platform.
|
subdirectories regardless of platform.
|
||||||
|
|
||||||
It is not an error to not find any files. An empty array is returned then.
|
It is not an error to not find any files. An empty array is returned then.
|
||||||
|
6
runtime/lua/vim/_meta/api.lua
generated
6
runtime/lua/vim/_meta/api.lua
generated
@@ -1454,11 +1454,11 @@ function vim.api.nvim_get_proc(pid) end
|
|||||||
--- @return any[]
|
--- @return any[]
|
||||||
function vim.api.nvim_get_proc_children(pid) end
|
function vim.api.nvim_get_proc_children(pid) end
|
||||||
|
|
||||||
--- Find files in runtime directories
|
--- Finds files in runtime directories, in 'runtimepath' order.
|
||||||
---
|
---
|
||||||
--- "name" can contain wildcards. For example
|
--- "name" can contain wildcards. For example
|
||||||
--- nvim_get_runtime_file("colors/*.vim", true) will return all color scheme
|
--- `nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color
|
||||||
--- files. Always use forward slashes (/) in the search pattern for
|
--- scheme files. Always use forward slashes (/) in the search pattern for
|
||||||
--- subdirectories regardless of platform.
|
--- subdirectories regardless of platform.
|
||||||
---
|
---
|
||||||
--- It is not an error to not find any files. An empty array is returned then.
|
--- It is not an error to not find any files. An empty array is returned then.
|
||||||
|
@@ -573,10 +573,10 @@ typedef struct {
|
|||||||
Arena *arena;
|
Arena *arena;
|
||||||
} RuntimeCookie;
|
} RuntimeCookie;
|
||||||
|
|
||||||
/// Find files in runtime directories
|
/// Finds files in runtime directories, in 'runtimepath' order.
|
||||||
///
|
///
|
||||||
/// "name" can contain wildcards. For example
|
/// "name" can contain wildcards. For example
|
||||||
/// nvim_get_runtime_file("colors/*.vim", true) will return all color
|
/// `nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color
|
||||||
/// scheme files. Always use forward slashes (/) in the search pattern for
|
/// scheme files. Always use forward slashes (/) in the search pattern for
|
||||||
/// subdirectories regardless of platform.
|
/// subdirectories regardless of platform.
|
||||||
///
|
///
|
||||||
|
@@ -3307,6 +3307,16 @@ describe('API', function()
|
|||||||
exc_exec("echo nvim_get_runtime_file('{', v:false)")
|
exc_exec("echo nvim_get_runtime_file('{', v:false)")
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
it('preserves order of runtimepath', function()
|
||||||
|
local vimruntime = fn.getenv('VIMRUNTIME')
|
||||||
|
local rtp = string.format('%s/syntax,%s/ftplugin', vimruntime, vimruntime)
|
||||||
|
api.nvim_set_option_value('runtimepath', rtp, {})
|
||||||
|
|
||||||
|
local val = api.nvim_get_runtime_file('vim.vim', true)
|
||||||
|
eq(2, #val)
|
||||||
|
eq(p(val[1]), vimruntime .. '/syntax/vim.vim')
|
||||||
|
eq(p(val[2]), vimruntime .. '/ftplugin/vim.vim')
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('nvim_get_all_options_info', function()
|
describe('nvim_get_all_options_info', function()
|
||||||
|
Reference in New Issue
Block a user