Death of clipboard #3061

wants to merge 4 commits into


None yet

4 participants

faho commented May 24, 2016 edited

This removes our clipboard integration and replaces it with a set of explicit binding functions.

It should work on OSX via pbcopy/pbpaste (please test!) and on X11 via xsel.

I've explicitly not silenced the errors xsel throws when $DISPLAY is invalid so the user knows that it's not going to work.

This should fix #2894 and #2556 and provide a workaround for #2188.


  • Update release notes (next-2x)
  • Update documentation
@faho faho added the enhancement label May 24, 2016
faho added some commits May 13, 2016
@faho faho kill: Remove xsel integration
Overwriting the user's clipboard by default is annoying and contributors
don't use it.

This is better served via an explicit binding that calls e.g. `xsel`.
@faho faho docs: Remove section about clipboard integration 05f171f
@faho faho Add clipboard helper functions and bind them
\cy copies, \cv pastes.
@faho faho Run fish_indent on default_key_bindings ec2a3ee
@zanchey zanchey commented on the diff May 24, 2016
@@ -0,0 +1,7 @@
+function fish_clipboard_copy
+ if type -q pbcopy
zanchey May 24, 2016 edited Member

I don't know if it's premature optimisation, but another option would be to use

if type -q pbcopy
function fish_clipboard_copy
   commandline | pbcopy
else if type -q xsel
faho May 25, 2016 Member

Yeah, this isn't performance-sensitive at all, and the bulk of the time is likely to be spent in the called command (xsel needs a trip to the X server and back).

Plus it would mean what you get via funced differs from the contents of the file and I like being able to use that for development. It's possible there's more tools to support here (there's also xclip, but I don't know if anything has it but not xsel), so it'd be nice to leave that possibility open.

zanchey commented May 24, 2016

Weirdly, the binding only seems to work every second time on OS X in iTerm 2:


A quick read didn't reveal any obvious problems. I was just about to tackle this myself. I've been pretty annoyed that every time I use my mouse to highlight and copy some text to paste into a command if I first do something like invoke the delete-word binding it replaces my explicit selection and I have to select that text a second time. So thanks for beating me to it. I'll test it in a couple of hours.


@zanchey: The weird need to press \cV twice is because the tty driver is in cooked mode and has "lnext = ^V". The fix is to undef that character like we already do for \cS (stop) and \cQ (start). In fact, we should undef all the characters except those for "kill", "susp", "intr", "quit" and "eof". I'll open an issue and fix that.


Other than the weird \cV behavior, which I'll fix in a separate change, this LGTM.

@faho faho added the release-notes label May 25, 2016
faho commented May 25, 2016

Merged with rebase as 2f51088..53c506f.

@faho faho closed this May 25, 2016
@floam floam added this to the 2.3.1 milestone Jul 3, 2016
@faho faho was assigned by floam Jul 3, 2016
floam commented Jul 3, 2016

I notice there is no mention of pbcopy/pbpaste/xsel working out of the box - it's neat and should be noted in documentation.

@floam floam added the needs-docs label Jul 3, 2016
@zanchey zanchey modified the milestone: next-2.x, 2.3.1 Jul 3, 2016
faho commented Jul 3, 2016

@floam: f9edcbb mentions the bindings. Do you think we need more?

@floam floam removed the needs-docs label Jul 3, 2016
floam commented Jul 3, 2016 edited

Nope. I missed that. Only noticed the documentation removal of the old stuff.

@faho faho modified the milestone: fish 2.4.0, next-2.x Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment