:bind
This article assumes you know…
the basics about the qutebrowser web browser
and
how
to create and populate a
qutebrowser
config.py
configuration file.
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
.
The two emphasized lines above make it possible to use the + and - keys to zoom in and zoom out on a web page.
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 ( |
Because I’m used to using
config.py
.
config.bind('<Ctrl-=>', 'zoom-in')
config.bind('<Ctrl-->', 'zoom-out')
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.
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.
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. |
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')
Thanks to LordOfTheAssclowns for posting the following in the reddit thread old.reddit.com/r/qutebrowser/comments/mnptey/getting_rid_of_cookie_consent_barspopups/.
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.
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.
▶️
🎞️
🍿
:bind
commandTo view all key bindings, run the following within qutebrowser.
:bind
This command lists both built-in and user-defined key bindings.
:unbind
commandTo 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). |
@nm@mathstodon.xyz
or
#InfiniteInk
in it.