mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:50:05 +08:00
perf(git): do not open diff win when no changes
This commit is contained in:
parent
2083a13ad6
commit
254df1095f
@ -61,11 +61,18 @@ local function open_diff_buffer()
|
||||
end
|
||||
|
||||
local function on_exit(id, code, single)
|
||||
if id ~= jobid then
|
||||
return
|
||||
end
|
||||
log.debug('git-diff exit code:' .. code .. ' single:' .. single)
|
||||
if #diff_lines > 0 then
|
||||
bufnr = open_diff_buffer()
|
||||
vim.api.nvim_buf_set_option(bufnr, 'modifiable', true)
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, diff_lines)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'modifiable', false)
|
||||
else
|
||||
nt.notify('No Changes!')
|
||||
end
|
||||
end
|
||||
|
||||
function M.run(argv)
|
||||
|
Loading…
Reference in New Issue
Block a user