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 = "..." # optional
They 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 = false
to 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" # optional
For tmux, a possible configuration would look like:
[clipboard]
cmd = 'tmux set-buffer "{content}"'
# shell_cmd = "bash -c" # optional