diff options
| author | Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> | 2021-11-14 09:37:15 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-14 09:37:15 +0000 |
| commit | 729492406ec3b545c4ecf2beadf7bd30c81e70e4 (patch) | |
| tree | ca01ef0d8f5392326bf1df6817464d9166635bb1 /lua/telescope/utils.lua | |
| parent | b2f16c788ec0f1c72a500c67f5ad93d08a646b30 (diff) | |
feat: `exclude` option for `shorten` in `path_display` (#1429)
* feat: allow excluding positions for `shorten` in `path_display`
* [docgen] Update doc/telescope.txt
skip-checks: true
Co-authored-by: Github Actions <actions@github>
Diffstat (limited to 'lua/telescope/utils.lua')
| -rw-r--r-- | lua/telescope/utils.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 5a14cc6..e8aefd4 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -363,7 +363,12 @@ utils.transform_path = function(opts, path) end if vim.tbl_contains(path_display, "shorten") or path_display["shorten"] ~= nil then - transformed_path = Path:new(transformed_path):shorten(path_display["shorten"]) + if type(path_display["shorten"]) == "table" then + local shorten = path_display["shorten"] + transformed_path = Path:new(transformed_path):shorten(shorten.len, shorten.exclude) + else + transformed_path = Path:new(transformed_path):shorten(path_display["shorten"]) + end end if vim.tbl_contains(path_display, "truncate") or path_display.truncate then if opts.__length == nil then |
