Add ability to yank url into register
This commit is contained in:
parent
618c0a873a
commit
8cd1c9d5aa
1 changed files with 23 additions and 3 deletions
|
|
@ -21,8 +21,14 @@ vim.api.nvim_create_user_command("OpenInGHFile", function(opts)
|
|||
url = openingh.get_file_url(opts.args, opts.line1, opts.line2)
|
||||
end
|
||||
|
||||
openingh.open_url(url)
|
||||
if opts.reg == "" then
|
||||
openingh.open_url(url)
|
||||
else
|
||||
vim.fn.setreg(opts.reg, url)
|
||||
print("URL yanked")
|
||||
end
|
||||
end, {
|
||||
register = true,
|
||||
range = true,
|
||||
nargs = '?',
|
||||
complete = complete_func,
|
||||
|
|
@ -37,16 +43,30 @@ vim.api.nvim_create_user_command("OpenInGHFileLines", function(opts)
|
|||
url = openingh.get_file_url(opts.args, opts.line1, opts.line2)
|
||||
end
|
||||
|
||||
openingh.open_url(url)
|
||||
if opts.reg == "" then
|
||||
openingh.open_url(url)
|
||||
else
|
||||
vim.fn.setreg(opts.reg, url)
|
||||
print("URL yanked")
|
||||
end
|
||||
end, {
|
||||
register = true,
|
||||
range = true,
|
||||
nargs = '?',
|
||||
complete = complete_func,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("OpenInGHRepo", function(opts)
|
||||
openingh.open_url(openingh.get_repo_url(opts.args))
|
||||
local url = openingh.get_repo_url(opts.args)
|
||||
|
||||
if opts.reg == "" then
|
||||
openingh.open_url(url)
|
||||
else
|
||||
vim.fn.setreg(opts.reg, url)
|
||||
print("URL yanked")
|
||||
end
|
||||
end, {
|
||||
register = true,
|
||||
nargs = '?',
|
||||
complete = complete_func,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue