Add registers to README

This commit is contained in:
msc94 2023-08-27 11:18:00 +02:00
parent 8cd1c9d5aa
commit 649195b374
2 changed files with 10 additions and 3 deletions

View file

@ -45,6 +45,13 @@ end)
- `:OpenInGHFileLines` - `:OpenInGHFileLines`
- Opens the current file page in GitHub. This command supports ranges. - Opens the current file page in GitHub. This command supports ranges.
## Registers
All of the commands above optionally take a register, e.g. `:OpenInGHFileLines+`.
In this case, the URL will not be opened in the browser, but put into the register given.
This is especially useful if you're running neovim on a remote machine, but want to open the URL locally.
## Usage ## Usage
You can call the commands directly or define mappings them: You can call the commands directly or define mappings them:

View file

@ -25,7 +25,7 @@ vim.api.nvim_create_user_command("OpenInGHFile", function(opts)
openingh.open_url(url) openingh.open_url(url)
else else
vim.fn.setreg(opts.reg, url) vim.fn.setreg(opts.reg, url)
print("URL yanked") print("URL put into register " .. opts.reg)
end end
end, { end, {
register = true, register = true,
@ -47,7 +47,7 @@ vim.api.nvim_create_user_command("OpenInGHFileLines", function(opts)
openingh.open_url(url) openingh.open_url(url)
else else
vim.fn.setreg(opts.reg, url) vim.fn.setreg(opts.reg, url)
print("URL yanked") print("URL put into register " .. opts.reg)
end end
end, { end, {
register = true, register = true,
@ -63,7 +63,7 @@ vim.api.nvim_create_user_command("OpenInGHRepo", function(opts)
openingh.open_url(url) openingh.open_url(url)
else else
vim.fn.setreg(opts.reg, url) vim.fn.setreg(opts.reg, url)
print("URL yanked") print("URL put into register " .. opts.reg)
end end
end, { end, {
register = true, register = true,