qutebrowser Key Bindings
Updated  2023-May-1 💐️

Page contents

News

2023-January-24  As of today, this evolving⁠[1] article has been on the web for 1 year.🎂

 

Prerequisites

Built-in key bindings

To view qutebrowser’s built-in key bindings, view line 2123 and below in Infinite Ink’s qutebrowser’s Template config.py. The following is the beginning of that part of the default config.py.

2122## Bindings for normal mode
2123config.bind("'", 'mode-enter jump_mark')
2124config.bind('+', 'zoom-in')
2125config.bind('-', 'zoom-out')
2126

 

The two emphasized lines above make it possible to use the + and -⁠ keys to zoom in and zoom out on a web page.

 

User-defined key bindings

If you create a key binding, you may want to start it with a comma (,) because @The-⁠Compiler (Florian Bruhin), qutebrowser’s main developer, has said that default key bindings will never start with a comma.

💡

If you start most of your user-defined key bindings with a comma (,), then typing , in normal mode will display a keyhint widget  that lists key bindings that start with ,. This is useful if you don’t remember your user-defined bindings.🤔

 

Examples of user-defined key bindings

Zoom in and zoom out

Because I’m used to using Ctrl+= and Ctrl+- to zoom in and zoom out on a web page, I put the following in my config.py.

config.bind('<Ctrl-=>', 'zoom-in')
config.bind('<Ctrl-->', 'zoom-out')

 

Adblock update

Because I often forget to run :adblock-⁠update, I put the following ,au binding in my config.py.

config.bind(',au', 'adblock-update')

 

Now, when I type , in normal mode this shows up near the top of the alphabetically-⁠sorted keyhint widget and reminds me to periodically run this.

 

View source of current web page in my editor

I use ,vs to view the source of the current web page in the editor that I’ve specified with qutebrowser’s c.editor.command. Here’s how I set this up on my Windows devices:

c.editor.command = ['code.cmd', '-n', '{file}', '-w']
config.bind(',vs', 'view-source --edit')

 

To learn about qutebrowser’s c.editor.command setting, see section 1.2 in Infinite Ink’s qutebrowser Tips and Fragments.

To learn about VS Code, which is launched with code.cmd on Windows, see Infinite Ink’s #vscode Portal.

 

Redirect reddit.com URL to corresponding old.reddit.com URL

Because I prefer old.reddit.com to reddit.com, I created the following key binding.

config.bind (',r2o', 'open https://old.reddit.com/{url:path}')

 

If this is in your config.py and if you are viewing a reddit.com page, for example reddit.com/r/qutebrowser, you can type ,r2o to redirect it to the corresponding old.reddit.com URL, for example old.reddit.com/r/qutebrowser.

 

💡
The mnemonic I use to remember this is reddit 2 old.reddit.

 

Launch userscripts

Infinite Ink’s qutebrowser Userscripts on Windows includes the following key bindings, each of which launches a userscript.

config.bind(',qenv', 'spawn -u -o "qb-env.cmd"')
config.bind(',t', 'spawn -u tumblelog-wrapper.cmd')

 

Kill overlays and other floating elements

config.bind(',ko', 'jseval (function () { '+
'  var i, elements = document.querySelectorAll("body *");'+
''+
'  for (i = 0; i < elements.length; i++) {'+
'    var pos = getComputedStyle(elements[i]).position;'+
'    if (pos === "fixed" || pos == "sticky") {'+
'      elements[i].parentNode.removeChild(elements[i]);'+
'    }'+
'  }'+
'})();');

 

If you put this in your config.py, you can type ,ko in normal mode to kill overlays on qutebrowser’s current web page.

 

Open current web page’s media in mpv media player

Thanks to rien333 for posting the following key binding in the r/qutebrowser thread titled “Is there a way to open youtube links in mpv while you are on the youtube page?”

config.bind(',mpv', 'spawn --detach mpv {url}')

 

To learn about mpv, which is a free, open source, and cross-platform media player, see mpv.io.
▶️ 🎞️ 🍿

 

Tips

:bind command

To view all key bindings, run the following within qutebrowser.

:bind

This command lists both built-in and user-defined key bindings.

 

:unbind command

To unbind a key binding, for example Ctrl+T, during the current qutebrowser session, run something like this:

:unbind <Ctrl-T>

To permanently unbind a key binding, put something like this in your config.py:

config.unbind('<Ctrl-T>')

 

💡
I unbind Ctrl+T because I’m training myself to use Shift+o (i.e. upper case O) to open a URL in a new tab (rather than using Ctrl+T followed by o, which is what I used to do).

 

See also

Endnote


1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.

Discuss or share this page 📝 🤔 🐘