Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zshrc: smarter smarter cd #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

zshrc: smarter smarter cd #142

wants to merge 1 commit into from

Commits on Jul 25, 2022

  1. zshrc: smarter smarter cd

    We have to account for a lot of possibilities (see zshbuiltins(1)): we
    stay on the safe side and only change cd target if we're sure about what
    we do. See examples:
    
    % zsh -d -f             # reset the shell
    % cd
    % touch -- -q
    % cd -q                 # should do nothing; 43090cf version behaves weirdly here, replacing -q with .
    % cd /home
    % cd /home /etc         # should go to /etc (replace home with etc in PWD)
    /etc
    % cd /home /etc         # this will fail [1]
    cd: string not in pwd: /home
    % cd /home
    % cd -q /home /etc      # should go to /etc
    /etc
    % cd -q /home /etc      # this will fail [2]
    cd: string not in pwd: /home
    % cd
    % touch +123456
    % cd +123456            # this will fail [3]; 43090cf version behaves weirdly here, replacing +123456 with .
    
    [1]   I chose to make this one work. If `cd old new` fails, then try to
          `cd old`
    [2,3] I chose to fail too in that case. Handling cd arguments is not what
          I was planning to do when I started working on this patch ;P
    moviuro committed Jul 25, 2022
    Configuration menu
    Copy the full SHA
    579eaad View commit details
    Browse the repository at this point in the history