@@ -2,48 +2,101 @@ local wezterm = require 'wezterm'
2
2
local config = wezterm .config_builder ()
3
3
-- local projects = require 'projects'
4
4
local act = wezterm .action
5
+ local is_mac = wezterm .target_triple :find (" darwin" ) ~= nil
6
+
7
+ local workspace_switcher = wezterm .plugin .require (" https://github.com/MLFlexer/smart_workspace_switcher.wezterm" )
5
8
6
9
config .hide_tab_bar_if_only_one_tab = true
7
10
config .harfbuzz_features = {" calt=0" , " clig=0" , " liga=0" }
11
+ config .window_padding = { left = 0 , right = 0 , top = 0 , bottom = 0 }
12
+
13
+ config .unix_domains = { { name = ' unix' , }, }
8
14
9
15
-- macOS: disable AltGr
10
16
config .send_composed_key_when_right_alt_is_pressed = false
11
17
12
18
config .color_scheme = ' Catppuccin Mocha'
13
19
config .font = wezterm .font ' FantasqueSansM Nerd Font'
14
- config .font_size = 18
20
+ config .font_size = is_mac and 24 or 18
15
21
16
- config .leader = {mods = ' ALT' , key = ' m' }
22
+ config .leader = {mods = ' CTRL' , key = ' Space' }
23
+ config .disable_default_key_bindings = is_mac
17
24
config .keys = {
18
- {mods = ' LEADER|CTRL' , key = ' a' , action = act .SendKey { key = ' a' , mods = ' CTRL' }},
19
- {mods = ' LEADER' , key = ' v' , action = act .SplitHorizontal { domain = ' CurrentPaneDomain' }},
20
- {mods = ' LEADER' , key = " '" , action = act .SplitVertical { domain = ' CurrentPaneDomain' }},
21
- {mods = ' LEADER' , key = ' h' , action = act {ActivatePaneDirection = ' Left' }},
22
- {mods = ' LEADER' , key = ' j' , action = act {ActivatePaneDirection = ' Down' }},
23
- {mods = ' LEADER' , key = ' k' , action = act {ActivatePaneDirection = ' Up' }},
24
- {mods = ' LEADER' , key = ' l' , action = act {ActivatePaneDirection = ' Right' }},
25
- {mods = ' CTRL|SHIFT' , key = ' t' , action = act .SpawnTab ' CurrentPaneDomain' },
26
- {mods = ' CTRL|SHIFT' , key = ' w' , action = act .CloseCurrentTab {confirm = true }},
27
- {mods = ' CTRL|SHIFT' , key = ' Space' , action = act .DisableDefaultAssignment },
28
-
29
- -- copy, paste, search --
25
+ { key = ' Space' , mods = " LEADER|CTRL" , action = act .SendKey { key = " Space" , mods = " CTRL" } },
26
+ -- Disable QuickSelect
27
+ { key = ' Space' , mods = ' CTRL|SHIFT' , action = act .DisableDefaultAssignment },
28
+
29
+ -- = Tabs
30
+ { key = ' c' , mods = ' LEADER' , action = act .SpawnTab ' CurrentPaneDomain' },
31
+ { key = ' p' , mods = ' LEADER' , action = act .ActivateTabRelative (- 1 )},
32
+ { key = ' n' , mods = ' LEADER' , action = act .ActivateTabRelative (1 )},
33
+ { key = ' W' , mods = ' CTRL' , action = act .CloseCurrentTab {confirm = true }},
34
+ { key = ' {' , mods = ' SHIFT|CTRL' , action = act .MoveTabRelative (- 1 ) },
35
+ { key = ' }' , mods = ' SHIFT|CTRL' , action = act .MoveTabRelative (1 ) },
36
+
37
+ -- = Panes
38
+ { key = ' v' , mods = ' LEADER' , action = act .SplitHorizontal { domain = ' CurrentPaneDomain' }},
39
+ { key = " '" , mods = ' LEADER' , action = act .SplitVertical { domain = ' CurrentPaneDomain' }},
40
+ { key = ' z' , mods = ' LEADER' , action = act .TogglePaneZoomState },
41
+
42
+ -- Navigate panes
43
+ {
44
+ key = ' h' , mods = ' ALT' ,
45
+ action = wezterm .action_callback (function (window , pane )
46
+ local tab = window :mux_window ():active_tab ()
47
+ if tab :get_pane_direction (' Left' ) ~= nil then
48
+ window :perform_action (wezterm .action .ActivatePaneDirection (' Left' ), pane )
49
+ else
50
+ window :perform_action (wezterm .action .ActivateTabRelative (- 1 ), pane )
51
+ end
52
+ end ),
53
+ },
54
+ {
55
+ key = ' l' , mods = ' ALT' ,
56
+ action = wezterm .action_callback (function (window , pane )
57
+ local tab = window :mux_window ():active_tab ()
58
+ if tab :get_pane_direction (' Right' ) ~= nil then
59
+ window :perform_action (wezterm .action .ActivatePaneDirection (' Right' ), pane )
60
+ else
61
+ window :perform_action (wezterm .action .ActivateTabRelative (1 ), pane )
62
+ end
63
+ end ),
64
+ },
65
+ { key = ' j' , mods = ' ALT' , action = act {ActivatePaneDirection = ' Down' }},
66
+ { key = ' k' , mods = ' ALT' , action = act {ActivatePaneDirection = ' Up' }},
67
+
68
+ -- Resize pane
69
+ { key = ' H' , mods = ' LEADER' , action = act .AdjustPaneSize {' Left' , 3 }},
70
+ { key = ' J' , mods = ' LEADER' , action = act .AdjustPaneSize {' Down' , 3 }},
71
+ { key = ' K' , mods = ' LEADER' , action = act .AdjustPaneSize {' Up' , 3 }},
72
+ { key = ' L' , mods = ' LEADER' , action = act .AdjustPaneSize {' Right' , 3 }},
73
+
74
+ -- copy, paste, search --
75
+ { key = ' x' , mods = ' SHIFT|CTRL' , action = act .ActivateCopyMode },
30
76
{ key = ' c' , mods = ' SUPER' , action = act .CopyTo ' Clipboard' },
31
- { key = ' v' , mods = ' SUPER' , action = act .PasteFrom ' Clipboard' },
77
+ { key = ' v' , mods = ' SUPER' , action = act .PasteFrom ' PrimarySelection' },
78
+ { key = ' V' , mods = ' CTRL' , action = act .PasteFrom ' PrimarySelection' },
32
79
{ key = ' f' , mods = ' SHIFT|CTRL' , action = act .Search ' CurrentSelectionOrEmptyString' },
33
- -- { key = ' ', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
80
+
81
+ -- = Session
82
+ { key = ' a' , mods = ' LEADER' , action = act .AttachDomain ' unix' , },
83
+ { key = ' d' , mods = ' LEADER' , action = act .DetachDomain { DomainName = ' unix' } },
34
84
35
85
-- {
36
86
-- key = 'p',
37
87
-- mods = 'LEADER',
38
88
-- -- Present in to our project picker
39
89
-- action = projects.choose_project(),
40
90
-- },
41
- {
42
- key = ' f' ,
43
- mods = ' LEADER' ,
44
- -- Present a list of existing workspaces
45
- action = wezterm .action .ShowLauncherArgs { flags = ' FUZZY|WORKSPACES' },
46
- },
91
+ { key = " s" , mods = " CTRL|SHIFT" , action = workspace_switcher .switch_workspace () },
92
+ { key = ' t' , mods = ' CTRL|SHIFT' , action = wezterm .action .ShowLauncherArgs { flags = ' FUZZY|WORKSPACES' }},
93
+ { key = " [" , mods = " LEADER" , action = act .SwitchWorkspaceRelative (- 1 ) },
94
+ { key = " ]" , mods = " LEADER" , action = act .SwitchWorkspaceRelative (1 ) },
47
95
}
48
96
97
+ for i = 1 ,9 do
98
+ config .keys [# config .keys + 1 ] = {mods = ' CTRL|SHIFT' , key = tostring (i ), action = act .ActivateTab (i - 1 ) }
99
+ config .keys [# config .keys + 1 ] = {mods = ' LEADER' , key = tostring (i ), action = act .ActivateTab (i - 1 ) }
100
+ end
101
+
49
102
return config
0 commit comments