diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-08-06 21:19:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 21:19:12 +0800 |
commit | 37952bf7b442cac794c4663f2e0123e7d72bc443 (patch) | |
tree | ae4330a07d6b1c0635d61d64f4e22d61901e6de1 /runtime/lua/vim/_meta/vimfn.lua | |
parent | 28fbba2092adb9659253434605cb94252241f5e0 (diff) | |
download | rneovim-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 'runtime/lua/vim/_meta/vimfn.lua')
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 4f9cc881c1..9cddf0e81f 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -4659,6 +4659,24 @@ function vim.fn.interrupt() end --- @return any function vim.fn.invert(expr) end +--- 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 +--- < +--- +--- @param path any +--- @return 0|1 +function vim.fn.isabsolutepath(path) end + --- The result is a Number, which is |TRUE| when a directory --- with the name {directory} exists. If {directory} doesn't --- exist, or isn't a directory, the result is |FALSE|. {directory} |