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()