From 729492406ec3b545c4ecf2beadf7bd30c81e70e4 Mon Sep 17 00:00:00 2001 From: Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> Date: Sun, 14 Nov 2021 09:37:15 +0000 Subject: 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 --- lua/telescope/config.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lua/telescope/config.lua') diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index 8c90bbb..8e5b682 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -273,6 +273,20 @@ append( Similarly, `path_display.shorten = 2` will give a path like: `al/be/ga/delta.txt` + You can also further customise the shortening behaviour by + setting `path_display.shorten = { len = num, exclude = list }`, + where `len` acts as above, and `exclude` is a list of positions + that are not shortened. Negative numbers in the list are considered + relative to the end of the path. + e.g. for a path like + `alpha/beta/gamma/delta.txt` + setting `path_display.shorten = { len = 1, exclude = {1, -1} }` + will give a path like: + `alpha/b/g/delta.txt` + setting `path_display.shorten = { len = 2, exclude = {2, -2} }` + will give a path like: + `al/beta/gamma/de` + path_display can also be set to 'hidden' string to hide file names path_display can also be set to a function for custom formatting of -- cgit v1.2.3