1

I really like the oh my zsh feature that allows you to navigate to the folder that contains a file. I don't know if it's a plugin or a configuration.

I've been testing the following settings but haven't found it:

setopt auto_name_dirs
setopt auto_cd
setopt cdable_vars
setopt pushd_ignore_dups
setopt auto_pushd

The idea is to drag and drop a file to the terminal app (in mac) and then navigate to its folder, but without using oh my zsh. Do anyone know how this can be done?

Thanks!

0

I have found it: https://unix.stackexchange.com/questions/76227/how-to-make-cd-dir-filename-take-me-to-dir

I've added this function to my .zshrc:

cd() {
    if [ -d "$1" ] || [ -z "$1" ]; then
        builtin cd "$@"
    else
        builtin cd "${1%/*}"
    fi
}

and it's working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.