Plugin ranger-oscyank
introduces a drop-in replacement (command oscyank
)
for the internal command yank
. Besides the old integration with
system clipboard manager tools (like pbcopy
, xsel
) in yank
, oscynak
enables copying text into system clipbard with ANSI OSC52 sequence.
Dependency: OSC52 support in your terminal emulator.
Git clone the plugin into ranger's plugin folder. (ranger >= 1.9.3
)
git clone https://github.com/laggardkernel/ranger-oscyank.git ~/.config/ranger/plugins/oscyank
Overrides default yank
key bindings in rc.conf
.
# ~/.config/ranger/rc.conf
map yp oscyank path
map yd oscyank dir
map yn oscyank name
map y. oscyank name_without_extension
To use ranger-oscyank
within tmux
, enable tmux option set-clipboard
tmux-clipboard
# ~/.tmux.conf, or ~/.config/tmux/tmux.conf
set-option -g allow-passthrough on
oscyank
supports two backends:
- system clipboard manager tools, like
pbcopy
,wl-copy
,termux-clipboard-get
,xclip
,xsel
. - ANSI OSC 52 sequence
The backend selection priority is,
- OSC 52 when connecting thru SSH
- Clipboard tools if any of the above is available
- OSC 52 as fallback
You can choose the backend explicitly with special option setting:
# Force OSC 52 copying. NOTE: don't quote the value like 'osc52'.
set_oscyank backend osc52
# or
set_oscyank backend manager
Switch path styles copied with quantifiers:
1
(e.g.1yp
): replace your home path with tilde~
2
: strip the leading home path
quantifier: If this command was mapped to the key "X" and the user pressed 6X, self.quantifier will be 6.
The MIT License (MIT)
Copyright (c) 2024 laggardkernel