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

Don't set auto_name_dirs because it messes up prompts #3252

Merged
merged 1 commit into from Oct 22, 2014

Conversation

mcornella
Copy link
Member

Quick test:

Run in order:

PROMPT="%~ $ "
unsetopt auto_name_dirs
mkdir longnameddirectory
cd longnameddirectory
dir="$PWD"

afterwards, run:

setopt auto_name_dirs
dir="$PWD"

Which should look like this:

> PROMPT="%~ $ "
~ $ unsetopt auto_name_dirs
~ $ mkdir longnameddirectory
~ $ cd longnameddirectory
~/longnameddirectory $ dir="$PWD"
~/longnameddirectory $ # prompt doesn't change
~/longnameddirectory $ setopt auto_name_dirs
~/longnameddirectory $ dir="$PWD"
~dir $ # prompt now uses ~dir instead

From http://zsh.sourceforge.net/Doc/Release/Options.html#Completion-4

AUTO_NAME_DIRS
Any parameter that is set to the absolute name of a directory immediately
becomes a name for that directory, that will be used by the ‘%’ and
related prompt sequences, and will be available when completion is performed
on a word starting with ‘
’.
(Otherwise, the parameter must be used in the form ‘~param’ first.)

Explained in more detail in
rvm/rvm#3091 (comment)

Related issues:
#2857
#3238
rvm/rvm#3091

Fix #3238, close #3244.

From http://zsh.sourceforge.net/Doc/Release/Options.html#Completion-4

> AUTO_NAME_DIRS
> Any parameter that is set to the absolute name of a directory immediately
> becomes a name for that directory, that will be used by the ‘%~’ and
> related prompt sequences, and will be available when completion is performed
> on a word starting with ‘~’.
> (Otherwise, the parameter must be used in the form ‘~param’ first.)

Explained in more detail in
rvm/rvm#3091 (comment)

Related issues:
ohmyzsh#2857
ohmyzsh#3238
rvm/rvm#3091
@mcornella
Copy link
Member Author

/cc @robbyrussell

@timdiggins
Copy link

+1 -- (the AUTO_NAME_DIRS + rvm latest also breaks switching to same directory on new tab in OS X Terminal.app)

@mcornella
Copy link
Member Author

@red56: what breaks switching, this PR or the auto_name_dirs option?

robbyrussell added a commit that referenced this pull request Oct 22, 2014
Don't set auto_name_dirs because it messes up prompts
@robbyrussell robbyrussell merged commit 7f07fac into ohmyzsh:master Oct 22, 2014
@timdiggins
Copy link

@mcornella the auto_name_dirs (+ rvm, in rvm-managed dir) breaks switching (because it's trying to switch from ~RVM_PROJECT_PATH)

@mcornella
Copy link
Member Author

Ok, so this PR fixes that. Thank you for noticing and commenting here.
Hopefully updating oh-my-zsh fixes everything, now that it's merged.

Cheers!

Marc

@timdiggins
Copy link

@mcornella yes just verified that this PR fixes that. Thanks for fixing!

@clarkewd
Copy link

i think this was also the cause of #3238

Thanks for finding and fixing this! :)

@mcornella
Copy link
Member Author

Indeed it was, @clarkewd, as I explained in the issue in rvm's repo: rvm/rvm#3091 (comment).

Marc

@mcornella mcornella deleted the fix-auto-named-dirs-prompt branch October 22, 2014 16:11
@vidmantas
Copy link

Finally, +1

monfresh added a commit to monfresh/dotfiles that referenced this pull request Nov 6, 2014
It should have been fixed according to this:
ohmyzsh/ohmyzsh#3252

But I’m still seeing it.
blaedj added a commit to blaedj/oh-my-zsh that referenced this pull request Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shell prompts break and show RVM_PROJECT_PATH when used with rvm
5 participants