summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua25
1 files changed, 19 insertions, 6 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 409da21..2a17f80 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -244,12 +244,23 @@ do
return { filename, lnum, nil, text }
end
+ local parse_only_filename = function(t)
+ t.filename = t.value
+ t.lnum = nil
+ t.col = nil
+ t.text = ""
+
+ return { t.filename, nil, nil, "" }
+ end
+
function make_entry.gen_from_vimgrep(opts)
opts = opts or {}
local mt_vimgrep_entry
local parse = parse_with_col
- if opts.__inverted == true then
+ if opts.__matches == true then
+ parse = parse_only_filename
+ elseif opts.__inverted == true then
parse = parse_without_col
end
@@ -290,7 +301,7 @@ do
end
end
- local display_string = "%s:%s%s"
+ local display_string = "%s%s%s"
mt_vimgrep_entry = {
cwd = vim.fn.expand(opts.cwd or vim.loop.cwd()),
@@ -300,10 +311,12 @@ do
local coordinates = ""
if not disable_coordinates then
- if entry.col then
- coordinates = string.format("%s:%s:", entry.lnum, entry.col)
- else
- coordinates = string.format("%s:", entry.lnum)
+ if entry.lnum then
+ if entry.col then
+ coordinates = string.format(":%s:%s:", entry.lnum, entry.col)
+ else
+ coordinates = string.format(":%s:", entry.lnum)
+ end
end
end