Skip to content

Luakit Configuration

Colin Woodbury edited this page Mar 31, 2023 · 1 revision

This short guide demonstrates how to configure the Luakit browser using Fennel. The file paths shown below are for Linux systems; please adjust accordingly if you use something else.

Setup

Preparing the Lua Glue

Luakit itself doesn't understand Fennel, so we need a light wrapper around our config. First, Luakit requires a userconf.lua file in a usual config location. For instance:

/home/you/.config/luakit/userconf.lua

Within this file, place the following line:

require("fennel").install().dofile("/home/you/.config/luakit/config.fnl")

By default, an absolute path to your Fennel code is necessary to appease the package loader.

Before we can start Luakit, however, we must also provide a Lua-compiled version of Fennel for Luakit to load first.

Preparing Fennel

  1. Download the latest tag of Fennel.
  2. Decompress it.
  3. Run make to build (among other things) a fennel.lua.
  4. Copy fennel.lua to /home/you/.config/luakit/.

Now we're ready. After adding config as shown below, open luakit and enjoy!

Configuration

We'll add all of our configuration to a config.fnl file. Within it, we're free to import any of the Luakit Lua modules and use them as-is.

Keybindings

Simple Colemak rebindings can be added like so:

(local modes (require :modes))

(modes.remap_binds "normal" [["n" "j" false]
                             ["e" "k" false]
                             ["N" "J" false]
                             ["E" "K" false]])

See also the official docs for the modes module.

Ad blocking

(local adblock (require :adblock))

(adblock.load false "easylist.txt")
(adblock.load false "easyprivacy.txt")
(adblock.load false "fanboy-annoyance.txt")

See also the official docs for the adblock module for how to obtain the blocklists.

Follow Mode

The f key opens "follow mode", allowing you to click links via the keyboard. By default, Luakit assigns number combinations to each link, but it's also possible to set letters. For instance, using the Home Row instead can make browsing quite comfortable.

(local select (require :select))

(fn select.label_maker [s] (s.interleave "arst" "neio"))

The above is (most of) the Home Row for the Colemak layout. Feel free to set it to whatever you wish.

See also the official docs for the select module.

Clone this wiki locally