diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-25 22:42:48 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-25 22:42:48 +0200 |
commit | 6a33ef0deb5c75c003a9f3bd1c57f3ca5e77327e (patch) | |
tree | 1c34b542dbc6768a7fe26ffadabf0657d6a3d291 /runtime | |
parent | 58dbef330c42511f9d7d3b3990c73387041f3f3f (diff) |
patch 8.2.1741: pathshorten() only supports using one characterv8.2.1741
Problem: pathshorten() only supports using one character.
Solution: Add an argument to control the length. (closes #7006)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0853007767..50e5995c6d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2661,7 +2661,7 @@ mzeval({expr}) any evaluate |MzScheme| expression nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} nr2char({expr} [, {utf8}]) String single char with ASCII/UTF8 value {expr} or({expr}, {expr}) Number bitwise OR -pathshorten({expr}) String shorten directory names in a path +pathshorten({expr} [, {len}]) String shorten directory names in a path perleval({expr}) any evaluate |Perl| expression popup_atcursor({what}, {options}) Number create popup window near the cursor popup_beval({what}, {options}) Number create popup window for 'ballooneval' @@ -7656,13 +7656,17 @@ or({expr}, {expr}) *or()* :let bits = bits->or(0x80) -pathshorten({expr}) *pathshorten()* +pathshorten({expr} [, {len}]) *pathshorten()* Shorten directory names in the path {expr} and return the result. The tail, the file name, is kept as-is. The other - components in the path are reduced to single letters. Leading - '~' and '.' characters are kept. Example: > + 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. Can also be used as a |method|: > |