Skip to content

Commit

Permalink
Merge pull request #49
Browse files Browse the repository at this point in the history
Add OSCyank setup instructions
  • Loading branch information
ruifm committed Jan 10, 2022
2 parents bcfb3a0 + de98934 commit e83ebb3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,29 @@ which opens the url in your preferred browser using `xdg-open` (linux only).

You can define your own action callback.

For example, to copy the url over a remote SSH session with an
[OSC52][osc52]-compatible terminal, you can integrate gitlinker with
[ojroques/vim-oscyank](oscyank) and use its `OSCYankString` function:

```lua
require'gitlinker'.setup{
opts = {
action_callback = function(url)
-- yank to unnamed register
vim.api.nvim_command('let @" = \'' .. url .. '\'')
-- copy to the system clipboard using OSC52
vim.fn.OSCYankString(url)
end,
},
}
```

For the above setup, make sure that [ojroques/vim-oscyank](oscyank) is also
installed.

[osc52]: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
[oscyank]: https://github.com/ojroques/vim-oscyank

- `print_url`

If `true`, then print the url before performing the configured action.
Expand Down
18 changes: 18 additions & 0 deletions doc/gitlinker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,24 @@ provided which opens the url in your preferred browser using `xdg-open`

You can define your own action callback.

For example, to copy the url over a remote SSH session with an
OSC52-compatible terminal, you can integrate gitlinker with
ojroques/vim-oscyank and use its `OSCYankString` function:

>
require'gitlinker'.setup{
opts = {
action_callback = function(url)
-- yank to unnamed register
vim.api.nvim_command('let @" = \'' .. url .. '\'')
-- copy to the system clipboard using OSC52
vim.fn.OSCYankString(url)
end,
},
}
<
For the above setup, make sure that ojroques/vim-oscyank is also installed.

remote *gitlinker-mappings*

A string representing the keys you wish to map these plugin’s actions.
Expand Down

0 comments on commit e83ebb3

Please sign in to comment.