Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active October 10, 2024 15:36
Show Gist options
  • Save YumaInaura/9ce0e5f2f4eaf50786048be8582bc6bc to your computer and use it in GitHub Desktop.
Save YumaInaura/9ce0e5f2f4eaf50786048be8582bc6bc to your computer and use it in GitHub Desktop.
Vimium — Default keymap list used to Custom key mappings ( unmapAll and enable mappings you like )

Vimium — Default keymap list used to Custom key mappings

Shortcuts

# Navigating the page

map j scrollDown
map <c-e> scrollDown
map k scrollUp
map <c-y> scrollUp
map gg scrollToTop
map G scrollToBottom
map d scrollPageDown
map u scrollPageUp
map - scrollFullPageDown
map - scrollFullPageUp
map h scrollLeft
map l scrollRight
map r reload
map yy copyCurrentUrl
map p openCopiedUrlInCurrentTab
map P openCopiedUrlInNewTab
map i enterInsertMode
map v enterVisualMode
map gi focusInput
map f LinkHints.activateMode
map F LinkHints.activateModeToOpenInNewTab
map - LinkHints.activateModeToOpenInNewForegroundTab
map gf nextFrame
map gF mainFrame

# Using the vomnibar

map o Vomnibar.activate
map O Vomnibar.activateInNewTab
map b Vomnibar.activateBookmarks
map B Vomnibar.activateBookmarksInNewTab
map T Vomnibar.activateTabSelection
map - enterFindMode
map n performFind
map N performBackwardsFind

# Navigating history

map H goBack
map L goForward

# Manipulating tabs

map t createTab
map J previousTab
map gT previousTab
map K nextTab
map gt nextTab
map ^ visitPreviousTab
map g0 firstTab
map g$ lastTab
map yt duplicateTab
map <a-p> togglePinTab
map <a-m> toggleMuteTab
map x removeTab
map X restoreTab

# Miscellaneous

map ? showHelp

Usage

In Vimium setting page once unmapAll and enable mappings you like.

Example:

unmapAll
map j, <c-e>  scrollDown
map k, <c-y>  scrollUp
map gg  scrollToTop
map G  scrollToBottom

How to extract

Install Vimium

Move to Vimium setting

image

chrome-extension://dbepggeogbaibhgnhhndojpepiihcmeb/pages/options.html

Show available commands

image

Copy command listing area to clipboard

image

Navigating the page
--
j, <c-e> |   | Scroll down (scrollDown)
k, <c-y> |   | Scroll up (scrollUp)
gg |   | Scroll to the top of the page (scrollToTop)
G |   | Scroll to the bottom of the page (scrollToBottom)
d |   | Scroll a half page down (scrollPageDown)
u |   | Scroll a half page up (scrollPageUp)
  |   | Scroll a full page down (scrollFullPageDown)
  |   | Scroll a full page up (scrollFullPageUp)
h |   | Scroll left (scrollLeft)
l |   | Scroll right (scrollRight)
r |   | Reload the page (reload)
yy |   | Copy the current URL to the clipboard(copyCurrentUrl)
p |   | Open the clipboard's URL in the current tab(openCopiedUrlInCurrentTab)
P |   | Open the clipboard's URL in a new tab(openCopiedUrlInNewTab)
i |   | Enter insert mode (enterInsertMode)
v |   | Enter visual mode (enterVisualMode)
gi |   | Focus the first text input on the page (focusInput)
f |   | Open a link in the current tab(LinkHints.activateMode)
F |   | Open a link in a new tab(LinkHints.activateModeToOpenInNewTab)
  |   | Open a link in a new tab & switch to it(LinkHints.activateModeToOpenInNewForegroundTab)
gf |   | Select the next frame on the page (nextFrame)
gF |   | Select the page's main/top frame (mainFrame)

  | Navigating the page
-- | --
j, <c-e> |   | Scroll down (scrollDown)
k, <c-y> |   | Scroll up (scrollUp)
gg |   | Scroll to the top of the page (scrollToTop)
G |   | Scroll to the bottom of the page (scrollToBottom)
d |   | Scroll a half page down (scrollPageDown)
u |   | Scroll a half page up (scrollPageUp)
  |   | Scroll a full page down (scrollFullPageDown)
  |   | Scroll a full page up (scrollFullPageUp)
h |   | Scroll left (scrollLeft)
l |   | Scroll right (scrollRight)
r |   | Reload the page (reload)
yy |   | Copy the current URL to the clipboard(copyCurrentUrl)
p |   | Open the clipboard's URL in the current tab(openCopiedUrlInCurrentTab)
P |   | Open the clipboard's URL in a new tab(openCopiedUrlInNewTab)
i |   | Enter insert mode (enterInsertMode)
v |   | Enter visual mode (enterVisualMode)
gi |   | Focus the first text input on the page (focusInput)
f |   | Open a link in the current tab(LinkHints.activateMode)
F |   | Open a link in a new tab(LinkHints.activateModeToOpenInNewTab)
  |   | Open a link in a new tab & switch to it(LinkHints.activateModeToOpenInNewForegroundTab)
gf |   | Select the next frame on the page (nextFrame)
gF |   | Select the page's main/top frame (mainFrame)

Paste to text file

$ pbpaste > ~/tmp/tmp/vimium

Formatting shortcuts

#!/usr/bin/env bash -eu

text=$(cat /tmp/vimium)

echo "============================"
echo "$text"

newline_formatted=$(echo "$text" | \perl -pe "s/(\([a-zA-z\.]+\)) */\1\\n/g")

echo "============================"
echo "$newline_formatted"

menu_text_adjusted=$(echo "$newline_formatted" | perl -pe "s/ *(Navigating the page|Navigating history|Using the vomnibar|Manipulating tabs|Miscellaneous) */\n# \1\n\n/g")

echo "============================"
echo "$menu_text_adjusted"

no_mappings=$(echo "$menu_text_adjusted" | perl -pe "s/^([A-Z][a-z]+)/- \1/g")

echo "============================"
echo "$no_mappings"

shortcuts=$(echo "$no_mappings" | perl -pe "s/^([^ ,]+)(, [^ ]+)?.+?\(([a-zA-z\.]+)\)$/map \1\2 \3/")

echo "============================"
echo "$shortcuts"

double_keymapping_separated=$(echo "$shortcuts" | perl -pe "s/^map ([a-zA-Z<>-]+), ([a-zA-Z<>-]+)\s+([a-zA-z]+)$/map \1 \3\nmap \2 \3/g")

echo "============================"
echo "$double_keymapping_separated"

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment