/postroll
betterprogramming.pub
betterprogramming.pub
One of my goals when adopting Wezterm was to replace tmux. To do that, I needed not just the ability to open additional tabs/windows and to split into panes, but also a feature I'd come to rely on heavily in the tmux ecosystem: session saving and restoration, which I accomplished with the tmux-resurrect plugin.
I tried a number of options, but was eventually pointed to resurrect.wezterm.
In this post, I'll detail how I've configured it, as well as a workflow I've developed for interacting with it that gives me (a) reasonable satisfaction that I won't lose work, and (b) additional flexibility for branching off work.
As I expand my Wezterm usage, I find that either (a) a third-party module will have default keybinding configuration I want to adopt, and/or (b) I want to segregate keybindings related to specific contexts into separate modules to simplify my configuration.
Keybindings are stored as a list of tables (what we call associative arrays in PHP). Simple, right?
Unlike in other languages I use, Lua doesn't have a built-in way to merge lists.
So, I wrote up a re-usable function.
Quick little note mainly for myself: Lua regex is different than PCRE. The big place it differs is in where you escape pattern matching characters (e.g. ., ?, +, etc.). In PCRE, you escape these with a leading backslash (e.g., \., \?, \+). However, with Lua, you use the % character: %., %?, %+.
luacheck.readthedocs.io
I have Luacheck configured with coc.nvim, and started paying attention to warnings it is emitting. In some cases, I've realized that while the warning is valid, I might need to ignore it. You can do this by adding a comment of the form -- luacheck: ignore {pattern}. The pattern is most succinct when you can use the Luacheck warning code... and this link lists all of them.
#{some tag} or tag:{some tag} to filter by tag; using this more than once will find results that match all tags.year:{year} to filter by year. If you use this multiple times, the last one wins.begin:{year-month-day} to restrict to results beginning on that day. Last one wins.end:{year-month-day} to restrict to results ending on that day. Last one wins.
Fantastic guide to creating class definitions in Lua, which turns out to be a prototype language similar to JavaScript. Demonstrates using annotations to specify visibility, and links to resources for annotations.