@@ -2,48 +2,101 @@ local wezterm = require 'wezterm'
22local config = wezterm .config_builder ()
33-- local projects = require 'projects'
44local 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" )
58
69config .hide_tab_bar_if_only_one_tab = true
710config .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' , }, }
814
915-- macOS: disable AltGr
1016config .send_composed_key_when_right_alt_is_pressed = false
1117
1218config .color_scheme = ' Catppuccin Mocha'
1319config .font = wezterm .font ' FantasqueSansM Nerd Font'
14- config .font_size = 18
20+ config .font_size = is_mac and 24 or 18
1521
16- config .leader = {mods = ' ALT' , key = ' m' }
22+ config .leader = {mods = ' CTRL' , key = ' Space' }
23+ config .disable_default_key_bindings = is_mac
1724config .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 },
3076 { 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' },
3279 { 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' } },
3484
3585 -- {
3686 -- key = 'p',
3787 -- mods = 'LEADER',
3888 -- -- Present in to our project picker
3989 -- action = projects.choose_project(),
4090 -- },
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 ) },
4795}
4896
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+
49102return config
0 commit comments