-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's possible to copy the permalink directly? #24
Comments
I think this should be possible to implement using the following lua code: vim.fn.setreg('+', url) |
Actually, reading the
|
The readme does seem to suggest it should work, but when I do that, it still opens the link in the browser? |
|
It isn't mentioned in the
This needs to be set before the plugin is loaded, since it's used when the plugins' User Commands are being created (code), not when the user command is called (this is just how the anyways, with that said, here's a working config you can use: return {
'Almo7aya/openingh.nvim',
init = function()
vim.g.openingh_copy_to_register = true
end,
config = function()
-- ...
vim.keymap.set('v', '<space>ygh', ':OpenInGHFileLines+<cr>', {
silent = true,
noremap = true,
desc = 'Yank GitHub link to system clipboard',
})
end,
} If you want to copy a permalink, you need to specify both the bang ( e.g. vim.keymap.set('v', '<space>ygh', ':OpenInGHFileLines! +<cr>', {
silent = true,
noremap = true,
desc = 'Yank GitHub permalink to system clipboard',
}) [1]*: Actually this changes how the command interprets the first argument, and so if you frequently pass an explicit branch name to the commands then you might not want this to be set to |
I wondered if copying the permalink directly from the plugin is too complicated since the OpenInGHLines already highlights the correct lines.
The text was updated successfully, but these errors were encountered: