mitramejia / wezterm

My WezTerm config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My wezterm configuration

configuration showcase

Features

Mode indicator

Four mode are currenty supported:

showcase search mode

showcase copy mode

showcase window mode

showcase font mode

Search, copy and window mode have vim-like mappings.

Each mode also changes the status-bar colors! (can be easily disabled)

Vim-style keymaps

Mappings are defined using vim-like syntax, with the added W modifier that maps to the SUPER/WINDOWS key.

Usage example as follows:

local act = require("wezterm").action
local Config = { keys = {} } ---the wezterm config table

require("utils.fun").map("<M-CR>", act.ToggleFullScreen, Config.keys)

return Config

the previous mapping will be translated to:

{
  key = "Enter",
  mods = "ALT",
  action = act.ToggleFullScreen
}

I find it easier to just use a loop:

local fun = require("utils.fun")

local keys = {
  ["<leader>\\"] = act.SendKey { key = "\\" }, ---send key on <leader><leader>
  ["<C-Tab>"] = act.ActivateTabRelative(1),
  ["<C-S-Tab>"] = act.ActivateTabRelative(-1),
  ["<M-CR>"] = act.ToggleFullScreen,
  ["<C-S-c>"] = act.CopyTo "Clipboard",
  ["<C-S-v>"] = act.PasteFrom "Clipboard",
  ["<C-S-f>"] = act.Search "CurrentSelectionOrEmptyString",
  ["<C-S-k>"] = act.ClearScrollback "ScrollbackOnly",
  -- ...
}

Config.keys = {}
for lhs, rhs in pairs(keys) do
  fun.map(lhs, rhs, Config.keys)
end

Don't forget to set a LEADER!

For the full mappings list take a look at ./mappings/default.lua and ./mappings/modes.lua.

Flexible status-bar

flexible-status-bar-showcase.mp4

The status bar will give priority to the tab bar. During the status bar evaluation the available width is calculated and elements are not rendered to gracefully truncate the status-bar.

The width is calculated using https://github.com/aperezdc/lua-wcwidth and some other things, for more info take a look at ./events/update-status.lua

Currenty trying to figure out how to add fallback for each cell, i.e. if there isn't enough space to render the full cell, fallback to a shorter one, if the space is still not enough, hide the cell, for example:

      [try]       too long?  [try]  too long?
2023-12-14 11:05 ----------> 11:06 ----------> ""

Multiple fonts

The base font is Fira Code NF. Monaspace Radon is used for italics and Monaspace Krypton is used for bold-italics.

About

My WezTerm config


Languages

Language:Lua 100.0%