Skip to content

Commit 3e90e3d

Browse files
committed
feat: picker support for dynamic chat names
1 parent 642469b commit 3e90e3d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lua/gp/init.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,13 +1312,22 @@ M.cmd.ChatFinder = function()
13121312
return
13131313
end
13141314

1315+
table.sort(results, function(a, b)
1316+
local af = a.file:sub(-24, -11)
1317+
local bf = b.file:sub(-24, -11)
1318+
if af == bf then
1319+
return a.lnum < b.lnum
1320+
end
1321+
return af > bf
1322+
end)
1323+
13151324
picker_files = {}
13161325
preview_lines = {}
13171326
local picker_lines = {}
13181327
for _, f in ipairs(results) do
13191328
if f.line:len() > 0 then
13201329
table.insert(picker_files, dir .. "/" .. f.file)
1321-
local fline = string.format("%s:%s %s", f.file:sub(3, -11), f.lnum, f.line)
1330+
local fline = string.format("%s:%s %s", f.file:sub(-24, -11), f.lnum, f.line)
13221331
table.insert(picker_lines, fline)
13231332
table.insert(preview_lines, tonumber(f.lnum))
13241333
end

lua/gp/tasker.lua

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@ M.grep_directory = function(buf, directory, pattern, callback)
216216
})
217217
end
218218
end
219-
table.sort(results, function(a, b)
220-
if a.file == b.file then
221-
return a.lnum < b.lnum
222-
else
223-
return a.file > b.file
224-
end
225-
end)
226219
callback(results, re)
227220
end)
228221
end

0 commit comments

Comments
 (0)