Mac native wezterm settings

Gundeep Singh
2 min readOct 6, 2024

--

I have been using wezterm for some time now and I find it much smoother than the default mac terminal and with the lua config, more managable and easily configurable.

Sharing my wezterm config that makes the wezterm terminal work like a google chrome on mac.

Mac / Chrome / VsCode / Mac Default Terminal like familiar shortcuts

Option + ←            # Go to last word
Option + → # Go to next word
Cmd + ← # Go to start
Cmd + → # Go to end
Cmd + Option + ← # Go to last tab
Cmd + Option + → # Go to next tab
Cmd + t # Open new tab
Cmd + w # Close tab
Cmd + \ # Split right
Cmd + ] # Split bottom
Cmd + k # Clear screen
Cmd + ⌫ (delete) # Clear line

Wezterm config

-- ~/.wezterm.lua

-- Pull in the wezterm API
-- Full keys: https://wezfurlong.org/wezterm/config/lua/keyassignment/
local wezterm = require 'wezterm'
local action = wezterm.action
local act = wezterm.action

-- This will hold the configuration.
local config = wezterm.config_builder()

-- Notification when the configuration is reloaded
local function toast(window, message)
window:toast_notification('wezterm', message .. ' - ' .. os.date('%I:%M:%S %p'), nil, 1000)
end

-- Use the defaults as a base
config.hyperlink_rules = wezterm.default_hyperlink_rules()

-- Make IP addresses with port clickable (e.g., 127.0.0.1:5053)
table.insert(config.hyperlink_rules, {
regex = [[\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d+)\b]],
format = 'http://$1:$2',
})

-- Match local file paths ending in .html
table.insert(config.hyperlink_rules, {
regex = [[\b(?:[a-zA-Z0-9_-]+(?:/[a-zA-Z0-9_-]+)*)+\.html\b]],
format = 'file://$0',
})


local bind = function(mods, key, action)
table.insert(config.keys, {
key = key,
mods = mods,
action = action,
})
end

-- config.color_scheme = 'AdventureTime'
config.color_scheme = 'Banana Blueberry'
config.keys = {
{ mods = "OPT", key = "LeftArrow", action = action.SendKey({ mods = "ALT", key = "b" }) },
{ mods = "OPT", key = "RightArrow", action = action.SendKey({ mods = "ALT", key = "f" }) },
{ mods = "CMD", key = "LeftArrow", action = action.SendKey({ mods = "CTRL", key = "a" }) },
{ mods = "CMD", key = "RightArrow", action = action.SendKey({ mods = "CTRL", key = "e" }) },
{ mods = "CMD", key = "Backspace", action = action.SendKey({ mods = "CTRL", key = "u" }) },
{ mods = 'CMD|ALT', key = 'LeftArrow', action = act.ActivateTabRelative(-1) },
{ mods = 'CMD|ALT', key = 'RightArrow', action = act.ActivateTabRelative(1) },
}


bind('CMD', 'k', act.Multiple {
act.ClearScrollback 'ScrollbackAndViewport',
act.SendKey { key = 'L', mods = 'CTRL' },
})

bind('CMD', ']', wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' })
bind('CMD', '\\', wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' })


wezterm.on('window-config-reloaded', function(window, pane)
toast(window, 'Configuration reloaded!')
end)


-- and finally, return the configuration to wezterm
return config

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Gundeep Singh
Gundeep Singh

Written by Gundeep Singh

Learner, Explorer, Developer, Deep Learning & LLM train. GOTTA CATCH EM ALL.

No responses yet

Write a response