Docs of Jace-Lab

WezTerm

개인 설정

작성해주신 설정 파일은 **Ctrl + a**를 리더 키(Leader Key)로 사용하는 tmux 스타일의 구성이네요. 이 설정에 맞춰서 현재 바로 사용할 수 있는 단축키들을 정리해 드립니다.

모든 단축키는 먼저 **Ctrl + a**를 눌렀다 뗀 후, 1초 이내에 해당 키를 누르면 작동합니다.


1. 리더 키 및 기본 조작

기능단축키비고
리더 키 (Leader)Ctrl + a모든 단축키의 시작
Ctrl + a 입력 전송Leadera터미널 자체에 C-a를 보내고 싶을 때
복사 모드 진입Leaderc스크롤 및 텍스트 선택 모드

2. 패널(Pane) 관리

화면을 나누고 이동하는 가장 핵심적인 기능들입니다.

기능단축키비고
가로로 분할 (상하)Leader-위/아래로 화면 나눔
세로로 분할 (좌우)Leader → ``
패널 이동 (HJKL)Leaderh, j, k, l왼쪽, 아래, 위, 오른쪽 패널로 이동
패널 닫기Leaderx현재 패널 종료 (확인 팝업 뜸)
패널 확대/축소Leaderz현재 패널을 전체 화면으로 (Toggle)
패널 회전Leaders패널 위치를 시계 방향으로 회전
패널 크기 조절 모드Leaderrresize_pane 테이블 진입

3. 탭(Tab) 관리

상단 탭을 제어하는 단축키입니다.

기능단축키비고
새 탭 생성Leadern현재 경로에서 새 탭 열기
이전 탭 이동Leader[왼쪽 탭으로 이동
다음 탭 이동Leader]오른쪽 탭으로 이동
탭 내비게이터Leadert모든 탭 목록을 보고 선택
탭 위치 이동 모드Leadermmove_tab 테이블 진입

💡 팁: KeyTable 활용하기

설정하신 r(크기 조절)과 m(탭 이동)은 KeyTable 방식입니다.

  1. 패널 크기 조절 (Leaderr): 한 번 진입하면 리더 키를 다시 누를 필요 없이 방향키(또는 설정된 키)만으로 연속해서 크기를 조절할 수 있습니다. (설정된 one_shot = false 덕분입니다.)
  2. 탭 순서 변경 (Leaderm): 탭의 위치를 왼쪽/오른쪽으로 옮길 때 사용합니다.

이 설정대로라면 tmux에 익숙한 사용자에게 매우 효율적인 워크플로우가 되겠네요! 혹시 resize_pane이나 move_tab 테이블 안에 들어갈 구체적인 방향키 설정도 필요하신가요?

~/.wezterm.lua
-- Keys
config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 }
config.keys = {
  -- Send C-a when pressing C-a twice
  { key = "a", mods = "LEADER",       action = act.SendKey { key = "a", mods = "CTRL" } },
  { key = "c", mods = "LEADER",       action = act.ActivateCopyMode },

  -- Pane keybindings
  { key = "-", mods = "LEADER",       action = act.SplitVertical { domain = "CurrentPaneDomain" } },
  -- SHIFT is for when caps lock is on
  { key = "|", mods = "LEADER|SHIFT", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } },
  { key = "h", mods = "LEADER",       action = act.ActivatePaneDirection("Left") },
  { key = "j", mods = "LEADER",       action = act.ActivatePaneDirection("Down") },
  { key = "k", mods = "LEADER",       action = act.ActivatePaneDirection("Up") },
  { key = "l", mods = "LEADER",       action = act.ActivatePaneDirection("Right") },
  { key = "x", mods = "LEADER",       action = act.CloseCurrentPane { confirm = true } },
  { key = "z", mods = "LEADER",       action = act.TogglePaneZoomState },
  { key = "s", mods = "LEADER",       action = act.RotatePanes "Clockwise" },
  -- We can make separate keybindings for resizing panes
  -- But Wezterm offers custom "mode" in the name of "KeyTable"
  { key = "r", mods = "LEADER",       action = act.ActivateKeyTable { name = "resize_pane", one_shot = false } },

  -- Tab keybindings
  { key = "n", mods = "LEADER",       action = act.SpawnTab("CurrentPaneDomain") },
  { key = "[", mods = "LEADER",       action = act.ActivateTabRelative(-1) },
  { key = "]", mods = "LEADER",       action = act.ActivateTabRelative(1) },
  { key = "t", mods = "LEADER",       action = act.ShowTabNavigator },
  -- Key table for moving tabs around
  { key = "m", mods = "LEADER",       action = act.ActivateKeyTable { name = "move_tab", one_shot = false } },


  -- Lastly, workspace
  { key = "w", mods = "LEADER",       action = act.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" } },

}
-- I can use the tab navigator (LDR t), but I also want to quickly navigate tabs with index
for i = 1, 9 do
  table.insert(config.keys, {
    key = tostring(i),
    mods = "LEADER",
    action = act.ActivateTab(i - 1)
  })
