Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for copy and paste in WSL #7455

Merged
merged 1 commit into from Nov 6, 2020
Merged

Conversation

ayoisaiah
Copy link
Contributor

Description

The necessary commands for copying from and pasting to the Windows clipboard (through WSL) has been integrated to fish_clipboard_copy and fish_clipboard_paste respectively.

Fixes issue #7454

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

@@ -8,6 +8,8 @@ function fish_clipboard_paste
set data (xsel --clipboard 2>/dev/null)
else if type -q xclip
set data (xclip -selection clipboard -o 2>/dev/null)
else if type -q powershell.exe
set data (powershell.exe Get-Clipboard | tr -d '\r' 2>/dev/null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That tr should be string trim -r -c \r (no need to silence stderr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, thanks for pointing that out. Amended the commit

@faho faho added this to the fish 3.2.0 milestone Nov 6, 2020
- clip.exe is used to copy to the Windows clipboard
- There's no binary for pasting from the Windows clipboard so
  `Get-Clipboard` from powershell is used as a workaround. The
  superflous carriage return is stripped from the output.
@faho faho merged commit ea1dffd into fish-shell:master Nov 6, 2020
@faho
Copy link
Member

faho commented Nov 6, 2020

Merged, thanks!

@faho faho linked an issue Nov 6, 2020 that may be closed by this pull request
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for the Windows clipboard (via WSL)
2 participants