From 7647b9eb9e9852d3dc7d388af099afc95a5271f7 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 5 Apr 2015 03:02:18 +0900 Subject: [PATCH] Chrome integration --- Examples.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Examples.md b/Examples.md index bf0d402..a0dfb51 100644 --- a/Examples.md +++ b/Examples.md @@ -268,6 +268,27 @@ alias j=z alias jj=zz ``` +### Google Chrome (OS X) + +```sh +# c - browse chrome history +c() { + local cols sep hist + cols=$(( COLUMNS / 3 )) + sep='{{::}}' + + # Copy History DB to circumvent the lock + # - See http://stackoverflow.com/questions/8936878 for the file path + cp -f ~/Library/Application\ Support/Google/Chrome/Default/History /tmp/h + + sqlite3 -separator $sep /tmp/h \ + "select substr(title, 1, $cols), url + from urls order by last_visit_time desc" | + awk -F $sep '{printf "%-'$cols's \x1b[36m%s\n", $1, $2}' | + fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open +} +``` + ### Browsing ```sh