end

config.key_tables = {
  resize_pane = {
    { key = "h",      action = act.AdjustPaneSize { "Left", 1 } },
    { key = "j",      action = act.AdjustPaneSize { "Down", 1 } },
    { key = "k",      action = act.AdjustPaneSize { "Up", 1 } },
    { key = "l",      action = act.AdjustPaneSize { "Right", 1 } },
    { key = "Escape", action = "PopKeyTable" },
    { key = "Enter",  action = "PopKeyTable" },
  },
  move_tab = {
    { key = "h",      action = act.MoveTabRelative(-1) },
    { key = "j",      action = act.MoveTabRelative(-1) },
    { key = "k",      action = act.MoveTabRelative(1) },
    { key = "l",      action = act.MoveTabRelative(1) },
    { key = "Escape", action = "PopKeyTable" },
    { key = "Enter",  action = "PopKeyTable" },
  }
}

기본 설정

1. 윈도우 및 탭 관리

기능단축키 (Windows/Linux)단축키 (macOS)
새 탭 열기Ctrl + Shift + TCmd + T
탭 닫기Ctrl + Shift + WCmd + W
다음 탭으로 이동Ctrl + TabShift + Cmd + ]
이전 탭으로 이동Ctrl + Shift + TabShift + Cmd + [
특정 번호 탭 이동Alt + 1 ~ 9Cmd + 1 ~ 9
새 윈도우 열기Ctrl + Shift + NCmd + N

2. 화면 분할 (Pane)

하나의 탭을 여러 구역으로 나누어 쓸 때 사용합니다.

기능단축키 (Windows/Linux)단축키 (macOS)
가로로 분할 (Vertical)Ctrl + Shift + "Cmd + D
세로로 분할 (Horizontal)Ctrl + Shift + %Cmd + Shift + D
분할된 창 간 이동Ctrl + Shift + 방향키Cmd + [ 또는 ]
창 크기 조절Ctrl + Shift + R 이후 방향키(동일)
현재 창 최대화/복구Ctrl + Shift + ZCmd + Shift + Z

3. 복사, 붙여넣기 및 검색

기능단축키 (Windows/Linux)단축키 (macOS)
복사 (Copy)Ctrl + Shift + CCmd + C
붙여넣기 (Paste)Ctrl + Shift + VCmd + V
문자열 검색 (Search)Ctrl + Shift + FCmd + F
Quick Select (빠른 선택)Ctrl + Shift + Space(동일)

Tip: Quick Select 모드를 실행하면 화면상의 경로, URL, 해시값 등에 단축 알파벳이 뜹니다. 해당 키를 누르면 바로 복사됩니다.


4. 유틸리티 및 설정

  • 글자 크기 조절:
    • 크게: Ctrl + + (macOS: Cmd + +)
    • 작게: Ctrl + - (macOS: Cmd + -)
    • 초기화: Ctrl + 0 (macOS: Cmd + 0)
  • 디버그 오버레이 (설정 확인): Ctrl + Shift + L (설정 파일의 에러를 확인할 때 유용합니다.)
  • 스크롤 모드 (Copy Mode): Ctrl + Shift + X
    • 이 모드에서는 키보드(Vi 방식: h, j, k, l)로 텍스트를 선택하고 복사할 수 있습니다.

5. 나만의 단축키 설정 (Lua)

WezTerm의 진가는 wezterm.lua 파일에서 단축키를 직접 지정할 때 나타납니다. 예를 들어, Alt + d로 창을 분할하고 싶다면 아래와 같이 추가합니다.

local wezterm = require 'wezterm'
local config = {}

config.keys = {
  {
    key = 'd',
    mods = 'ALT',
    action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  },
}

return config

.wezterm.lua @260811

-- https://github.com/theopn/dotfiles/blob/25b85936ef3e7195a0f029525f854fdb915b9f90/wezterm/wezterm.luarocks
--
local wezterm = require("wezterm")
local act = wezterm.action

local config = {}
-- Use config builder object if possible
if wezterm.config_builder then config = wezterm.config_builder() end

-- Settings
config.color_scheme = "Tokyo Night"
config.font = wezterm.font_with_fallback({
  { family = "D2CodingLigature Nerd Font", scale = 1.4},
--  { family = "CaskaydiaCove Nerd Font",  scale = 1.2 },
--  { family = "FantasqueSansM Nerd Font", scale = 1.2 },
})
config.window_background_opacity = 0.9
config.window_decorations = "RESIZE"
config.window_close_confirmation = "AlwaysPrompt"
config.scrollback_lines = 3000
config.default_workspace = "home"

-- Dim inactive panes
config.inactive_pane_hsb = {
  saturation = 0.24,
  brightness = 0.5
}

-- Keys
config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 }
config.keys = {
  -- Send C-a when pressing C-a twice
  { key = "a", mods = "LEADER",       action = act.SendKey { key = "a", mods = "CTRL" } },
  { key = "c", mods = "LEADER",       action = act.ActivateCopyMode },

  -- Pane keybindings
  { key = "-", mods = "LEADER",       action = act.SplitVertical { domain = "CurrentPaneDomain" } },
  -- SHIFT is for when caps lock is on
  { key = "|", mods = "LEADER|SHIFT", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } },
  { key = "h", mods = "LEADER",       action = act.ActivatePaneDirection("Left") },
  { key = "j", mods = "LEADER",       action = act.ActivatePaneDirection("Down") },
  { key = "k", mods = "LEADER",       action = act.ActivatePaneDirection("Up") },
  { key = "l", mods = "LEADER",       action = act.ActivatePaneDirection("Right") },
  { key = "x", mods = "LEADER",       action = act.CloseCurrentPane { confirm = true } },
  { key = "z", mods = "LEADER",       action = act.TogglePaneZoomState },
  { key = "s", mods = "LEADER",       action = act.RotatePanes "Clockwise" },
  -- We can make separate keybindings for resizing panes
  -- But Wezterm offers custom "mode" in the name of "KeyTable"
  { key = "r", mods = "LEADER",       action = act.ActivateKeyTable { name = "resize_pane", one_shot = false } },

  -- Tab keybindings
  { key = "n", mods = "LEADER",       action = act.SpawnTab("CurrentPaneDomain") },
  { key = "[", mods = "LEADER",       action = act.ActivateTabRelative(-1) },
  { key = "]", mods = "LEADER",       action = act.ActivateTabRelative(1) },
  { key = "t", mods = "LEADER",       action = act.ShowTabNavigator },
  -- Key table for moving tabs around
  { key = "m", mods = "LEADER",       action = act.ActivateKeyTable { name = "move_tab", one_shot = false } },


  -- Lastly, workspace
  { key = "w", mods = "LEADER",       action = act.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" } },

}
-- I can use the tab navigator (LDR t), but I also want to quickly navigate tabs with index
for i = 1, 9 do
  table.insert(config.keys, {
    key = tostring(i),
    mods = "LEADER",
    action = act.ActivateTab(i - 1)
  })
