Skip to main content
Module

x/denops_std/function/mod.ts>simplify

📚 Standard module for denops.vim
Go to Latest
function simplify
import { simplify } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Simplify the file name as much as possible without changing the meaning. Shortcuts (on MS-Windows) or symbolic links (on Unix) are not resolved. If the first path component in {filename} designates the current directory, this will be valid for the result as well. A trailing path separator is not removed either. On Unix "//path" is unchanged, but "///path" is simplified to "/path" (this follows the Posix standard). Example:

simplify("./dir/.././/file/") == "./file/"

Note: The combination "dir/.." is only removed if "dir" is a searchable directory or does not exist. On Unix, it is also removed when "dir" is a symbolic link within the same directory. In order to resolve all the involved symbolic links before simplifying the path name, use resolve().

Can also be used as a method:

GetName()->simplify()

Parameters

denops: Denops
filename: unknown

Returns

Promise<string>