Surfingkeys Documentation

repository·master·Indexed 27 days ago

https://github.com/brookhong/surfingkeys

A browser extension providing VIM-like keyboard navigation and control of the web. Version 1.18.0 allows users to map custom JavaScript functions to keystrokes via api.mapkey, utilize Visual and Hints modes for navigation, and manage tabs, windows, and proxy settings through a command-driven Omnibar interface.

Tokens
15.2K
Snippets
44
Records
91
Agent score
90%

What's inside Surfingkeys

  1. Manage Browser Windows

    master

    Control tab placement across windows:

    • W: List all windows. Select a window and press Enter to move the current tab to it.
    • ;gt: List all tabs NOT in the current window. Enter to move filtered tabs to the current window.
    • ;gw: Move all tabs from all windows to the current window.
  2. Edit HTML input elements with Vim editor

    master

    In Normal mode, you can use the Vim editor to edit various HTML elements:

    1. Press capital I.
    2. Use a hint letter to select the target input box.

    Behavior by element type:

    • <input>: Single-line editor. Press Enter or :w to save.
    • <textarea>: Multi-line editor. Press Ctrl-Enter or :w to save.
    • <select>: Search for an option and jump to the line, then press Enter to select it.

    General Vim commands:

    • Esc or :q: Quit without saving.
    • i: Enter standard insert mode.
    • Ctrl-i: Open the Vim editor while already in insert mode.
    • Tab: Trigger completion using words from the current page.
    • Space: Select a match from the popup.
  3. Use Visual mode for text selection

    master

    Press v to toggle Visual mode. The mode has two states indicated at the bottom of the page:

    • Caret: Move the cursor using VIM key bindings (j, k, h, l).
    • Range: Select text while moving the cursor.

    Visual mode mappings:

    • zz: Center cursor in the window.
    • f: Forward to next character.
    • F: Backward to next character.
    • ;: Repeat latest f or F.
    • ,: Repeat latest f or F in the opposite direction.
    • v (again): Return to Normal mode.
  4. Use the Search Bar (Omnibar)

    master

    The search bar is used for various input-based functions. Common triggers include:

    • t: Open a webpage from bookmarks or history.
    • b: Open bookmarks.
    • og/ob: Open specific search engines (e.g., Google, Baidu).
    • :: Open command mode.

    Search Bar Navigation & Actions:

    • Enter: Open selected item and close search bar.
    • Ctrl-Enter: Open selected item without closing the search bar.
    • Shift-Enter: Open selected item in the current tab and close search bar.
    • Tab / Shift-Tab: Move selection down/up in the results list.
    • Ctrl-. / Ctrl-,: Show next/previous page of results.
    • Ctrl-c: Copy the currently listed result.

    Specific Search Bar Behaviors:

    • When using t (history/bookmarks): Ctrl-d deletes the selected item.
    • When using b (bookmarks): Ctrl-Shift-<any letter> creates a Vim-style mark for the selected item.
  5. Execute Commands in Omnibar

    master

    Use : to open the command mode. You can execute built-in commands or run arbitrary JavaScript code. Commands can be mapped to keys for convenience.

    // Mapping different keys to the same command with different arguments
    api.map(';pa', ':setProxyMode always');
    api.map(';pb', ':setProxyMode byhost');
    api.map(';pd', ':setProxyMode direct');
  6. Manage browser sessions

    master

    Sessions allow you to save and restore groups of URLs.

    • ZZ: Save all current tabs into a session named LAST and quit.
    • ZR: Restore the session named LAST.
    • ZQ: Quit.

    Custom Sessions

    Use the command mode (:) to manage named sessions:

    • createSession <name>: Create a new session.
    • openSession <name>: Open a saved session.
    • listSession: List all saved sessions.
    • deleteSession <name>: Delete a specific session.
  7. Add Bookmarks with Directories

    master
    Use ab to add the current page to bookmarks. A search bar will appear for directory selection. To add to a new directory, type the new directory name and end it with a / (e.g., abc/). If you do not include the trailing /, the input will be treated as the bookmark title instead of a directory.
  8. Use Regional Hints mode

    master

    Press L to enter Regional Hints mode to pick visually large elements. Built-in actions include:

    • Esc: Exit regional hints mode.
    • ct: Copy text from target element.
    • ch: Copy HTML from target element.
    • d: Delete target element.
    • l: Chat with AI about the element's text.
  9. Quick start and default mappings

    master

    After installation, open any website and use the following default shortcuts:

    • ? or u: Show help/usage popover (default mappings).
    • Esc: Hide the help popover.
    • e: Scroll page up.
    • d: Scroll page down.
    • ;e: Open settings page.
    • t: Search bookmarks/history.
    • /: Find in current page.
    • f: Follow links (Hints mode).
    • v: Toggle Visual mode.
    • T: Switch tabs.
  10. Configure proxy settings

    master

    Surfingkeys can manage proxy settings via commands in the Omnibar (:):

    Proxy Modes

    Use setProxyMode <mode> to switch between:

    • direct: Connect to all sites directly.
    • byhost: Only use proxy for hosts defined in settings.proxy and settings.hosts.
    • bypass: Connect through proxy, excluding specified hosts.
    • always: Connect through proxy for all sites.
    • system: Use the operating system's proxy configuration.
    • clear: Default mode; Surfingkeys does not control proxy settings.

    Proxy Commands

    • setProxy <address>: Set the proxy address (e.g., setProxy 127.0.0.1:1080 SOCKS5).
    • cp: Toggle proxy for the current site.

    Common Shortcuts

    • ;pa: :setProxyMode always
    • ;pb: :setProxyMode byhost
    • ;pc: :setProxyMode clear
    • ;pd: :setProxyMode direct
    • ;ps: :setProxyMode system
  11. Take screenshots of web pages

    master

    Use the following shortcuts to capture screenshots:

    • yg: Capture the current visible screen.
    • yG: Scroll and capture the entire page.
    • yS: Capture the current scrollable object (e.g., a specific DIV).

    After capturing, a popup will appear. You can right-click the image to save or copy it.