aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/fs.lua
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2022-05-15 19:55:18 -0600
committerGregory Anders <greg@gpanders.com>2022-05-31 13:04:41 -0600
commitb740709431f5e68dac5238d455f9f86d5a564f36 (patch)
tree0df53aec490c87343dd7b15addf46f2c694d08c7 /runtime/lua/vim/fs.lua
parentc5526a27c3b61acb33b7c3c3fe518d8f1e0b602f (diff)
downloadrneovim-b740709431f5e68dac5238d455f9f86d5a564f36.tar.gz
rneovim-b740709431f5e68dac5238d455f9f86d5a564f36.tar.bz2
rneovim-b740709431f5e68dac5238d455f9f86d5a564f36.zip
feat(fs): add vim.fs.basename()
Diffstat (limited to 'runtime/lua/vim/fs.lua')
-rw-r--r--runtime/lua/vim/fs.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index a3b7321cc9..29ce394a38 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -40,4 +40,12 @@ function M.dirname(file)
return vim.fn.fnamemodify(file, ':h')
end
+--- Return the basename of the given file or directory
+---
+---@param file (string) File or directory
+---@return (string) Basename of {file}
+function M.basename(file)
+ return vim.fn.fnamemodify(file, ':t')
+end
+
return M