-
Couldn't load subscription status.
- Fork 2.5k
Add goUp options to pop URL anchor/fragment/hash & query string
#4718
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
base: master
Are you sure you want to change the base?
Conversation
goUp options to pop URL anchor/fragment/hash & query string. Fixes #3763goUp options to pop URL anchor/fragment/hash & query string
9344dfd to
441acf0
Compare
|
Please expand on your use cases which requires popping the query string or anchor often enough for it to be a command or option. For my own usage, I think the default behavior of I find removing query strings and anchors to be rare. When I need to do it, I use |
|
Hi @philc 👋
Personally, removing the anchor is something I do quite often! e.g., I'd follow a link to the documentation for the
Agreed; the default behaviour should not change. This PR adds these as opt-in options so they are disabled by default, and can be enabled by those who find them useful. |
|
Hi @philc 👋 Thoughts on the above? 😅 |
Description
This PR,
Changes how
goUpmanipulates the URL, using aURLobject to parse/get/set its components where possible.Adds 2 count-compatible Boolean options to
goUp:popAnchorremoves the anchor/hash/fragment from the URL.example.com/a?b=c#d→example.com/a?b=c.popQueryremoves query params and the anchor from the URL.example.com/a?b=c#d→example.com/a.Fixes #3763. Also relevant: #1344.
Usage
map gu goUpexample.com/a/b?c=d#e→example.com/a→example.commap gu goUp popAnchorexample.com/a/b?c=d#e→example.com/a/b?c=d→example.com/a→example.commap gu goUp popQueryexample.com/a/b?c=d#e→example.com/a/b→example.com/a→example.commap gu goUp popAnchor popQueryexample.com/a/b?c=d#e→example.com/a/b?c=d→example.com/a/b→example.com/a→example.comSubdomains
#3763 also suggests popping subdomains, but it's unclear how/if port numbers should be manipulated when navigating up a subdomain. e.g., should
goUpfromowo.example.com:1337navigate to,owo.example.com(dropped port)?example.com:1337(dropped subdomain)?example.com(both dropped)?IMO, there is no correct option here because it depends on what's at the URL, so I think it'd be best to leave the host name as-is. This would also be consistent with
goToRoot🤔.