a terminal client for Lurker, written in Rust


on this page

keys.lua

Key bindings, aliases and emoticons. keys.lua returns all three, and config.lua sets them in the config as keys, aliases and emotes:

local keys = require("keys")

return {
  keys    = keys.bindings,
  aliases = keys.aliases,
  emotes  = keys.emotes,
  -- ...
}

bindings

Each entry names an action and the key to bind it to. Action names have hyphens in them, so they go in square brackets:

local bindings = {
  ["switcher"]    = "ctrl+p",
  ["next-buffer"] = "ctrl+n",
}

Setting an action replaces all of its default keys with the one you give. next-buffer is on both alt+down and alt+j by default, so the example above leaves it on ctrl+n alone.

An action that does not exist, or a key luir cannot read, is refused when the config loads, naming the one at fault. luir --list-actions prints every action with the keys it is on now, your changes included, and F1 shows the same inside luir.

Writing a key

A key is any number of modifiers joined with +, then the key itself: ctrl+k, alt+shift+n, f5.

Modifier Also written
ctrl control, c
alt meta, m, a
shift s
Key Also written
a to z, 0 to 9, and other single characters
f1 to f12
up, down, left, right
home, end
pgup pageup
pgdown pgdn, pagedown
insert ins
delete del
backspace bs
enter return, cr
tab
backtab shift+tab in most terminals
esc escape
space

Names are not case-sensitive, so shift has to be written out: alt+shift+a, not alt+A. alt+shift+a and alt+a are different keys.

Every action

ActionDefaultDoes
quitctrl+qLeave luir
helpf1Show the key reference
switcherctrl+kJump to a buffer by name
emotesalt+eInsert an emoticon
themesalt+tPick a colour scheme
add-networkalt+nAdd a network
edit-networkalt+shift+nEdit the selected network
next-bufferalt+down, alt+jSelect the next buffer
prev-bufferalt+up, alt+kSelect the previous buffer
next-unreadalt+aJump to the next buffer with unread activity
prev-unreadalt+shift+aJump to the previous buffer with unread activity
next-networkalt+right, alt+.Select the first buffer of the next network
prev-networkalt+left, alt+,Select the first buffer of the previous network
close-bufferctrl+wClose the current buffer
clear-bufferalt+lClear the current buffer's scrollback
mark-readalt+rMark the current buffer read
mark-all-readalt+shift+rMark every buffer read
toggle-sidebarf2Show or hide the buffer list
toggle-membersf3Show or hide the member list
toggle-topicf4Show or hide the topic bar
toggle-timestampsf6Show or hide timestamps
statsf7Show the connection charts
reload-configf5Reload the config file from disk
scroll-uppgupScroll back one page
scroll-downpgdownScroll forward one page
scroll-topctrl+homeJump to the oldest loaded message
scroll-bottomctrl+endJump to the newest message
members-upalt+pgupScroll the member list back one page
members-downalt+pgdownScroll the member list forward one page
focus-membersalt+mMove the highlight into the member list
toggle-favoritealt+shift+fFavourite this buffer, or drop it
toggle-favoritesf8Show or hide the favourites sections
cancelescClose an overlay or clear the input

alt+1 to alt+9 jump to a buffer by its number in the sidebar. They are checked before any binding and are not actions, so they cannot be moved.

tmux and alt+arrows

Inside tmux, alt+left and alt+right may never reach luir: a common tmux setup binds them to switching sessions without the prefix. That is why alt+, and alt+. switch networks too, by default, since tmux leaves those alone. To see what tmux holds:

tmux list-keys -T root | grep -E 'M-(Left|Right)'

To give the arrows back to luir, add unbind -n M-Left and unbind -n M-Right to .tmux.conf. Rebinding next-network or prev-network yourself replaces both of its default keys with the one you give.

Keys you cannot rebind

Editing in the prompt is fixed, in the readline style:

Key
enter Send the line
tab Complete a nick, channel or command
left, right Move a character
ctrl+left, ctrl+right, alt+b, alt+f Move a word
home, end, ctrl+a, ctrl+e Go to the start or end of the line
backspace, delete Delete a character
ctrl+u Delete to the start of the line
up, down Step through the lines you have sent
ctrl+d Quit, when the line is empty

A bound action gets a key before the prompt does, which matters for a few keys the prompt also understands. ctrl+w deletes a word and ctrl+k deletes to the end of the line, but by default those keys belong to close-buffer and switcher; bind those actions to something else and the editing keys work. In the same way, alt+left and alt+right only move by a word once prev-network and next-network are off them.

alt+m, or a click on a nick, hands the keyboard to the member list, and while it has it these keys are fixed too:

Key
up, down, j, k, tab, shift+tab Move the highlight
pgup, pgdown, home, end, g, G Move it further
enter, m Open a direct message with them
w /whois them
i Put their nick in the prompt
o Op them, or deop them if they are
v Voice them, or devoice them if they are
K Start /kick <nick> in the prompt, to add a reason and send
esc, q Give the keyboard back

o needs ops in that channel, and v and K need ops or halfops, so the status bar only offers them to someone who has what they need. The other keys give the keyboard back when they are done, but o and v keep it, since a channel is often sorted out a few people at a time.

aliases

Your own slash commands. Each maps a name to the command line it runs, and luir expands it before running the command.

local aliases = {
  shrug = "/me shrugs",
  w     = "/whois $1",
  ban   = "/mode #chat +b $1",
  op    = "/msg ChanServ OP $1 $2",
}
In a template Stands for
$1 to $9 The first to ninth word after the alias
$* Everything after the alias

Yours are merged over a bundled set by name, so naming one that is already taken replaces it. /help lists every alias in force. The bundled set is the services shorthands, which go through /msg so they work on networks that do not define them, and a few others:

Alias Runs
/bs /msg BotServ $*
/cs /msg ChanServ $*
/hs /msg HostServ $*
/ms /msg MemoServ $*
/ns /msg NickServ $*
/os /msg OperServ $*
/j /join $*
/w /whois $1
/shrug /me shrugs

emotes

Emoticons for the picker. alt+e opens it over the bundled set of over three hundred (the shrug, the table flip, Lenny and the rest), searching their keywords as well as their names, so angry finds the table flip. enter drops the one you pick into the prompt at the cursor rather than sending it, since it is usually in the middle of a sentence. /emote flip table nope sends one outright, with text alongside it.

Many of the bundled ones come from ASCIImoji by jiggly, under the Beer-Ware License.

Yours are merged over the bundled set by name, so naming one that is already taken replaces it:

local emotes = {
  ["my shrug"] = "¯\\_(ツ)_/¯",
  ["tea"]      = "( ˘▽˘)っ♨",
}

These are Lua strings, so a backslash has to be written twice. "¯\_(ツ)_/¯" with a single one is an invalid escape, and the config will not load.