1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:40:05 +08:00

feat(git): add :Git mv command

This commit is contained in:
wsdjeg 2023-07-29 15:40:03 +08:00 committed by Eric Wong
parent 88b0ac5dbb
commit f2f7c8dcc0

30
bundle/git.vim/lua/git/command/mv.lua vendored Normal file
View File

@ -0,0 +1,30 @@
local m = {}
local job = require('spacevim.api.job')
local nt = require('spacevim.api.notify')
local log = require('git.log')
local function on_exit(id, code, single)
log.debug('git-mv exit code:' .. code .. ' single:' .. single)
if code == 0 and single == 0 then
nt.notify('git mv successfully')
else
nt.notify('failed to run git mv', 'warningmsg')
end
end
function m.run(argv)
local cmd = {'git', 'mv'}
if vim.fn.index(argv, '%') ~= -1 then
argv[vim.fn.index(argv, '%') + 1] = vim.fn.expand('%')
end
for _, v in ipairs(argv) do table.insert(cmd, v)
end
log.debug('git-mv cmd:' .. vim.inspect(cmd))
job.start(cmd, {
on_exit = on_exit
})
end
return m