Vimium C Documentation

repository·master·Indexed 26 days ago

https://github.com/gdh1995/vimium-c

A high-performance browser extension for Firefox, Microsoft Edge, and Google Chrome that enables keyboard-driven web navigation. It features Vim-like shortcuts for scrolling, tab management, and link navigation, along with advanced capabilities such as contextual key mapping, command sequences, and a powerful omnibar. Written in C-style code for low resource overhead, it supports custom key mappings and external command execution via browser messages.

Tokens
3.6K
Snippets
2
Records
18
Agent score
89%

What's inside Vimium C

  1. Overview of Vimium C features

    master

    Vimium C is an open-source, keyboard-driven browser extension that allows for full browser navigation without a mouse.

    Key Capabilities:

    • Link/Button Navigation: Press F to discover and highlight clickable elements; type the hint characters to activate them.
    • Search & History: Press O to open a search box for browsing history, bookmarks, and open tabs. It also supports real-time math expressions and custom search engines.
    • Scrolling: Use J/K/H/L (similar to Vim) to scroll content.
    • In-page Search: Press / to open the in-page search overlay. Supports regex with \r, word matching with \w, and other modifiers like \R, \W, \i, and \I.
    • Text Selection: Press V to enter Free Selection mode, using J/K/H/L to expand selection ranges.
    • Tab Management:
      • Shift+J/Shift+K: Switch to next/previous tab.
      • g0/g$: Switch to first/last tab.
      • ^ (Shift+6): Switch to the previously visited tab.
      • X: Close current tab; Shift+X to restore.
      • yt: Copy tab URL.
    • Bookmarks/Markers: Use M + [letter] to create a marker and ` + [letter] to switch to/open that marker's page.
    • Advanced Command Usage: Most commands support numeric prefixes (e.g., 5 followed by Shift+X restores 5 tabs). Many commands also support parameters for fine-grained control.
  2. Overview of Vimium C

    master
    Vimium C is a web extension for Firefox, Microsoft Edge, and Google Chrome that provides keyboard-based navigation and control of the web, inspired by the Vim editor. It offers powerful functions and highly configurable details compared to the original Vimium extension.
  3. Overview of Vimium C

    master

    Vimium C is a browser extension designed to allow users to navigate web pages and manipulate browser windows using only the keyboard. It is a customized version of Vimium with several advanced features:

    • Contextual Mapping: Map keys to different commands depending on the website.
    • Global Shortcuts: Trigger commands even while inside an input box.
    • Command Sequences: Automatically run a tree of commands.
    • Chinese Support: Full support for Chinese language users.
    • Injection: Ability to inject functionality into other extensions.
    • Performance: Written in C-style code for high speed and low resource consumption (CPU/Memory).
  4. Use Vimium C with companion extensions

    master

    Vimium C can be used alongside several specialized helper extensions to extend its functionality:

    • PDF Viewer for Vimium C: A modified version of PDF.js that allows Vimium C commands to work within PDF documents. It can replace the standard browser PDF viewer.
    • New Tab Adapter: Allows you to intercept the browser's new tab setting and redirect it to a custom URL of your choice.
    • Shortcut Forwarding Tool: Provides 32 globally bindable shortcuts that can notify other extensions (like Vimium C) to execute specific operations.
    • Weidu New Tab (Modified Version): A simplified, Chinese-localized version of the Weidu New Tab interface. Note that this version does not intercept the browser's new tab settings; use New Tab Adapter if you need that functionality.
  5. Build Vimium C from source

    master

    To compile Vimium C manually, you need Node.js 13+ and npm.

    Note: pngjs is only required if you are building for Chromium-based browsers.

    You can use gulp local to compile files in place or gulp dist to compile and minimize files into the dist/ directory. The build process uses gulp.tsconfig.json to control target browsers via MinCVer and BTypes options.

    npm install typescript
    npm install pngjs
    node scripts/tsc
  6. Enable cloud-based synchronization of settings

    master

    By default, Vimium C does not sync with your browser account. It only downloads settings during the first installation if they exist. To enable continuous synchronization of your settings (including key mappings and search engines) with your browser account, you must manually enable the advanced setting: Synchronize settings with your current account for this browser.

    Note that browsing behavior is never included in synced settings. Enabling this feature requires the storage.sync permission.

  7. Configure advanced keyboard settings and rules

    master

    Vimium C provides several advanced ways to manage key mappings and behavior:

    • Contextual Mapping: Map the same key to different commands depending on the website or the current element in focus.
    • Disabling Shortcuts on Specific Sites: In the extension settings, you can define rules to disable specific shortcuts on certain websites using regular expressions.
      • Use a list of URLs to disable only those shortcuts on those sites.
      • Prefix a list with ^ to disable those shortcuts on all sites except the ones listed.
    • Global Shortcuts: Since standard JavaScript-based shortcuts can be intercepted or blocked by browser internal pages, Vimium C provides 8 Global Shortcuts that can be bound to any command to ensure they work everywhere. Note that Global Shortcuts do not support website-specific exclusion rules.
    • Address Bar Search: Use the built-in search engine v in the browser address bar.
      • Type v + [space] to enter search mode (similar to the O command).
      • Type v + [space] + :t + [space] + [keyword] to search specifically within open tabs.
  8. Install Vimium C

    master

    Vimium C is available for several major browsers. You can install it via the following official stores:

    Browser Compatibility:

    • Chromium-based browsers (Chrome, Edge, etc.): Core version >= 102.
    • Firefox: Version 101.0 (desktop) or higher.
    • Note: If re-compiled from source, it can support older versions (Chromium 32~108 and Firefox 63~100).
  9. Configure Custom Key Mappings

    master

    You can remap or unmap default key bindings in the 'Custom key mappings' section of the Vimium C options page. Enter one command per line.

    Mapping Commands

    • map <key> command: Maps a key to a Vimium C command. Overrides web page behavior.
    • mapKey <key> <another_key>: Treats <key> as <another_key>. Does not affect the browser or web pages.
    • unmap <key>: Removes a mapping and restores default behavior.
    • unmapAll: Wipes all default bindings to start from scratch.
    • unmap! <key>: Unmaps a key even if you are unsure if it was previously mapped (prevents errors).

    Advanced Mapping Syntax

    • Modes:
      • map <key:i> command: Triggers the command in insert mode only.
      • map! <single_key>: Maps a key in both normal and insert modes (only for single keys, not long sequences).
      • mapKey <key:o> <another_key>: Makes <key> work as <another_key> only in Vomnibar mode.
    • Modifiers: Use <c-*>, <a-*>, <s-*>, or <m-*> for Ctrl, Alt, Shift, and Meta (Command on macOS).
    • Complex Keys: For keys longer than 1 character, wrap them in < and > and use the s- prefix (e.g., <s-left>, <a-s-k>). When using multiple modifiers, sort prefixes by letter order (e.g., <a-s-k>).

    Special Keys

    • Arrow keys: <left>, <right>, <up>, <down>
    • Function keys: <f1> through <f12>
    • Non-printable: <space>, <tab>, <enter>, <delete>, <backspace>, <insert>, <home>, <end>

    Comments

    Start a line with ", #, or a space followed by # to add comments.

    # Examples
    map r reload
    map <c-d> scrollPageDown
    unmap r
    unmap <c-d>
    unmap g0
  10. Optimized Chinese language support

    master

    Vimium C includes specific optimizations for Chinese language users:

    • Encoding Support: Can recognize GBK encoded Chinese characters in URLs (e.g., Baidu Tieba) for searching.
    • Text Selection: In Free Selection mode, word-based navigation shortcuts (w, e, b, etc.) pause at the start/end of Chinese words.
    • Default Search Engine: Automatically sets 'Baidu Search' as the default if the browser language is set to Chinese.
    • Pagination: The 'Previous Page' and 'Next Page' functions recognize common Chinese terms used on pagination buttons.