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

added alias for xclip command #1773

Merged
merged 3 commits into from
Jan 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions aliases/available/clipboard.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
about-alias 'xclip shortcuts'

case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && \
alias pbcopy="$XCLIP -selection clipboard" && \
alias pbpaste="$XCLIP -selection clipboard -o"
;;
esac
alias pbcopy="xclip -selection clipboard"
alias pbpaste="xclip -selection clipboard -o"

alias xcpy="xclip -selection clipboard"
alias xpst="xclip -selection clipboard -o"
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# $ echo "hello" | xcpy
# $ xpst
# hello

# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# cat ~/.ssh/id_rsa.pub | xcpy
# have fun!