-
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
enhancementNew feature or requestNew feature or request
Description
FOA, Thanks for making cliphist, such a life saver...
i am looking for a option to directly get a line from clipboard, without printing and then filtering
~ via ☕ via
❮ cliphist pick 1
ctrl-c tutorial
this article explain how to use copy paste function
press ctrl+a to select all
now use ctrl+c to copy
~ via ☕ via
❮ cliphist pick -2
you copied me?
~ via ☕ via
❮ cliphist pick -1
you again copied me? this will be the last thing you ever copy ;rm -rf /
I know i can do echo -e "10\t" | cliphist decode, but it wouldn't support -ve numbers, basically to get the last few things i copied.. atleast i couldn't find a simple way to do it
(chatgpt agreed with me and hallucinated cliphist pick command

)
Use cases..
basically to make scripting easier...
eg: compare diff between last 2 items in the clipboard...
#!/bin/sh
# Get the last two clipboard entries
last_item=$(cliphist list | head -n 1 | cliphist decode)
second_last_item=$(cliphist list | sed -n 2p | cliphist decode) # currnet way to do this.., we could also use tail
if [[ -z "$last_item" || -z "$second_last_item" ]]; then
echo "Not enough items in clipboard history to compare."
exit 1
fi
temp_file1=$(mktemp)
temp_file2=$(mktemp)
echo "$last_item" >"$temp_file1"
echo "$second_last_item" >"$temp_file2"
# Open vimdiff
#nvim -d "$temp_file1" "$temp_file2"
diff --side-by-side --color=always "$temp_file1" "$temp_file2" | "$PAGER"
rm "$temp_file1" "$temp_file2"
samvel1024, atimofeev, SturgeonInc, rodrigoscc and Weslley41
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request