-
-
Save ryo-n/2bfed7e79972e950d1c6950ef2226664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/junegunn/fzf/wiki/examples | |
c() { | |
local columns cols sep google_history open | |
columns=$(tput cols) | |
cols=$(( columns / 3 )) | |
sep='{::}' | |
if [ "$(uname)" = "Darwin" ]; then | |
google_history="$HOME/Library/Application Support/Google/Chrome/Default/History" | |
open=open | |
else | |
google_history="$HOME/.config/google-chrome/Default/History" | |
open=xdg-open | |
fi | |
cp -f "$google_history" /tmp/h | |
sqlite3 -separator $sep /tmp/h \ | |
"SELECT substr(title, 1, $cols), url | |
FROM urls WHERE title != '' GROUP BY url ORDER BY last_visit_time DESC" | | |
awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' | | |
fzf --ansi --multi --no-sort --toggle-sort=ctrl-r | sed 's#.*\(https*://\)#\1#' | xargs $open > /dev/null 2> /dev/null | |
} | |
c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment