aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-06 21:19:12 +0800
committerGitHub <noreply@github.com>2024-08-06 21:19:12 +0800
commit37952bf7b442cac794c4663f2e0123e7d72bc443 (patch)
treeae4330a07d6b1c0635d61d64f4e22d61901e6de1 /src/nvim/eval.lua
parent28fbba2092adb9659253434605cb94252241f5e0 (diff)
downloadrneovim-37952bf7b442cac794c4663f2e0123e7d72bc443.tar.gz
rneovim-37952bf7b442cac794c4663f2e0123e7d72bc443.tar.bz2
rneovim-37952bf7b442cac794c4663f2e0123e7d72bc443.zip
vim-patch:8.2.4838: checking for absolute path is not trivial (#29990)
Problem: Checking for absolute path is not trivial. Solution: Add isabsolutepath(). (closes vim/vim#10303) https://github.com/vim/vim/commit/dca1d40cd0f2af0755519e7028378bd3c8fefd31 vim-patch:8a3b805c6c9c Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r--src/nvim/eval.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 430ee20081..0a003f3b84 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -5686,6 +5686,30 @@ M.funcs = {
params = { { 'expr', 'any' } },
signature = 'invert({expr})',
},
+ isabsolutepath = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ The result is a Number, which is |TRUE| when {path} is an
+ absolute path.
+ On Unix, a path is considered absolute when it starts with '/'.
+ On MS-Windows, it is considered absolute when it starts with an
+ optional drive prefix and is followed by a '\' or '/'. UNC paths
+ are always absolute.
+ Example: >vim
+ echo isabsolutepath('/usr/share/') " 1
+ echo isabsolutepath('./foobar') " 0
+ echo isabsolutepath('C:\Windows') " 1
+ echo isabsolutepath('foobar') " 0
+ echo isabsolutepath('\\remote\file') " 1
+ <
+ ]=],
+ fast = true,
+ name = 'isabsolutepath',
+ params = { { 'path', 'any' } },
+ returns = '0|1',
+ signature = 'isabsolutepath({path})',
+ },
isdirectory = {
args = 1,
base = 1,