mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-17 07:43: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
|
like normal autojump when used with arguments but displays an fzf prompt when used without
|
||||||
```sh
|
```sh
|
||||||
j() {
|
j() {
|
||||||
if [[ "$#" -ne 0 ]]; then
|
local preview_cmd="ls {2}"
|
||||||
cd $(autojump $@)
|
if command -v exa &> /dev/null; then
|
||||||
return
|
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
|
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