Vim Style Navigation (with Settings + Enhanced)

Vim-style scrolling + hint(f/F), find(/ n/N), history(H/L), page ops(r t x*), misc(yy p o ?). UserScript-safe fallbacks.

Verze ze dne 01. 09. 2025. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Autor
bianwenbo
Hodnocení
0 0 0
Verze
2.2.0
Vytvořeno
31. 08. 2025
Aktualizováno
01. 09. 2025
Size
20,6 KB
Licence
MIT
Spustit na
všech stránkách

Vim Style Navigation (with Settings + Enhanced)

A Tampermonkey userscript that brings Vim-style navigation to the web:

  • Scrolling: hjkl, d/u, gg/G
  • Link hints: f / F
  • Find: /, n / N
  • History: H / L
  • Page ops: r, t, x*
  • Misc: yy, p, o, ?

* x can only close tabs that were opened by scripts (browser restriction).


✨ Features

Scrolling

  • h / l — scroll left/right
  • j / k — scroll down/up
  • d / u — page down/up (distance = baseStep + extraPage)
  • gg / G — jump to top/bottom

Link Hint

  • f — open hinted link in current tab
  • F — open hinted link in new tab (uses GM_openInTabwindow.open fallback)

Find

  • / — open lightweight find bar
  • n / N — next / previous match (based on window.find)

History & Page Ops

  • H — back, L — forward
  • r — reload, t — new tab, x — close tab*
  • J/K tab switching is not available in UserScript due to browser permissions.

Misc

  • yy — copy current page URL (clipboard API / GM fallback)
  • p — open URL from clipboard (or prompt fallback)
  • o — open URL or search (prompt)
  • ? — help overlay

Smart input detection: Hotkeys are disabled inside INPUT / TEXTAREA / SELECT / contentEditable / designMode=on.


⚙️ Settings (Tampermonkey Menu)

Open Tampermonkey → this script → Menu Commands to adjust:

  • Base Step (baseStep, default 100)
  • Extra Page (extraPage, default 300)
  • gg Interval (ggIntervalMs, default 600 ms)
  • Native Smooth Scroll (useNativeSmooth, on/off)
  • Ignore Modifier Keys (ignoreWithModifier, on/off)
  • Exclude Sites: add/remove URL prefixes or regex (e.g. /.*\.notion\.site\//)
  • Hint Chars (hintChars), Hint Max Letters (hintMaxLetters)
  • Reset Defaults

🚀 Installation

  1. Install Tampermonkey for your browser.
  2. Add this userscript (paste raw URL or code).
  3. Refresh any page and start using Vim keys.

🛡️ Permissions & Notes

  • Uses GM_openInTab, GM_setClipboard, GM_getValue/GM_setValue, GM_registerMenuCommand.
  • Clipboard read may require HTTPS and user permission; script falls back to prompt when needed.
  • Some sites use custom scroll containers; extreme layouts may reduce hint accuracy.
  • Recommended to exclude heavy editors: Google Docs, Notion, Figma, Gmail, etc.
  • UserScript cannot switch browser tabs programmatically (security limitation).

❓ Troubleshooting

  • Keys don’t work: Check if focus is inside an input/editor; confirm the site isn’t in the exclude list.
  • x doesn’t close: Browsers only allow scripts to close tabs that they opened.
  • Clipboard issues: Grant permission or use the prompt fallback.
  • Conflicts: If a site uses the same keys, enable “Ignore Modifier Keys” or add the site to Exclude.

🗺️ Keymap (Quick Reference)

Category Keys Action
Scroll j / k Down / Up
h / l Left / Right
d / u Page Down / Up (base+extra)
gg / G Top / Bottom
Hint f / F Open link (current / new tab)
Find /, n / N Open find, Next / Prev
History H / L Back / Forward
Page r / t / x Reload / New tab / Close tab*
Misc yy / p / o / ? Copy URL / Open from clipboard / Open or search / Help

📜 License

MIT License © Wenbo Bian