Map your keys for web surfing, expand your browser with javascript and keyboard.
Map your keys for web surfing, expand your browser with javascript and keyboard.
Surfingkeys is a browser extension (for Google Chrome, Chromium-based browsers, Firefox, and Safari) that provides keyboard-based navigation and control of the web in the spirit of the VIM editor. But it's not just for VIM users; it's for anyone who needs more shortcuts for their own functions.
Surfingkeys is created with all settings described in JavaScript, so it's easy for anyone to map any keystrokes to their own defined JavaScript functions. For example,
api.mapkey('<Ctrl-y>', 'Show me the money', function() {
api.Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).');
});Surfingkeys does its best to make full use of the keyboard for web browsing, but there are some limitations from Google Chrome itself; please see the Brook Build of Chromium for a more thorough experience.
Search selected with.| Features \ Browsers | Chromium family (above 45) | Firefox (above 57) | Safari (above 15) |
|---|---|---|---|
| Follow links | Y | Y | Y |
| Surfingkeys modes | Y | Y | Y |
| Omnibar | Y | Y | partly |
| Search selected with | Y | Y | Y |
| Vim-like marks | Y | Y | Y |
| Switch tabs | Y | Y | Y |
| Windows management | Y | Y | N |
| Commands | Y | Y | Y |
| Smooth scroll | Y | Y | Y |
| Session management | Y | Y | Y |
| Repeats action by pressing number before mapkey | Y | Y | Y |
| Hotkey to toggle Surfingkeys | Y | Y | Y |
| VIM editor and Emacs editor | Y | Y | Y |
| Dot to repeat previous action | Y | Y | Y |
| Capture page | Y | Y | Y |
| PDF viewer | Y | N | N |
| Sync across devices | Y | N | Y |
| Tab Groups | Y | Y | N |
| Proxy | Y | N | N |
| Markdown preview | Y | Y | N |
* to search word under cursor in visual mode.e d) work not only for the top window but also for scrollable DIVs.w to switch frames if there are any.;pm to preview markdownAfter you install the extension from Chrome Web Store or Firefox Add-ons, open a site you'd like to browse. Then press ? or u to take a quick look at the default mappings first. Press Esc to hide the usage popover.
Try some mappings described in the usage popover. For example, press e to scroll a page up, d to scroll a page down, ;e to open settings page.
? to show help
t to search bookmarks/history
/ to find in current page
f to follow links
v to toggle visual mode
T to switch tabs
There are three modes in Surfingkeys: normal, visual and insert.
When you open a page, it enters normal mode automatically. All mappings added with mapkey work in this mode.
Press v to toggle visual mode. You'll see an indicator at the bottom of the current page - Caret or Range, and a large cursor on the page. The cursor is made large for visibility, as sometimes it's not easy for humans to locate a normal cursor on a web page.
Caret indicates that the cursor is moved when you press jkhl, Range indicates that you'll select text when moving the cursor.
Now here is a small practice,
v, you'll see Caretv again, you'll see Range.sg to see what will happen.v again to go back to normal mode.All mappings added with vmapkey work in this mode, with some built-in mappings like those in VIM - j k h l b w 0 $ etc.
zz make cursor at center of window.f forward to next char.F backward to next char.; repeat latest f, F., repeat latest f, F in opposite direction.Press f to enter Hints mode to follow links. There are several other keystrokes to enter Hints mode with different behaviors, such as cf for continuous following, af for active following.
The default hint characters for links are asdfgqwertzxcvb. Hints mode quits when a non-hint key is pressed. Add the line below to your settings to make it right-handed:
api.Hints.setCharacters('yuiophjklnm'); // for right handWhen hints are overlapped, press Shift to flip them. Hold space to hold hints temporarily, release space to restore hints.
Hints are placed at the center of target links; you could add the line below to your settings to align them left.
settings.hintAlign = "left";Press L to enter regional Hints mode by picking a visually large element. There are some built-in actions in regional Hints mode,
Esc to exit regional hints modect to copy text from target elementch to copy HTML from target elementd to delete target elementl to chat with AI about the text of the elementp to select the parent element of the target elementWhen focus is switched into any editable element by whatever means (i hints, f hints, or mouse click), Insert mode is on.
All mappings added with imapkey work in this mode.
Ctrl-i to open vim editor to edit.Ctrl-' to toggle quotes in an input element, which is useful for search engines like Google.Ctrl-e to move the cursor to the end of the line.Ctrl-a to move the cursor to the beginning of the line; use Ctrl-f in Windows to avoid conflict with select all.Ctrl-u to delete all entered characters before the cursor.Alt-b to move the cursor backward 1 word.Alt-f to move the cursor forward 1 word.Alt-w to delete a word backwards.Alt-d to delete a word forwards.Ctrl-g to correct the grammar of the current input with LLM.imap and iunmap work for insert mode.
api.imap(',,', "<Esc>"); // press comma twice to leave current input box.
api.imap(';;', "<Ctrl-'>"); // press semicolon twice to toggle quote.When a user inputs a colon and 2 (set by settings.startToShowEmoji) characters such as :gr in insert mode, Surfingkeys will try to find matching emoji and list them if any are found.
If you want this feature disabled completely, use below settings:
api.iunmap(":");If you'd like emoji suggestions popup as soon as you input colon, use below:
settings.startToShowEmoji = 0;Find is not actually a mode; it's just another way to enter visual mode. Press / to open the find bar, which sits at almost the same position as the Mode indicator, and type something there. All occurrences of your input will be highlighted. Press Enter to finish the finding, and you're in Caret visual mode now; press n to find next, N to find previous.
Press Ctrl-Enter to find the exact whole word entered, like with the input \bkeyword\b.
Pressing Alt-i to enter PassThrough mode gives you a chance to temporarily suppress SurfingKeys, which means Surfingkeys will not care about any key press until you leave this mode by pressing Esc. In this mode, you could use built-in shortcuts from any site itself. Please see Feature Request: implement Vimium-style insert mode · Issue #656 for why we brought this in and the difference between Alt-i and Alt-s.
Pressing p enters an ephemeral PassThrough mode, which automatically quits after 1 second.
Users can specify the pages where Surfingkeys will lurk until it is called out by Alt-i or p (for the ephemeral case), such as
settings.lurkingPattern = /https:\/\/github\.com|.*confluence.*/i;If the loading page matches with the lurkingPattern, Surfingkeys will enter lurk mode by default, in which mode only Alt-i and p are registered by Surfingkeys to activate normal mode. When user presses Esc or timeout, Surfingkeys reverts back to lurk mode.
API lmap can be used to change the shortcuts, for example,
api.lmap("<Alt-j>", "<Alt-i>");The extension icon in the toolbar reflects the current status of Surfingkeys:
The omnibar provides various functions that need user input, for example,
tbog / ow ...:Enter to open selected item and close omnibar.Ctrl-Enter to open selected item, but keep omnibar open for more items to be opened.Shift-Enter to open selected item in current tab and close omnibar. If you'd like to open in current tab by default, please use go.Tab to forward cycle through the candidates.Shift-Tab to backward cycle through the candidates.Ctrl-. to show results of next pageCtrl-, to show results of previous pageCtrl-c to copy all listed itemsIn omnibar opened with t:
Ctrl-d to delete from bookmarks or history
In omnibar opened with b:
Ctrl-Shift-<any letter> to create a vim-like mark
cmap can be used for t
No open issues yet, or sync has not completed.