Skip to main content
Module

x/denops_std/function/mod.ts>pathshorten

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

Shorten directory names in the path {path} and return the result. The tail, the file name, is kept as-is. The other components in the path are reduced to {len} letters in length. If {len} is omitted or smaller than 1 then 1 is used (single letters). Leading '~' and '.' characters are kept. Examples:

:echo pathshorten('~/.vim/autoload/myfile.vim')

    `~/.v/a/myfile.vim`

:echo pathshorten('~/.vim/autoload/myfile.vim', 2)

    `~/.vi/au/myfile.vim`

It doesn't matter if the path exists or not. Returns an empty string on error.

Can also be used as a method:

GetDirectories()->pathshorten()

Parameters

denops: Denops
path: unknown
optional
len: unknown

Returns

Promise<string>