mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:10:06 +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
|
end
|
||||||
|
|
||||||
local function on_exit(id, code, single)
|
local function on_exit(id, code, single)
|
||||||
|
if id ~= jobid then
|
||||||
|
return
|
||||||
|
end
|
||||||
log.debug('git-diff exit code:' .. code .. ' single:' .. single)
|
log.debug('git-diff exit code:' .. code .. ' single:' .. single)
|
||||||
bufnr = open_diff_buffer()
|
if #diff_lines > 0 then
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'modifiable', true)
|
bufnr = open_diff_buffer()
|
||||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, diff_lines)
|
vim.api.nvim_buf_set_option(bufnr, 'modifiable', true)
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'modifiable', false)
|
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
|
end
|
||||||
|
|
||||||
function M.run(argv)
|
function M.run(argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user