mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 23:33:39 -05:00
Updated Examples (markdown)
13
Examples.md
13
Examples.md
@@ -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)"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user