mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
feat(fs): add vim.fs.basename()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user