summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Maves <100046241+codemicmaves@users.noreply.github.com>2022-05-04 16:13:40 -0400
committerGitHub <noreply@github.com>2022-05-04 22:13:40 +0200
commit85d95dfdddba7077257a5fa3eb6dd57caf12579f (patch)
tree59c15801e0b28d0af145e4a67cc32a77ed6be18a
parent3f3cba430e93f54289c296860b05cba141d32acc (diff)
fix(builtin.tags): custom filename width (#1842)
-rw-r--r--doc/telescope.txt4
-rw-r--r--lua/telescope/builtin/init.lua2
-rw-r--r--lua/telescope/make_entry.lua7
3 files changed, 11 insertions, 2 deletions
diff --git a/doc/telescope.txt b/doc/telescope.txt
index 9a72905..b1730c5 100644
--- a/doc/telescope.txt
+++ b/doc/telescope.txt
@@ -880,6 +880,8 @@ builtin.tags({opts}) *telescope.builtin.tags()*
true)
{only_sort_tags} (boolean) if true we will only sort tags (default:
false)
+ {fname_width} (number) defines the width of the filename section
+ (default: 30)
builtin.current_buffer_tags({opts}) *telescope.builtin.current_buffer_tags()*
@@ -899,6 +901,8 @@ builtin.current_buffer_tags({opts}) *telescope.builtin.current_buffer_tags()*
true)
{only_sort_tags} (boolean) if true we will only sort tags (default:
false)
+ {fname_width} (number) defines the width of the filename section
+ (default: 30)
builtin.git_files({opts}) *telescope.builtin.git_files()*
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua
index e6ed448..ebbbe69 100644
--- a/lua/telescope/builtin/init.lua
+++ b/lua/telescope/builtin/init.lua
@@ -107,6 +107,7 @@ builtin.current_buffer_fuzzy_find = require_on_exported_call("telescope.builtin.
---@field ctags_file string: specify a particular ctags file to use
---@field show_line boolean: if true, shows the content of the line the tag is found on in the picker (default: true)
---@field only_sort_tags boolean: if true we will only sort tags (default: false)
+---@field fname_width number: defines the width of the filename section (default: 30)
builtin.tags = require_on_exported_call("telescope.builtin.files").tags
--- Lists all of the tags for the currently open buffer, with a preview
@@ -115,6 +116,7 @@ builtin.tags = require_on_exported_call("telescope.builtin.files").tags
---@field ctags_file string: specify a particular ctags file to use
---@field show_line boolean: if true, shows the content of the line the tag is found on in the picker (default: true)
---@field only_sort_tags boolean: if true we will only sort tags (default: false)
+---@field fname_width number: defines the width of the filename section (default: 30)
builtin.current_buffer_tags = require_on_exported_call("telescope.builtin.files").current_buffer_tags
--
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 8a83b6f..627d669 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -920,13 +920,16 @@ function make_entry.gen_from_ctags(opts)
local display_items = {
{ remaining = true },
}
+
+ local idx = 1
local hidden = utils.is_path_hidden(opts)
if not hidden then
- table.insert(display_items, 1, { width = 30 })
+ table.insert(display_items, idx, { width = vim.F.if_nil(opts.fname_width, 30) })
+ idx = idx + 1
end
if opts.show_line then
- table.insert(display_items, 1, { width = 30 })
+ table.insert(display_items, idx, { width = 30 })
end
local displayer = entry_display.create {