Last active
November 30, 2024 00:43
-
-
Save henri/cf3f054c37b7acb6b0dda8dc5be7fe04 to your computer and use it in GitHub Desktop.
wezterm cheat sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pane splitting cli | |
https://wezfurlong.org/wezterm/cli/cli/split-pane.html | |
# default pane movement basic (arrow keys) | |
shift-control-leftarrow | |
shift-control-rightarrow | |
shift-control-uparrow | |
shift-control-downarrow | |
# get some help with the command line | |
wezterm cli --help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Pull in the wezterm API | |
local wezterm = require 'wezterm' | |
-- This will hold the configuration | |
local config = wezterm.config_builder() | |
-- This will hold the actions | |
local act = wezterm.action | |
-- config.color_scheme = 'AdventureTime' | |
font = wezterm.font('JetBrainsMono Nerd Font') | |
-- Spawn a fish shell in login mode | |
config.default_prog = { '/usr/bin/fish', '-l' } | |
-- dim inactive pane | |
config.inactive_pane_hsb = { | |
saturation = 0.9, | |
brightness = 0.1, | |
} | |
-- Right Mouse Click Copy and Paste | |
config.mouse_bindings = { | |
{ | |
event = { Down = { streak = 1, button = "Right" } }, | |
mods = "NONE", | |
action = wezterm.action_callback(function(window, pane) | |
local has_selection = window:get_selection_text_for_pane(pane) ~= "" | |
if has_selection then | |
window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane) | |
window:perform_action(act.ClearSelection, pane) | |
else | |
window:perform_action(act({ PasteFrom = "Clipboard" }), pane) | |
end | |
end), | |
}, | |
} | |
-- keyboard configuration to close current pane | |
config.keys = { | |
-- close pane with confirmation if active process | |
{ | |
key = 'w', | |
mods = 'CMD', | |
action = wezterm.action.CloseCurrentPane { confirm = true }, | |
}, | |
-- name tab | |
{ | |
key = 'R', | |
mods = 'CMD|SHIFT', | |
action = act.PromptInputLine { | |
description = 'Enter new name for tab', | |
action = wezterm.action_callback(function(window, _, line) | |
-- line will be `nil` if they hit escape without entering anything | |
-- An empty string if they just hit enter | |
-- Or the actual line of text they wrote | |
if line then | |
window:active_tab():set_title(line) | |
end | |
end), | |
}, | |
}, | |
--open wezterm config file | |
{ | |
key = ',', | |
mods = 'CMD', | |
action = act.SpawnCommandInNewTab { | |
cwd = os.getenv('WEZTERM_CONFIG_DIR'), | |
set_environment_variables = { | |
TERM = 'screen-256color', | |
}, | |
args = { | |
'nano', | |
os.getenv('WEZTERM_CONFIG_FILE'), | |
}, | |
}, | |
}, | |
} | |
-- and finally, return the configuration to wezterm | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment