-
Notifications
You must be signed in to change notification settings - Fork 45
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
'~' for home directory #70
Comments
Could you explain why you'd want this behaviour? |
Just for being able to more quickly scan the completions results and save screenspace. |
The tab completions (if that's what you were referring to) was not an original feature of z, and was built because it was easy to do so in this fish port. That said, it was never meant to be for how z were to be used. In most cases, typing |
Cool, thanks a lot for the explanation! In both cases I'd find it easier to check whether it's the directory I wanted if there would be only "~". I had already briefly once tried to add this, should it theoretically be sufficient to change the $PWD in https://github.com/jethrokuan/z/blob/master/functions/__z_add.fish#L3 to a path where $HOME is replaced in $PWD? (I see that this could be problematic for upgrading users.) |
I'm not sure why you would see the directory path. In the main use-case, the user would automatically be changed to the directory without prompting. If you insist, I recommend that you keep the data file the same, storing absolute paths, and then in the completions using |
Thanks, i'll give this a try! |
I think this is impossible. Try this: complete -xc foo -a "~" foo<TAB>/Users/me As you can see fish expands |
@jorgebucaran I don't understand the example you're showing but maybe it's related to what i found? I tried changing in set -l __z_marks (string replace -r '\|.*' '' < $Z_DATA | string escape | string replace $HOME '~') I still get expanded items with Trying only string replace -r '\|.*' '' < $Z_DATA | string escape | string replace $HOME '~' in the shell works as expected. |
yup @jorgebucaran is showing that the complete function expands |
@rgieseke See my screenshot. It shows I added a Still fish shows my full |
@jorgebucaran @jethrokuan Thanks for the explanations! This might be related? fish-shell/fish-shell#4570 When I experimented with replacing $HOME as above I once had a state where the "~" appeared escaped (not a real improvement) and fish wouldn't find the directory to change to. |
In any case i realised that i probably need tab completion much less than i thought (never having used z before) - just typing "something" is indeed enough most of the time. |
@rgieseke Yeah, you can escape it: complete -xc foo -a "\~" or complete -xc foo -a \\~ ...and this is the result. foo<TAB>\~ This, however, is worse, because you have an invalid path now and it looks ugly. |
Closing as unsolvable. |
Thanks for this amazing tool/port to fish!
Could there be a way to replace "/home/username/" or "/Users/username" with "~" in the completions?
The text was updated successfully, but these errors were encountered: