summaryrefslogtreecommitdiff
path: root/dot_config/wezterm/keys.lua
blob: 22889da18b28fbd55bf95be0aa50564ac846a954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
local wezterm = require("wezterm")

local M = {
    leader = { key = "t", mods = "CTRL", timeout_milliseconds = 500 },
    key_bindings = {
        -- Leader commands
        -- Ctrl+t (for "terminal" is my leader key for Wezterm, and it's the gateway
        -- into all my most-used terminal commands.
        -- By avoiding the single keystroke Ctrl+t in my Vim config, I can prevent
        -- key conflicts between Vim and Wezterm.

        -- Pane splitting
        { key = "s", mods = "LEADER|CTRL", action = wezterm.action.SplitHorizontal },
        { key = "v", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.SplitVertical },

        -- Clipboard actions
        { key = "v", mods = "LEADER|CTRL", action = wezterm.action.PasteFrom("Clipboard") },
        { key = "x", mods = "LEADER|CTRL", action = wezterm.action.ActivateCopyMode },

        -- Fallback - use Ctrl-T, Ctrl-Shift-T to send a literal "Ctrl-T" to the console
        { key = "t", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.SendKey({ key = "t", mods = "CTRL" }) },

        -- Ctrl+h/j/k/l is for Vim, so use C+A+h/j/k/l to move between
        -- panes in the terminal
        { key = "h", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Left" } },
        { key = "j", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Down" } },
        { key = "k", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Up" } },
        { key = "l", mods = "CTRL|ALT", action = { ActivatePaneDirection = "Right" } },

        -- Reload config
        { key = "r", mods = "LEADER|CTRL|SHIFT", action = wezterm.action.ReloadConfiguration },

    },
}

return M