Skip to content

Instantly share code, notes, and snippets.

@thinkjrs
Created December 27, 2024 16:26
Show Gist options
  • Save thinkjrs/fef5c78d1c599bfad12373f306cf675e to your computer and use it in GitHub Desktop.
Save thinkjrs/fef5c78d1c599bfad12373f306cf675e to your computer and use it in GitHub Desktop.
ctrl-y to copy current terminal command
# ctrl-y to copy to clipboard
if [[ -n $DISPLAY ]]; then
copy_line_to_x_clipboard () {
printf %s "$READLINE_LINE" | xclip -selection CLIPBOARD
}
bind -x '"\C-y": copy_line_to_x_clipboard' # binded to ctrl-y
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment