Define fzf helper functions properly

This commit is contained in:
Loic Nageleisen 2022-08-25 13:43:49 +02:00
parent 5e6ebcac2b
commit a212838abf
Signed by: lloeki
GPG key ID: D05DAEE6889F94C2

View file

@ -6,23 +6,23 @@ if command -v fzf 2>&1 >/dev/null; then
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!{.git,node_modules,vendor}/*"' export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!{.git,node_modules,vendor}/*"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi fi
function fcd() {
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 fgit() {
git log --oneline --decorate --color | fzf --ansi --preview 'git show $(echo {} | cut -d" " -f1)'
}
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 # vim: ft=bash