Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
ravindUwU wants to merge 4 commits into philc:master
base: master
Choose a base branch
Loading
from ravindUwU:feat/goUp-pop-params

Conversation

@ravindUwU
Copy link

@ravindUwU ravindUwU commented Jun 18, 2025
edited
Loading

Description

This PR,

  • Changes how goUp manipulates the URL, using a URL object to parse/get/set its components where possible.

  • Adds 2 count-compatible Boolean options to goUp:

    • popAnchor removes the anchor/hash/fragment from the URL.
      example.com/a?b=c#dexample.com/a?b=c.

    • popQuery removes query params and the anchor from the URL.
      example.com/a?b=c#dexample.com/a.

Fixes #3763. Also relevant: #1344.

Usage

  • map gu goUp
    example.com/a/b?c=d#eexample.com/aexample.com

  • map gu goUp popAnchor
    example.com/a/b?c=d#eexample.com/a/b?c=dexample.com/aexample.com

  • map gu goUp popQuery
    example.com/a/b?c=d#eexample.com/a/bexample.com/aexample.com

  • map gu goUp popAnchor popQuery
    example.com/a/b?c=d#eexample.com/a/b?c=dexample.com/a/bexample.com/aexample.com

Subdomains

#3763 also suggests popping subdomains, but it's unclear how/if port numbers should be manipulated when navigating up a subdomain. e.g., should goUp from owo.example.com:1337 navigate 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 🤔.

@ravindUwU ravindUwU changed the title (削除) Add goUp options to pop URL anchor/fragment/hash & query string. Fixes #3763 (削除ここまで) (追記) Add goUp options to pop URL anchor/fragment/hash & query string (追記ここまで) Jun 18, 2025
Copy link
Owner

philc commented Jun 29, 2025

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 goUp today is what I most generally want: go one path upward, and remove any query strings or anchors along the way, without needing several invocations. If accurate, then we shouldn't change that default behavior by making the first invocation remove the query string or hash anchor if present.

I find removing query strings and anchors to be rare. When I need to do it, I use ge to edit the current url, and ctrl-w on Mac (which deletes a whole word) to remove hunks of the URL. This is fast enough for me. If I wanted to copy and paste the URL without the anchor portion, I would copy it with yy and edit it after pasting.

Copy link
Author

ravindUwU commented Jun 29, 2025
edited
Loading

Hi @philc 👋

expand on your use cases which requires popping the query string or anchor

Personally, removing the anchor is something I do quite often! e.g., I'd follow a link to the documentation for the System.IO.DirectoryInfo.GetFiles(String, EnumerationOptions) .NET method overload. This link has the anchor #system-io-directoryinfo-getfiles(system-string-system-io-enumerationoptions), which I'd like to remove to form the link to the documentation of the .NET method group. My options are to,

  1. Visit the link to the .NET method group from elsewhere on the same page (e.g., sidebar). But, what if there is no sidebar, or it is collapsed or out of view by default?
  2. (Similar to what you suggested) Ctrl+L to focus the URL bar, End to go to the end of the URL, Ctrl+Backspace 9 times and then a final Backspace to delete word-by-word until the anchor and the # is removed, finally Enter to accept. But, that's a lot of key presses!
  3. Or if goUp can remove the anchor if it exists, simply, goUp.

(削除) Popping the query string on the other hand isn't something I do often. (削除ここまで) (Edit because this just happened). Popping the query string might be useful when, e.g., I'm on the Discord server search page for a specific search term https://discord.com/servers?query=huh and I want to drop the search term (in this case ?query=huh) to visit their server list, which is simply https://discord.com/servers. My options are to,

  1. Scroll uppppppppppp to locate the "x" button in the search bar on the page, and press it (which in this case is possible with Vimium; but there are many websites with small, interactive elements that aren't marked as such using accessibility attributes (role, tabindex, etc.), and therefore aren't detected by Vimium).
  2. Ctrl+L, End, Ctrl+Backspace twice, Backspace once more, Enter.
  3. Or if goUp can remove the query string if it exists, simply, goUp.

then we shouldn't change that default behavior ...

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.

Copy link
Author

Hi @philc 👋 Thoughts on the above? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

goUp command should work with page anchors (#xxx), query strings (?xxx), and sub-domains (xxx.)

2 participants

AltStyle によって変換されたページ (->オリジナル) /