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.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

Tác giả
bianwenbo
Cài đặt hàng ngày
0
Số lần cài đặt
3
Đánh giá
0 0 0
Phiên bản
2.2.0
Đã tạo
31-08-2025
Đã cập nhật
01-09-2025
Kích thước
20 KB
Giấy phép
MIT
Áp dụng cho
Tất cả trang web

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