-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwezterm.lua
106 lines (99 loc) · 3.55 KB
/
wezterm.lua
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
local wezterm = require('wezterm')
local act = wezterm.action
local function isViProcess(pane)
-- get_foreground_process_name On Linux, macOS and Windows,
-- the process can be queried to determine this path. Other operating systems
-- (notably, FreeBSD and other unix systems) are not currently supported
return pane:get_foreground_process_name():find('n?vim') ~= nil
-- return pane:get_title():find("n?vim") ~= nil
end
local function conditionalActivatePane(window, pane, pane_direction, vim_direction)
if isViProcess(pane) then
window:perform_action(
-- This should match the keybinds you set in Neovim.
act.SendKey({ key = vim_direction, mods = 'CTRL' }),
pane
)
else
window:perform_action(act.ActivatePaneDirection(pane_direction), pane)
end
end
wezterm.on('ActivatePaneDirection-right', function(window, pane)
conditionalActivatePane(window, pane, 'Right', 'l')
end)
wezterm.on('ActivatePaneDirection-left', function(window, pane)
conditionalActivatePane(window, pane, 'Left', 'h')
end)
wezterm.on('ActivatePaneDirection-up', function(window, pane)
conditionalActivatePane(window, pane, 'Up', 'k')
end)
wezterm.on('ActivatePaneDirection-down', function(window, pane)
conditionalActivatePane(window, pane, 'Down', 'j')
end)
return {
-- timeout_milliseconds defaults to 1000 and can be omitted
-- color_scheme = "tokyonight",
-- color_scheme = "Catppuccin Latte",
color_scheme = "Catppuccin Latte",
leader = { key = 'Space', mods = 'CTRL' },
keys = {
{
key = 'Space',
mods = 'LEADER',
action = wezterm.action.ActivateCopyMode,
},
-- {
-- key = 'h',
-- mods = 'SUPER',
-- action = wezterm.action.ActivatePaneDirection "Left",
-- },
-- {
-- key = 'l',
-- mods = 'SUPER',
-- action = wezterm.action.ActivatePaneDirection "Right",
-- },
-- {
-- key = 'j',
-- mods = 'SUPER',
-- action = wezterm.action.ActivatePaneDirection "Down",
-- },
-- {
-- key = 'k',
-- mods = 'SUPER',
-- action = wezterm.action.ActivatePaneDirection "Up",
-- },
{
key = '|',
mods = 'SUPER|SHIFT',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = '_',
mods = 'SUPER|SHIFT',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = 'z',
mods = 'LEADER',
action = wezterm.action.TogglePaneZoomState,
},
{ key = 'x', mods = 'SUPER', action = wezterm.action.CloseCurrentPane { confirm = true } },
{ key = '0', mods = 'SUPER', action = wezterm.action.ResetFontSize },
{ key = '+', mods = 'SUPER', action = wezterm.action.IncreaseFontSize },
{ key = '-', mods = 'SUPER', action = wezterm.action.DecreaseFontSize },
{ key = 'h', mods = 'CTRL', action = act.EmitEvent('ActivatePaneDirection-left') },
{ key = 'j', mods = 'CTRL', action = act.EmitEvent('ActivatePaneDirection-down') },
{ key = 'k', mods = 'CTRL', action = act.EmitEvent('ActivatePaneDirection-up') },
{ key = 'l', mods = 'CTRL', action = act.EmitEvent('ActivatePaneDirection-right') },
},
hide_tab_bar_if_only_one_tab = true,
tab_bar_at_bottom = true,
use_fancy_tab_bar = false,
-- Rather than emitting fancy composed characters when alt is pressed, treat the
-- input more like old school ascii with ALT held down
send_composed_key_when_left_alt_is_pressed = true,
-- similarly, don't ask the macOS IME/text services to compose input
-- use_ime = false,
scrollback_lines = 100000,
term = "xterm-256color",
}