From 4f3c6dff930b91a3aedeea28ca602a9ba7831dde Mon Sep 17 00:00:00 2001 From: Matt Hayden Date: Thu, 23 Mar 2023 09:45:11 -0600 Subject: [PATCH] Use pushd within bash completion --- shell/key-bindings.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index d83f9d3ed92..4cf7b28f949 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -40,12 +40,12 @@ fzf-file-widget() { READLINE_POINT=$(( READLINE_POINT + ${#selected} )) } -__fzf_cd__() { +__fzf_pushd__() { local cmd opts dir cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | cut -b3-"}" opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m" - dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir" + dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin pushd -- %q' "$dir" } __fzf_history__() { @@ -95,7 +95,7 @@ else fi # ALT-C - cd into the selected directory -bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"' +bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_pushd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"' bind -m vi-command '"\ec": "\C-z\ec\C-z"' bind -m vi-insert '"\ec": "\C-z\ec\C-z"'