From a212838abfff81e778510faa3e52f9adf4e89595 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 25 Aug 2022 13:43:49 +0200 Subject: [PATCH] Define fzf helper functions properly --- shell/fzf | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/shell/fzf b/shell/fzf index 627bd66..9a090ca 100755 --- a/shell/fzf +++ b/shell/fzf @@ -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_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" 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 +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