aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2022-11-05 13:37:05 -0600
committerGregory Anders <greg@gpanders.com>2022-11-17 08:23:41 -0700
commitf1922e78a1df1b1d32779769432fb5586edf5fbb (patch)
treec80eece970f5b42cf04ad2161a655f33638ec7ce /runtime/doc
parent9736605672e8648bbe8739a6fdd1c315183bce40 (diff)
downloadrneovim-f1922e78a1df1b1d32779769432fb5586edf5fbb.tar.gz
rneovim-f1922e78a1df1b1d32779769432fb5586edf5fbb.tar.bz2
rneovim-f1922e78a1df1b1d32779769432fb5586edf5fbb.zip
feat: add vim.secure.read()
This function accepts a path to a file and prompts the user if the file is trusted. If the user confirms that the file is trusted, the contents of the file are returned. The user's decision is stored in a trust database at $XDG_STATE_HOME/nvim/trust. When this function is invoked with a path that is already marked as trusted in the trust database, the user is not prompted for a response.
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt16
-rw-r--r--runtime/doc/news.txt3
2 files changed, 19 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index cab2f49d94..c5ede97725 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -2354,4 +2354,20 @@ parents({start}) *vim.fs.parents()*
Return: ~
(function) Iterator
+
+==============================================================================
+Lua module: secure *lua-secure*
+
+read({path}) *vim.secure.read()*
+ Attempt to read the file at {path} prompting the user if the file should
+ be trusted. The user's choice is persisted in a trust database at
+ $XDG_STATE_HOME/nvim/trust.
+
+ Parameters: ~
+ • {path} (string) Path to a file to read.
+
+ Return: ~
+ (string|nil) The contents of the given file if it exists and is
+ trusted, or nil otherwise.
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index d339df8479..2aa4bea73b 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -39,6 +39,9 @@ NEW FEATURES *news-features*
The following new APIs or features were added.
+• |vim.secure.read()| reads a file and prompts the user if it should be
+ trusted and, if so, returns the file's contents.
+
• When using Nvim inside tmux 3.2 or later, the default clipboard provider
will now copy to the system clipboard. |provider-clipboard|