You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
718 B
40 lines
718 B
local M = require('module'):new()
|
|
|
|
function M:boot()
|
|
self.plugins = nukevim.modules:get('plugins')
|
|
end
|
|
|
|
function M:on_change_branch()
|
|
vim.ui.input({
|
|
prompt = "branch? ",
|
|
-- completion =
|
|
}, function(branch)
|
|
if (branch ~= nil) then
|
|
vim.cmd(':G branch '..branch)
|
|
vim.cmd(':G checkout '..branch)
|
|
end
|
|
end)
|
|
end
|
|
|
|
function M:on_checkout()
|
|
branches_out = vim.fn.system('git branch')
|
|
branches = {}
|
|
|
|
for branch in branches_out:gmatch("[^\r\n]+") do
|
|
if (branch:sub(1, 1) ~= '*') then
|
|
table.insert(branches, branch)
|
|
end
|
|
end
|
|
|
|
vim.ui.select(branches, {
|
|
prompt = 'branch? '
|
|
},
|
|
function(branch)
|
|
if (branch ~= nil) then
|
|
vim.cmd(':G checkout '..branch)
|
|
end
|
|
end
|
|
)
|
|
end
|
|
|
|
return M
|
|
|