end

config.key_tables = {
  resize_pane = {
    { key = "h",      action = act.AdjustPaneSize { "Left", 1 } },
    { key = "j",      action = act.AdjustPaneSize { "Down", 1 } },
    { key = "k",      action = act.AdjustPaneSize { "Up", 1 } },
    { key = "l",      action = act.AdjustPaneSize { "Right", 1 } },
    { key = "Escape", action = "PopKeyTable" },
    { key = "Enter",  action = "PopKeyTable" },
  },
  move_tab = {
    { key = "h",      action = act.MoveTabRelative(-1) },
    { key = "j",      action = act.MoveTabRelative(-1) },
    { key = "k",      action = act.MoveTabRelative(1) },
    { key = "l",      action = act.MoveTabRelative(1) },
    { key = "Escape", action = "PopKeyTable" },
    { key = "Enter",  action = "PopKeyTable" },
  }
}

-- Tab bar
-- I don't like the look of "fancy" tab bar
config.use_fancy_tab_bar = false
config.status_update_interval = 1
wezterm.on("update-right-status", function(window, pane)
  -- Workspace name
  local stat = window:active_workspace()
  -- It's a little silly to have workspace name all the time
  -- Utilize this to display LDR or current key table name
  if window:active_key_table() then stat = window:active_key_table() end
  if window:leader_is_active() then stat = "LDR" end

  -- Current working directory
  local basename = function(s)
    -- tostring()을 사용하여 Url 또는 nil 값을 안전하게 문자열로 변환
    local s_str = tostring(s or "")
    -- Nothign a little regex can't fix
    return string.gsub(s_str, "(.*[/\\])(.*)", "%2")
  end
  local cwd = basename(pane:get_current_working_dir() or "")
  -- Current command
  local cmd = basename(pane:get_foreground_process_name() or "none")

  -- Time
  local time = wezterm.strftime("%H:%M:%S")

  -- Let's add color to one of the components
  window:set_right_status(wezterm.format({
    -- Wezterm has a built-in nerd fonts
    { Text = wezterm.nerdfonts.oct_table .. "  " .. stat },
    { Text = " | " },
    { Text = wezterm.nerdfonts.md_folder .. "  " .. cwd },
    { Text = " | " },
    { Foreground = { Color = "FFB86C" } },
    { Text = wezterm.nerdfonts.fa_code .. "  " .. cmd },
    "ResetAttributes",
    { Text = " | " },
    { Text = wezterm.nerdfonts.md_clock .. "  " .. time },
    { Text = " " },
  }))
end)

return config

On this page