summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/config.lua3
-rw-r--r--lua/telescope/utils.lua7
2 files changed, 6 insertions, 4 deletions
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua
index 7a54ec3..37ca919 100644
--- a/lua/telescope/config.lua
+++ b/lua/telescope/config.lua
@@ -257,7 +257,8 @@ append(
- "shorten" only display the first character of each directory in
the path
- "truncate" truncates the start of the path when the whole path will
- not fit
+ not fit. To increase the the gap between the path and the edge.
+ set truncate to number `truncate = 3`
You can also specify the number of characters of each directory name
to keep by setting `path_display.shorten = num`.
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua
index f145184..f19e973 100644
--- a/lua/telescope/utils.lua
+++ b/lua/telescope/utils.lua
@@ -329,9 +329,10 @@ local is_uri = function(filename)
return string.match(filename, "^%w+://") ~= nil
end
-local calc_result_length = function()
+local calc_result_length = function(truncate_len)
local status = get_status(vim.api.nvim_get_current_buf())
- return vim.api.nvim_win_get_width(status.results_win) - status.picker.selection_caret:len() - 2
+ local len = vim.api.nvim_win_get_width(status.results_win) - status.picker.selection_caret:len() - 2
+ return type(truncate_len) == "number" and len - truncate_len or len
end
utils.transform_path = function(opts, path)
@@ -371,7 +372,7 @@ utils.transform_path = function(opts, path)
end
if vim.tbl_contains(path_display, "truncate") or path_display.truncate then
if opts.__length == nil then
- opts.__length = calc_result_length()
+ opts.__length = calc_result_length(path_display.truncate)
end
transformed_path = truncate(transformed_path, opts.__length, nil, -1)
end