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

Feature #15

Open
JumpIn-Git opened this issue Nov 17, 2024 · 15 comments
Open

Feature #15

JumpIn-Git opened this issue Nov 17, 2024 · 15 comments

Comments

@JumpIn-Git
Copy link

When typing dots for a file path, eg typing ... will result in ../.. but i think it would be better if it was ../../ since you can still reference the path but also autocomplete a file without having to type a extra /

@injust
Copy link

injust commented Nov 18, 2024

This doesn't seem very reasonable to me. For ./foo and ../foo, you have to type the / yourself. Why should the ... abbreviation be any different?

@daUnknownCoder
Copy link

@injust but can we have that, its 4 hours since i started racking my brains on this same qs, gave up, came to this page to create an issue, thought of looking here and there and found this, so is this possible?

ok, @JumpIn-Git might not have explained the usecase properly, but:

suppose i wanna go 5 levels below and print a file:
bat ../../../../../some.file right?
when using puffer fish, it becomes:
bat ....../some.file (notice the / i have to put)

muscle memory does: ......some.file instead of ....../some.file
which becomes:

image

instead of:

image

btw, is this even doable because i racked my brains for 2 hours, while also using chatGPT, when i wasnt able to get some answer, i used copilot, i used perplexity, then i gave up can came here (Gemini is utterly useless in coding and in general too)

@injust
Copy link

injust commented Nov 19, 2024

muscle memory does: ......some.file instead of ....../some.file

Why do you have this muscle memory in the first place?

For 1 or 2 dots, you have to type the slash. This plugin doesn't affect those cases (./some.file and ../some.file).

For 3+ dots, why do you want to omit the slash? IMO it feels unintuitive because it doesn't match the other cases.

@daUnknownCoder
Copy link

daUnknownCoder commented Nov 19, 2024

Why do you have this muscle memory in the first place?

due to these aliases

# below ones turned off in favour of puffer-fish plugin
# function ..
#     cd ../
# end
# function ...
#     cd ../../
# end
# function ....
#     cd ../../../
# end
# function .....
#     cd ../../../../
# end
# function ......
#     cd ../../../../../
# end

like: idk how to explain this, but i wanna type .... (any number of times) and do not waste that muscle memory to type that / becz .... and then i have to type file name, but i have to type a /

@injust
Copy link

injust commented Nov 19, 2024

I also type ... if I want to cd upwards 2 directories, but I don't have the same muscle memory problem. I think what you want is rather unconventional.

You could fork and tweak https://github.com/nickeb96/puffer-fish/blob/master/functions/_puffer_fish_expand_dots.fish to work for your use case, but I have a feeling it wouldn't be accepted as a feature.

@daUnknownCoder
Copy link

im not that well acquainted with fish shell, but what i want, is that possible? becuase im not able to do it with chatgpt's help idk whats so hard for appending just 1 damn slash...

if string match --quiet --regex -- '^(\.\./)*\.\.$' $split[-1]
        commandline --insert '/..'
# ...
end

/../ doesnt work, because then i have to type 1 more . for the next slash (.... instead of ... for ../../)

@injust
Copy link

injust commented Nov 19, 2024

/../ doesnt work, because then i have to type 1 more . for the next slash (.... instead of ... for ../../)

It's definitely possible, But you'll probably have to tweak the regex.

@daUnknownCoder
Copy link

/../ doesnt work, because then i have to type 1 more . for the next slash (.... instead of ... for ../../)

It's definitely possible, But you'll probably have to tweak the regex.

ik but idk how to achieve it exacly, can you provide some pointers, and i can definitiely use chatgpt for the help

@injust
Copy link

injust commented Nov 19, 2024

ik but idk how to achieve it exacly, can you provide some pointers, and i can definitiely use chatgpt for the help

Figure out what the regex is matching on, and go from there. That's all I can say without ruining all the fun.

Also, what you want is fundamentally flawed. What would you type if you wanted ../../.foo?

@daUnknownCoder
Copy link

What would you type if you wanted ../../.foo?

why would you do this? if you want to open a file 2 levels below, you do .... which changes to ../../ which means you directly type foo right? it never is .....foo (../../.foo) it will always be ....foo (../../foo)

@injust
Copy link

injust commented Nov 19, 2024

why would you do this?

What if my file is a dotfile/hidden file named .foo?

@daUnknownCoder
Copy link

why would you do this?

What if my file is a dotfile named .foo?

what is .foo anyway? a file extension? fish surely will fuck me with some error codes, if you are doing a search then it will be a *.foo right and not .foo

@injust
Copy link

injust commented Nov 19, 2024

what is .foo anyway? a file extension? fish surely will fuck me with some error codes, if you are doing a search then it will be a *.foo right and not .foo

I'm talking a literal file named .foo. This could be any file name prefixed with a ., e.g. .gitconfig.

@daUnknownCoder
Copy link

daUnknownCoder commented Nov 19, 2024

ooohh i understand now, if i wanna do nvim .....config/fish/config.fish (nvim ../../.config/fish/config.fish) -> the .config's . will also change to a ../ yep i understand and ig @JumpIn-Git also gets it

@daUnknownCoder
Copy link

yep yep ig i should start typing / which will be better, thanks @injust for the insight about the flip side of the coin

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

No branches or pull requests

3 participants