shell/sk: fix skgl, bm & hist aliases (firefox bookmark/history search)

This commit is contained in:
Henrik Lissner 2018-03-25 05:47:31 -04:00
parent 1589fd9df3
commit 62240ec4b5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 14 additions and 8 deletions

View file

@ -1,5 +1,5 @@
alias skgcf='noglob git commit -S --fixup `skim-git-sha`' alias skgcf='noglob git commit -S --fixup `sk-git-sha`'
alias skgl=skim-git-log alias skgl=sk-git-log
alias bm=skim-browser-bookmarks alias bm=sk-browser-bookmarks
alias hist=skim-browser-history alias hist=sk-browser-history

View file

@ -8,14 +8,17 @@
[[ $OSTYPE == linux* ]] && open='xdg-open' || open='open' [[ $OSTYPE == linux* ]] && open='xdg-open' || open='open'
_do_sk() { _do_sk() {
for url in $(awk -F "$1" '{printf "%s, %s\n", $1, $2}' | skim --prompt='bookmarks > ' --multi | sed 's#.*\(https*://\)#\1#'); do for url in $(awk -F "$1" '{printf "%s, %s\n", $1, $2}' | sk --prompt='bookmarks > ' --multi | sed 's#.*\(https*://\)#\1#'); do
$open "$url" & $open "$url" &
done done
} }
case ${BROWSER:-firefox} in case ${BROWSER:-firefox} in
firefox) firefox)
for dir in ~/.mozilla/firefox/*.default ~/.config/firefox/.mozilla/firefox/*.default ~/Library/Application\ Support/Firefox/Profiles/*.default; do for dir in ~/.mozilla/firefox/*.default \
$XDG_CONFIG_HOME/firefox/.mozilla/firefox/*.default \
$XDG_DATA_HOME/mozilla/firefox/*.default \
~/Library/Application\ Support/Firefox/Profiles/*.default; do
if [[ -d "$dir" ]]; then if [[ -d "$dir" ]]; then
sep='{{::}}' sep='{{::}}'
sqlite3 -separator $sep "$dir/places.sqlite" \ sqlite3 -separator $sep "$dir/places.sqlite" \

View file

@ -9,14 +9,17 @@ sep='{{::}}'
[[ $OSTYPE == linux* ]] && open='xdg-open' || open='open' [[ $OSTYPE == linux* ]] && open='xdg-open' || open='open'
_do_skim() { _do_skim() {
for url in $(awk -F "$sep" '{printf "%s, %s\n", $1, $2}' | skim --prompt='history > ' --multi | sed 's#.*\(https*://\)#\1#'); do for url in $(awk -F "$sep" '{printf "%s, %s\n", $1, $2}' | sk --prompt='history > ' --multi | sed 's#.*\(https*://\)#\1#'); do
$open "$url" & $open "$url" &
done done
} }
case ${BROWSER:-firefox} in case ${BROWSER:-firefox} in
firefox) firefox)
for dir in ~/.mozilla/firefox/*.default ~/.config/firefox/.mozilla/firefox/*.default ~/Library/Application\ Support/Firefox/Profiles/*.default; do for dir in ~/.mozilla/firefox/*.default \
$XDG_CONFIG_HOME/firefox/.mozilla/firefox/*.default \
$XDG_DATA_HOME/mozilla/firefox/*.default \
~/Library/Application\ Support/Firefox/Profiles/*.default; do
if [[ -d "$dir" ]]; then if [[ -d "$dir" ]]; then
sqlite3 -separator $sep "$dir/places.sqlite" \ sqlite3 -separator $sep "$dir/places.sqlite" \
"SELECT DISTINCT title, url FROM moz_places \ "SELECT DISTINCT title, url FROM moz_places \