Skip to content

Instantly share code, notes, and snippets.

@osak
Last active December 10, 2025 15:42
Show Gist options
  • Select an option

  • Save osak/67ce7a21cff9551bd2b1ed0d6584fe16 to your computer and use it in GitHub Desktop.

Select an option

Save osak/67ce7a21cff9551bd2b1ed0d6584fe16 to your computer and use it in GitHub Desktop.
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = 'Catppuccin Latte'
config.default_prog = { 'C:/msys64/usr/bin/zsh.exe', '-l' }
config.set_environment_variables = {
MSYSTEM = 'MINGW64',
MSYS2_PATH_TYPE = 'inherit',
HOME = wezterm.home_dir,
}
config.font = wezterm.font_with_fallback {
'Hack Nerd Font',
'Source Han Code JP'
}
config.font_size = 11
config.scrollback_lines = 1000
config.leader = { key = 'k', mods = 'CTRL', timeout_milliseconds = 1000 }
config.keys = {
{
key = 'c',
mods = 'LEADER',
action = wezterm.action.SpawnTab 'CurrentPaneDomain',
},
-- Leader + " で水平分割
{
key = '"',
mods = 'LEADER|SHIFT',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
-- Leader + % で垂直分割
{
key = '%',
mods = 'LEADER|SHIFT',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = 'x',
mods = 'LEADER',
action = wezterm.action.CloseCurrentPane { confirm = false },
},
-- Leader + h/j/k/l でペイン移動
{ key = 'h', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Left', },
{ key = 'j', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Down', },
{ key = 'k', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Up', },
{ key = 'l', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Right', },
{ key = '1', mods = 'LEADER', action = wezterm.action.ActivateTab(0), },
{ key = '2', mods = 'LEADER', action = wezterm.action.ActivateTab(1), },
{ key = '3', mods = 'LEADER', action = wezterm.action.ActivateTab(2), },
{ key = '4', mods = 'LEADER', action = wezterm.action.ActivateTab(3), },
{ key = '5', mods = 'LEADER', action = wezterm.action.ActivateTab(4), },
{ key = '6', mods = 'LEADER', action = wezterm.action.ActivateTab(5), },
{ key = '7', mods = 'LEADER', action = wezterm.action.ActivateTab(6), },
{ key = '8', mods = 'LEADER', action = wezterm.action.ActivateTab(7), },
{ key = '9', mods = 'LEADER', action = wezterm.action.ActivateTab(8), },
-- 検索
{ key = '?', mods = 'LEADER|SHIFT', action = wezterm.action.Search {CaseSensitiveString=""}, },
-- コピー
{ key = '[', mods = 'LEADER', action = wezterm.action.ActivateCopyMode, },
-- 前のプロンプトへ
{ key = 'UpArrow', mods = 'SHIFT|CTRL', action = wezterm.action.ScrollToPrompt(-1) },
-- 次のプロンプトへ
{ key = 'DownArrow', mods = 'SHIFT|CTRL', action = wezterm.action.ScrollToPrompt(1) },
}
config.audible_bell = "Disabled"
local copy_mode_additional_keys = {
{ key = 'k', mods = 'SHIFT', action = wezterm.action.CopyMode { MoveBackwardZoneOfType = 'Output' } },
{ key = 'j', mods = 'SHIFT', action = wezterm.action.CopyMode { MoveForwardZoneOfType = 'Output' } },
{ key = 'k', mods = 'SHIFT|CTRL', action = wezterm.action.CopyMode { MoveBackwardZoneOfType = 'Prompt' } },
{ key = 'j', mods = 'SHIFT|CTRL', action = wezterm.action.CopyMode { MoveForwardZoneOfType = 'Prompt' } },
{ key = '[', mods = 'CTRL', action = wezterm.action.CopyMode 'Close' },
{ key = '/', mods = 'NONE', action = wezterm.action.Search {CaseSensitiveString=""}, },
}
local copy_mode = wezterm.gui.default_key_tables().copy_mode
for _, key in ipairs(copy_mode_additional_keys) do
table.insert(copy_mode, key)
end
local search_mode_additional_keys = {
{ key = '[', mods = 'CTRL', action = wezterm.action.CopyMode 'AcceptPattern' },
}
local search_mode = wezterm.gui.default_key_tables().search_mode
for _, key in ipairs(search_mode_additional_keys) do
table.insert(search_mode, key)
end
config.key_tables = {
copy_mode = copy_mode,
search_mode = search_mode,
}
-- and finally, return the configuration to wezterm
return config
# The following lines were added by compinstall
zstyle :compinstall filename '/c/Users/osak6/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
source <(fzf --zsh)
export EDITOR=vim
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line # Ctrl+X Ctrl+Eにバインド
_prompt_executing=""
function __prompt_precmd() {
local ret="$?"
if test "$_prompt_executing" != "0"
then
_PROMPT_SAVE_PS1="$PS1"
_PROMPT_SAVE_PS2="$PS2"
PS1=$'%{\e]133;P;k=i\a%}'$PS1$'%{\e]133;B\a\e]122;> \a%}'
PS2=$'%{\e]133;P;k=s\a%}'$PS2$'%{\e]133;B\a%}'
fi
if test "$_prompt_executing" != ""
then
printf "\033]133;D;%s;aid=%s\007" "$ret" "$$"
fi
printf "\033]133;A;cl=m;aid=%s\007" "$$"
_prompt_executing=0
}
function __prompt_preexec() {
PS1="$_PROMPT_SAVE_PS1"
PS2="$_PROMPT_SAVE_PS2"
printf "\033]133;C;\007"
_prompt_executing=1
}
preexec_functions+=(__prompt_preexec)
precmd_functions+=(__prompt_precmd)
alias vi=vim
alias ls='ls --color -F'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment