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

Smart case sensitivity matching by default #221

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

Conversation

ericbn
Copy link
Contributor

@ericbn ericbn commented Nov 10, 2017

and add parameters to force case insensitive (-i) or case sensitive (-s) matching.

Also rename t variable in main awk script to now, as used in the --add awk script, use constant regular expression instead of string, and add double quotes to shell script variables.

There are minor changes from smart-case to the original "prefer case sensitive" implementation.

Considering these directories with their respective 'frecencies':

 3          /tmp/foo/bar
 5          /tmp/foo/Baz
 8          /tmp/Baz
 13         /tmp/bar
 21         /tmp

These would be the results of different queries with the two approaches, considering a filesystem that allows directories with same names and different cases:

query smart-case prefer case sensitive
tm /tmp /tmp
Tm (nothing) /tmp
ba /tmp/bar /tmp/bar
Ba /tmp/Baz /tmp/Baz
fo ba /tmp/foo/Baz /tmp/foo/bar
fo Ba /tmp/foo/Baz /tmp/foo/Baz

Fixes #209

and add parameters to force case insensitive (`-i`) or case sensitive
(`-s`) matching.

Also rename `t` variable in main awk script to `now`, as used in the
`--add` awk script, use constant regular expression instead of string,
and add double quotes to shell script variables.

There are minor changes from smart-case to the original "prefer case
sensitive" implementation.

Considering these directories with their respective 'frecencies':

     3          /tmp/foo/bar
     5          /tmp/foo/Baz
     8          /tmp/Baz
     13         /tmp/bar
     21         /tmp

These would be the results of different queries with the two approaches,
considering a filesystem that allows directories with same names and
different cases:

| query | smart-case   | prefer case sensitive |
|-------|--------------|-----------------------|
| tm    | /tmp         | /tmp                  |
| Tm    | (nothing)    | /tmp                  |
| ba    | /tmp/bar     | /tmp/bar              |
| Ba    | /tmp/Baz     | /tmp/Baz              |
| fo ba | /tmp/foo/Baz | /tmp/foo/bar          |
| fo Ba | /tmp/foo/Baz | /tmp/foo/Baz          |

Fixes rupa#209
@partounian
Copy link

Random question but how do I cd by index/number?

@ericbn
Copy link
Contributor Author

ericbn commented Nov 21, 2017

Random question but how do I cd by index/number?

You should probably file a new issue with your question, to avoid non-related discussions here. Short answer: this is not implemented by z. I suggest you combine z with fzf for an interactive list you can browse. Check https://github.com/junegunn/fzf/wiki/Examples#integration-with-z

@partounian
Copy link

Sorry about that brain fart, not sure why I didn't do it at the time.

Copy link

@dmd dmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a LOT of added complexity for something I believe very few people would use. I would lean towards reject.

@ericbn
Copy link
Contributor Author

ericbn commented Oct 24, 2019

If you look closer I'm even removing some of the original complexity. For example, I'm removing the ihi_rank and all the extra logic related to it.

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.

Support smart case
3 participants