ALT+C don't print on cd #4435
              
                
                  
                  
                    Answered
                  
                  by
                    aorith
                  
              
          
                  
                    
                      omnigenous
                    
                  
                
                  asked this question in
                Q&A
              
            -
| ALT+C prints  Could I change this so it doesn't print anything and just silently change dir? | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            aorith
          
      
      
        Aug 7, 2025 
      
    
    Replies: 1 comment 4 replies
-
| You can re-define the cd function AFTER you source the shell key-bindings. __fzf_cd__() {
  local dir
  dir=$(
    FZF_DEFAULT_COMMAND=${FZF_ALT_C_COMMAND:-} \
    FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=dir,follow,hidden --scheme=path" "${FZF_ALT_C_OPTS-} +m") \
    FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd)
  ) && printf 'builtin cd -- %q' "$(builtin unset CDPATH && builtin cd -- "$dir" && builtin pwd)" >/dev/null
}Source: https://github.com/junegunn/fzf/blob/master/shell/key-bindings.bash#L72 EDIT: for zsh it is more involved, this seems to work: fzf-cd-widget() {
  setopt localoptions pipefail no_aliases 2> /dev/null
  local dir="$(
    FZF_DEFAULT_COMMAND=${FZF_ALT_C_COMMAND:-} \
    FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=dir,follow,hidden --scheme=path" "${FZF_ALT_C_OPTS-} +m") \
    FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) < /dev/tty)"
  if [[ -z "$dir" ]]; then
    zle redisplay
    return 0
  fi
  zle push-line # Clear buffer. Auto-restored on next prompt.
  builtin cd -- ${(q)dir:a} >/dev/null
  local ret=$?
  unset dir # ensure this doesn't end up appearing in prompt expansion
  zle reset-prompt
  return $ret
}Source: https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh#L110-L113 | 
Beta Was this translation helpful? Give feedback.
                  
                    4 replies
                  
                
            
      Answer selected by
        omnigenous
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    

You can re-define the cd function AFTER you source the shell key-bindings.
For example, for bash you can just redirect the output to
/dev/null:Source: https://github.com/junegunn/fzf/blob/master/shell/key-bindings.bash#L72
EDIT: for zsh it is more involved, this seems to work: