nickeb96 / puffer-fish

🐡 Text Expansions for Fish
MIT License
279 stars 5 forks source link

Feature #15

Open JumpIn-Git opened 2 days ago

JumpIn-Git commented 2 days ago

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 commented 1 day ago

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 commented 7 hours ago

@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 commented 6 hours ago

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 commented 6 hours ago

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 commented 6 hours ago

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 commented 5 hours ago

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 commented 5 hours ago

/../ 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 commented 5 hours ago

/../ 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 commented 5 hours ago

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 commented 4 hours ago

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 commented 4 hours ago

why would you do this?

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

daUnknownCoder commented 4 hours ago

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 commented 4 hours ago

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 commented 4 hours ago

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 commented 4 hours ago

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