-
Notifications
You must be signed in to change notification settings - Fork 12
Clipboard Configuration
You can configure the way copying works in nyaa using several options. The configuration looks like:
[clipboard]
osc52 = true
selection = ["..."] # optional
cmd = "..." # optional
shell_cmd = "..." # optionalThey are prioritized in the order cmd osc52 selection
By default, cmd is undefined so nyaa uses OSC52 to copy to the clipboard. It's a type of ANSI escape sequence supported by most terminals, and should just work. The state of support for some popular terminals are:
| Terminal | OSC52 support |
|---|---|
| alacritty | yes |
| contour | yes |
| far2l | yes |
| foot | yes |
| gnome terminal (and other VTE-based terminals) | not yet |
| hterm | yes |
| iterm2 | yes |
| kitty | yes |
| konsole | not yet |
| qterminal | not yet |
| rxvt | yes |
| st | yes (but needs to be enabled, see here) |
| terminal.app | no, but see workaround |
| tmux | yes |
| urxvt | yes (with a script, see here) |
| wezterm | yes |
| windows terminal | yes |
| xterm.js (Hyper terminal) | yes |
| zellij | yes |
Source: vim-oscyank
If your terminal is not supported, you should disable OSC52 by adding
[clipboard]
osc52 = falseto your config.toml. This will make nyaa use an alternative method for copying.
For those using X11, you can change the option x11_selection to either Clipboard, Primary, or Secondary to change which selection X11 will copy the content into. This would look like:
[clipboard]
selection = "Primary" # can also be a list, like ["Primary", "Clipboard"]For those using WSL, tmux, or any other non-standard clipboard manager, you can invoke a command on copy using the cmd and shell_cmd option. The placeholder {content} is used for substituting the text to copy into the command. shell_cmd is optional when running a command, and only specifies which shell to run the command with. By default it is sh -c for linux and powershell.exe -Command for windows.
For copying on WSL, this config would look like:
[clipboard]
cmd = 'echo "{content}" | clip.exe'
# shell_cmd = "bash -c" # optionalFor tmux, a possible configuration would look like:
[clipboard]
cmd = 'tmux set-buffer "{content}"'
# shell_cmd = "bash -c" # optional