Refactoring
This commit is contained in:
parent
68a3ed8af4
commit
6ffd911e7b
2 changed files with 8 additions and 6 deletions
|
|
@ -22,10 +22,12 @@ function M.setup()
|
|||
M.repo_url = string.format("http://%s/%s/%s", gh.host, gh.user_or_org, gh.reponame)
|
||||
end
|
||||
|
||||
local get_current_branch_or_commit_with_priority = function(priority)
|
||||
if priority == 'branch-priority' then
|
||||
M.priority = { BRANCH = 'branch-priority', COMMIT = 'commit-priority', }
|
||||
|
||||
local function get_current_branch_or_commit_with_priority(priority)
|
||||
if priority == M.priority.BRANCH then
|
||||
return utils.get_current_branch_or_commit()
|
||||
elseif priority == 'commit-priority' then
|
||||
elseif priority == M.priority.COMMIT then
|
||||
return utils.get_current_commit_or_branch()
|
||||
else
|
||||
return utils.get_current_branch_or_commit()
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ vim.g.openingh = true
|
|||
|
||||
local openingh = require("openingh")
|
||||
|
||||
local complete_list = { 'branch-priority', 'commit-priority', }
|
||||
local complete_func = function(arg_lead, _, _)
|
||||
local complete_list = { openingh.priority.BRANCH, openingh.priority.COMMIT, }
|
||||
local function complete_func(arg_lead, _, _)
|
||||
return vim.tbl_filter(function(item)
|
||||
return vim.startswith(item, arg_lead)
|
||||
end, complete_list)
|
||||
|
|
@ -36,7 +36,7 @@ end, {
|
|||
complete = complete_func,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("OpenInGHRepo", function()
|
||||
vim.api.nvim_create_user_command("OpenInGHRepo", function(opts)
|
||||
openingh.open_repo(opts.args)
|
||||
end, {
|
||||
nargs = '?',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue