Skip to content

Unique path_prefix #514

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

Open
phy1729 opened this issue Apr 14, 2018 · 9 comments
Open

Unique path_prefix #514

phy1729 opened this issue Apr 14, 2018 · 9 comments
Assignees
Labels

Comments

@phy1729
Copy link
Member

phy1729 commented Apr 14, 2018

Possibly add a new style path_prefix_unique when the path prefix only matches a single file for a hint to hit tab.

@phy1729 phy1729 added the Idea label Apr 14, 2018
@danielshahaf
Copy link
Member

Reminds of of #148, which was a similar idea for command words.

@phy1729
Copy link
Member Author

phy1729 commented Apr 21, 2018

Should path_prefix_unique_pathseparator fall back to path_prefix_unique or path_prefix_pathseparator or something else? I'm inclined towards the former, but not strongly.

@danielshahaf
Copy link
Member

I'd have voted for the latter, since that would maintain the distinction between a terminal separator and the characters before it, and those characters would be highlighted as path_prefix_unique anyway which would serve to convey the uniqueness...

...but I don't highlight path separators differently to other characters in pathnames. Let's ask the authors of the pathseparators PR (#136 #260).

@blaenk @m0vie WDYT regarding @phy1729's question?

@blaenk
Copy link

blaenk commented Apr 21, 2018

I'd have voted for the latter, since that would maintain the distinction between a terminal separator and the characters before it, and those characters would be highlighted as path_prefix_unique anyway which would serve to convey the uniqueness...

Thanks for the ping. IIUC, I do agree with this. It'd feel weird to have the path separators suddenly change/remove highlighting when the prefix became unique, reminiscent of the flickering that (used to?) happen.

@phy1729 phy1729 self-assigned this Apr 21, 2018
@phy1729
Copy link
Member Author

phy1729 commented Apr 21, 2018

those characters would be highlighted as path_prefix_unique anyway which would serve to convey the uniqueness...

Right, indeed the latter makes more sense. I'll open a PR after #512 since they'll conflict.

@m0vie
Copy link
Contributor

m0vie commented Apr 21, 2018

I'd have voted for the latter, since that would maintain the distinction between a terminal separator and the characters before it, and those characters would be highlighted as path_prefix_unique anyway which would serve to convey the uniqueness...

I also agree with this.

@Sarke
Copy link

Sarke commented Jul 11, 2019

I think this is a great suggestion. How can this be implemented?

@danielshahaf
Copy link
Member

danielshahaf commented Jul 20, 2019

There's a (( $#tmp > 0 )) && REPLY=path_prefix on line 978 in current HEAD (I can't permalink, sorry). Check if ! (( $+tmp[2] )). We may be able to optimize this further with glob qualifiers: for example, integer foo; f() { (( ++foo )) }; : *(N+f).

(edit: The optimization example probably needs to do reply=(), in order to avoid constructing a temporary array.)

@danielshahaf
Copy link
Member

There's also *(Y2) but it's not available in all supported zsh versions.

Finally, I wonder if perchance there already exists a zsh plugin that provides this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants