m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 23:33:39 -05:00

Updated Examples (markdown)

Tru
2023-03-21 01:45:11 +08:00
parent 70c6a136e4
commit fdbc141b6c

@@ -1642,11 +1642,16 @@ function cd() {
like normal autojump when used with arguments but displays an fzf prompt when used without
```sh
j() {
if [[ "$#" -ne 0 ]]; then
cd $(autojump $@)
return
local preview_cmd="ls {2}"
if command -v exa &> /dev/null; then
preview_cmd="exa -l {2}"
fi
if [[ $# -eq 0 ]]; then
cd "$(autojump -s | sort -k1gr | awk '$1 ~ /[0-9]:/ && $2 ~ /^\// {print $1 " " $2}' | fzf --height 40% --reverse --inline-info --preview "$preview_cmd" --preview-window down:50% | awk '{print $2}')"
else
command autojump "$@"
fi
cd "$(autojump -s | sort -k1gr | awk '$1 ~ /[0-9]:/ && $2 ~ /^\// { for (i=2; i<=NF; i++) { print $(i) } }' | fzf --height 40% --reverse --inline-info)"
}
```