Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.pathshorten

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.pathshorten
import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { pathshorten } = fn;

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>