mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
28 lines
980 B
Bash
Executable file
28 lines
980 B
Bash
Executable file
if command -v fzf 2>&1 >/dev/null; then
|
|
if command -v fd 2>&1 >/dev/null; then
|
|
export FZF_DEFAULT_COMMAND='fd --no-ignore --hidden --follow --strip-cwd-prefix --exclude .git --exclude node_modules --exclude vendor'
|
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
|
elif command -v rg 2>&1 >/dev/null; then
|
|
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!{.git,node_modules,vendor}/*"'
|
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
|
fi
|
|
fi
|
|
|
|
function fzcd() {
|
|
local dir;
|
|
|
|
while true; do
|
|
dir="$(ls -a1p | grep '/$' | grep -v '^./$' | fzf --height 40% --reverse --no-multi --preview 'pwd' --preview-window=up,1,border-none --no-info)"
|
|
if [[ -z "${dir}" ]]; then
|
|
break
|
|
else
|
|
cd "${dir}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
function fzgit() {
|
|
git log --oneline --decorate --color "${@}" | fzf --ansi --preview 'git show $(echo {} | cut -d" " -f1)'
|
|
}
|
|
|
|
# vim: ft=bash
|