Skip to content

Commit 82be6e3

Browse files
committed
refactor: use vim.system() instead of *plenary* to run config.values.log_pager
1 parent d935c02 commit 82be6e3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lua/neogit/buffers/common.lua

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
local Job = require("plenary.job")
2-
31
local Ui = require("neogit.lib.ui")
42
local Component = require("neogit.lib.ui.component")
53
local util = require("neogit.lib.util")
@@ -35,17 +33,13 @@ M.DiffHunks = Component.new(function(diff)
3533
local content = vim.list_slice(diff.lines, hunk.diff_from + 1, hunk.diff_to)
3634
local job = nil
3735
if config.values.log_pager ~= nil then
38-
job = Job:new {
39-
command = config.values.log_pager[1],
40-
args = vim.list_slice(config.values.log_pager, 2),
41-
}
42-
job:start()
36+
job = vim.system(config.values.log_pager, { stdin = true })
4337
for _, part in ipairs { diff.header, { header }, content } do
4438
for _, line in ipairs(part) do
45-
job:send(line .. "\n")
39+
job:write(line .. "\n")
4640
end
4741
end
48-
job.stdin:close()
42+
job:write()
4943
end
5044

5145
return {
@@ -60,8 +54,7 @@ M.DiffHunks = Component.new(function(diff)
6054

6155
if config.values.log_pager ~= nil then
6256
vim.iter(hunk_props):each(function(hunk)
63-
hunk.job:wait()
64-
hunk.content = hunk.job:result()
57+
hunk.content = vim.split(hunk.job:wait().stdout, "\n")
6558
hunk.job = nil
6659
end)
6760
end

0 commit comments

Comments
 (0)