-
-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show found files as hyperlinks just as ls does? #1295
Comments
I think this might be nice. However, we could also do this with a shell wrapper. Here are a couple of quick attempts at that in bash and nushell, preserving fd's colored output, and assuming we want a link to open the path in VSCode. bash: (requires function hyperlink() {
local url="$1"
local text="$2"
printf '\e]8;;%s\e\\%s\e]8;;\e\\\n' "$url" "$text"
}
function fd() {
local _path
command fd --color=always "$@" \
| while read _path; do
local abspath=$(readlink -f $(echo -n $_path | ansifilter))
local url="vscode://file/$abspath"
hyperlink $url $_path
done
} nushell: (nushell currently doesn't support passing arbitrary arguments on to the wrapped executable) export def 'str hyperlink' [text: string] {
let url = $in
let osc8 = (ansi -o '8;;')
let st = (ansi st)
$"($osc8)($url)($st)($text)($osc8)($st)"
}
export def fd [
pattern: string,
path: string = ".",
] {
^fd --color=always $pattern $path
| lines
| each {
|s| $'vscode://file/($s | ansi strip | path expand)' | str hyperlink $s
}
| to text
} |
another alternative: piping the output to # hyperlinked_fd
hfd() {
fd "$@" --type=file -X ls -l --hyperlink=auto
}
|
Fixes: sharkdp#1295 Fixes: sharkdp#1563
Fixes: sharkdp#1295 Fixes: sharkdp#1563
As a workaround until #1571 is released you could use the
You may want to use an alias or wrapper script. |
Fixes: sharkdp#1295 Fixes: sharkdp#1563
Could it possible that
fd
would return its results as hyperlinks, just asls
, for instance, does:(Which -- in some terminal emulators -- would allow to open the found files with hotkeys, like via the "Hints" mechanism in
alacritty
.)The text was updated successfully, but these errors were encountered: