mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 17:13:42 -05:00
Added Chrome History + Bookmarks scripts for Windows (Powershell)
44
Examples.md
44
Examples.md
@@ -35,7 +35,7 @@ Table of Contents
|
|||||||
* [With <a href="https://github.com/changyuheng/fz">fz</a>.](#with-fz)
|
* [With <a href="https://github.com/changyuheng/fz">fz</a>.](#with-fz)
|
||||||
* [With <a href="https://github.com/clvv/fasd">fasd</a>.](#with-fasd-1)
|
* [With <a href="https://github.com/clvv/fasd">fasd</a>.](#with-fasd-1)
|
||||||
* [Shell bookmarks](#shell-bookmarks)
|
* [Shell bookmarks](#shell-bookmarks)
|
||||||
* [Google Chrome (OS X/linux)](#google-chrome-os-xlinux)
|
* [Google Chrome](#google-chrome)
|
||||||
* [Browsing history](#browsing-history)
|
* [Browsing history](#browsing-history)
|
||||||
* [Bookmarks](#bookmarks)
|
* [Bookmarks](#bookmarks)
|
||||||
* [Browsing](#browsing)
|
* [Browsing](#browsing)
|
||||||
@@ -1204,10 +1204,11 @@ Yet another useful application for `fzf`: shell bookmarks. It looks as follows:
|
|||||||
|
|
||||||
See complete article for details: [Fuzzy bookmarks for your shell](http://dmitryfrank.com/articles/shell_shortcuts)
|
See complete article for details: [Fuzzy bookmarks for your shell](http://dmitryfrank.com/articles/shell_shortcuts)
|
||||||
|
|
||||||
### Google Chrome (OS X/linux)
|
### Google Chrome
|
||||||
|
|
||||||
#### Browsing history
|
#### Browsing history
|
||||||
|
|
||||||
|
OSX/Linux Version:
|
||||||
```sh
|
```sh
|
||||||
# c - browse chrome history
|
# c - browse chrome history
|
||||||
c() {
|
c() {
|
||||||
@@ -1231,6 +1232,23 @@ c() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Windows Version:
|
||||||
|
```ps1
|
||||||
|
Function c() {
|
||||||
|
$Columns = [int]((get-host).ui.rawui.WindowSize.Width / 3)
|
||||||
|
$Separator ='{::}'
|
||||||
|
$History = "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\History"
|
||||||
|
$TempFile = New-TemporaryFile
|
||||||
|
$Query = "select substr(title, 1, $Columns), url from urls order by last_visit_time desc"
|
||||||
|
Copy-Item $History -Destination $TempFile
|
||||||
|
@(sqlite3 -separator "$Separator" "$TempFile" "$Query") |
|
||||||
|
ForEach-Object {
|
||||||
|
$Title, $Url = ($_ -split $Separator)[0, 1]
|
||||||
|
"$($Title.PadRight($Columns)) `e[36m$Url`e[0m"
|
||||||
|
} | fzf --ansi --multi | ForEach-Object{start-process "chrome.exe" ($_ -replace '.*(https*://)', '$1'),'--profile-directory="Default"'}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Bookmarks
|
#### Bookmarks
|
||||||
|
|
||||||
Chrome Bookmarks browser with [jq](https://stedolan.github.io/jq/) for OS X
|
Chrome Bookmarks browser with [jq](https://stedolan.github.io/jq/) for OS X
|
||||||
@@ -1251,6 +1269,28 @@ b() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Chrome Bookmarks browser with [jq](https://stedolan.github.io/jq/) for Windows
|
||||||
|
```
|
||||||
|
# b - browse chrome bookmarks
|
||||||
|
Function b() {
|
||||||
|
$Bookmarks = "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Bookmarks"
|
||||||
|
|
||||||
|
$JqScript=@"
|
||||||
|
def ancestors: while(. | length >= 2; del(.[-1,-2]));
|
||||||
|
. as `$in | paths(.url?) as `$key | `$in | getpath(`$key) | {name,url, path: [`$key[0:-2] | ancestors as `$a | `$in | getpath(`$a) | .name?] | reverse | join(\`"/\`") } | .path + \`"/\`" + .name + \`"|\`" + .url
|
||||||
|
"@
|
||||||
|
|
||||||
|
Get-Content "$Bookmarks" | jq -r "$JqScript" `
|
||||||
|
| ForEach-Object {
|
||||||
|
$_ -replace "(.*)\|(.*)", "`$1`t`e[36m`$2`e[0m"
|
||||||
|
} `
|
||||||
|
| fzf --ansi `
|
||||||
|
| ForEach-Object {
|
||||||
|
start-process "chrome.exe" ($_ -split "`t")[1],'--profile-directory="Default"'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Chrome Bookmarks browser with ruby
|
Chrome Bookmarks browser with ruby
|
||||||
|
|
||||||
https://gist.github.com/junegunn/15859538658e449b886f (for OS X)
|
https://gist.github.com/junegunn/15859538658e449b886f (for OS X)
|
||||||
|
|||||||
Reference in New Issue
Block a user