summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-17 12:34:42 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-17 12:34:42 -0400
commita9d9b3d8bf694914a07a01749306dd5157b868d7 (patch)
treef274d94a7c251bd25496cc3d3a66d8d8751d9de3 /lua/telescope/make_entry.lua
parent7bdb39b138ac49f20143d8a3a94467ecc32c23ed (diff)
feat: Improved previewers and cleanup
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 99735a2..4560c0a 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -2,6 +2,8 @@ local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
local utils = require('telescope.utils')
+local get_default = utils.get_default
+
local make_entry = {}
make_entry.types = {
@@ -131,13 +133,16 @@ end
function make_entry.gen_from_quickfix(opts)
opts = opts or {}
+ opts.tail_path = get_default(opts.tail_path, true)
local make_display = function(entry)
local to_concat = {}
if not opts.hide_filename then
local filename = entry.filename
- if opts.shorten_path then
+ if opts.tail_path then
+ filename = utils.path_tail(filename)
+ elseif opts.shorten_path then
filename = utils.path_shorten(filename)
end
@@ -151,17 +156,19 @@ function make_entry.gen_from_quickfix(opts)
end
return function(entry)
+ local filename = entry.filename or vim.api.nvim_buf_get_name(entry.bufnr)
+
return {
valid = true,
value = entry,
ordinal = (
- not opts.ignore_filename and entry.filename
+ not opts.ignore_filename and filename
or ''
) .. ' ' .. entry.text,
display = make_display,
- filename = entry.filename,
+ filename = filename,
lnum = entry.lnum,
col = entry.col,
text = entry.text,