badmotorfinger / z

Save time typing out directory paths in PowerShell by jumping around instead.
The Unlicense
430 stars 33 forks source link

Tab completion should suggest unambiguous path #28

Closed masaeedu closed 7 years ago

masaeedu commented 8 years ago

With version 1.1.5, switching between tab completion suggestions only yields the name of the deepest directory. This is not sufficient to unambiguously identify the directory in question, so if you have e.g. the following directories in history:

There is no way to tab select E:\depot\git\TypeScript. Selecting either option takes you to E:\depot\untracked\typescript11821.

badmotorfinger commented 8 years ago

Thanks for submitting this issue.

z will chose a directory based on 'frecency', unless you are explicit with the -Option parameter.

I just tried your directory structure by creating the same folder names and indeed, doing a z typescript did go to typescript11821, however, if I 'cd' into 'typescript' a few times then it will have a higher rank and will be chosen in favour of typescript 11821

masaeedu commented 8 years ago

@vincpa Yes, but if I wanted to go to the closest match I wouldn't be using tab selection anyway, I'd just do z typescript. In this particular case I did z typescript, realized the best match is not the one I need, and now need to go to a different match. This is what tab selection should be useful for. I don't think cd-ing to the other folder manually an indeterminate number of times is a good workflow for choosing between multiple options that are all used frequently.

badmotorfinger commented 8 years ago

z is about chosing a match based on frequency of access as determined by this formula https://github.com/vincpa/z/blob/master/z.psm1#L383

You shouldn't have to cd in to a directory to get a higher rank. I agree, this is a bad workflow. You can press multiple times to get to your selection based on frequency.

I'm sorry if I don't understand the problem you're having. Perhaps you can make a change to the script via a PR or explain it a bit further with a full example with repeatable steps.

masaeedu commented 8 years ago

@vincpa Hopefully a recording will help explain better:

Repro gif

I understand that z uses a particular formula to order matches according to usefulness, which is excellent. However, when an option is selected using tab completion (implemented in #17), the user should be taken to the option that they explicitly selected, instead of once again to the most 'frecent' match. If tab selection is also going to take you to the most 'frecent' match, instead of allowing you to explicitly select which match you want to navigate to, there is no point to having tab selection.

badmotorfinger commented 8 years ago

I understand what you are saying now. Thanks for that video :)

Suppose you have two directories with the same name, such as "Temporary Internet Files" which exists for different versions of .NET. What does explicit selection then mean? The whole purpose of tab is to present you with a list in order of 'frecency'.

I do however see usefulness in what you are saying. Let me see if I can fix this behaviour.

On 25 October 2016 at 12:45, Asad Saeeduddin notifications@github.com wrote:

@vincpa https://github.com/vincpa Hopefully a recording will help explain better: https://y8xx7w.by3302.livefilestore.com/ y3muzHoUhfrjrgX2AqGmN7ElKwUJ7W2XFkpcidqShC4bElV- 8PEDCtMLeSVtLrrSpm4D8xE4emveD2Mp67SiQNUEilg-xqhM1B- jkJm0AWAcp3hUkdSPc0gwmTb81TTW-CVIn7Hhc8E0o72cY FT69pxqCn4jo687HIJ7s5rkkwCI/2016-10-24_21-39-00.gif?psid=1

I understand that z uses a particular formula to order matches according to usefulness, which is excellent. However, when an option is selected using tab completion (implemented in #17 https://github.com/vincpa/z/issues/17), the user should be taken to the option that they explicitly selected, instead of once again to the most 'frecent' match. If tab selection is also going to take you to the most 'frecent' match, instead of allowing you to explicitly select which match you want to navigate to, there is no point to having tab selection.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vincpa/z/issues/28#issuecomment-255913685, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa9d-p2nyi3FyVV52J7VfI5CKaMhWmRks5q3V9EgaJpZM4KfapC .

masaeedu commented 8 years ago

Suppose you have two directories with the same name, such as "Temporary Internet Files" which exists for different versions of .NET. What does explicit selection then mean?

I would still want to be able to select either of them via tab selection, as differentiated by the full path. Thanks for considering the change.

My personal suggestion would be to do the following:

badmotorfinger commented 7 years ago

Two suggestions implemented. Closing ticket and will create a release shortly on PowerShell gallery. Thank you for your useful suggestions.