update
This commit is contained in:
		
							parent
							
								
									7962d7bf93
								
							
						
					
					
						commit
						3eecc4853e
					
				
					 1 changed files with 32 additions and 74 deletions
				
			
		| 
						 | 
				
			
			@ -11,39 +11,6 @@ if wezterm.config_builder then
 | 
			
		|||
  config = wezterm.config_builder()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
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 = 'ALT' }),
 | 
			
		||||
            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)
 | 
			
		||||
 | 
			
		||||
-- Do not check for or show window with update information
 | 
			
		||||
config.check_for_updates = false
 | 
			
		||||
config.show_update_window = false
 | 
			
		||||
| 
						 | 
				
			
			@ -77,58 +44,49 @@ config.tab_max_width                = 24
 | 
			
		|||
config.colors = {
 | 
			
		||||
  tab_bar = {
 | 
			
		||||
    background = '#1d2021',
 | 
			
		||||
 | 
			
		||||
    active_tab = {
 | 
			
		||||
      bg_color = '#1d2021',
 | 
			
		||||
      fg_color = '#d4be98',
 | 
			
		||||
      intensity = 'Normal',
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    inactive_tab = {
 | 
			
		||||
      bg_color = '#1d2021',
 | 
			
		||||
      fg_color = '#7c6f64',
 | 
			
		||||
      intensity = 'Half',
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    new_tab = {
 | 
			
		||||
      bg_color = '#1d2021',
 | 
			
		||||
      fg_color = '#7c6f64',
 | 
			
		||||
      intensity = 'Half',
 | 
			
		||||
    }
 | 
			
		||||
    -- style tabs
 | 
			
		||||
    active_tab          = { bg_color = '#1d2021', fg_color = '#d4be98', intensity = 'Normal', italic = false, },
 | 
			
		||||
    inactive_tab        = { bg_color = '#1d2021', fg_color = '#7c6f64', intensity = 'Half',   italic = false, },
 | 
			
		||||
    inactive_tab_hover  = { bg_color = '#1d2021', fg_color = '#7c6f64', intensity = 'Half',   italic = false, },
 | 
			
		||||
    new_tab             = { bg_color = '#1d2021', fg_color = '#7c6f64', intensity = 'Half',   italic = false, },
 | 
			
		||||
    new_tab_hover       = { bg_color = '#1d2021', fg_color = '#7c6f64', intensity = 'Half',   italic = false, },
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-- Key Assignments
 | 
			
		||||
config.disable_default_key_bindings = true
 | 
			
		||||
config.keys = {
 | 
			
		||||
  -- Tabs
 | 
			
		||||
  { key = 't', mods = 'ALT',      action = act.SpawnTab 'CurrentPaneDomain' },
 | 
			
		||||
  { key = 'w', mods = "ALT|CTRL", action = act.CloseCurrentTab { confirm = false } },
 | 
			
		||||
config.keys = {}
 | 
			
		||||
 | 
			
		||||
  -- Panes
 | 
			
		||||
  { key = 'v', mods = 'ALT', action = act.SplitVertical    { domain  = 'CurrentPaneDomain' } },
 | 
			
		||||
  { key = 'h', mods = 'ALT', action = act.SplitHorizontal  { domain  = 'CurrentPaneDomain' } },
 | 
			
		||||
  { key = 'x', mods = "ALT", action = act.CloseCurrentPane { confirm = false               } },
 | 
			
		||||
  -- Navigation
 | 
			
		||||
  { key = 'LeftArrow',  mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-left' ) },
 | 
			
		||||
  { key = 'DownArrow',  mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-down' ) },
 | 
			
		||||
  { key = 'UpArrow',    mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-up'   ) },
 | 
			
		||||
  { key = 'RightArrow', mods = 'ALT', action = act.EmitEvent('ActivatePaneDirection-right') },
 | 
			
		||||
 | 
			
		||||
  -- Clipboard
 | 
			
		||||
  { key = 'X', mods = 'CTRL', action = act.ActivateCopyMode                         },
 | 
			
		||||
  { key = 'C', mods = 'CTRL', action = act.CopyTo    'ClipboardAndPrimarySelection' },
 | 
			
		||||
  { key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard'                    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-- Bind tabs to number keys
 | 
			
		||||
for i = 1, 5 do
 | 
			
		||||
for i = 1, 8 do
 | 
			
		||||
  -- CTRL+ALT + number to activate that tab
 | 
			
		||||
  table.insert(config.keys, {
 | 
			
		||||
    key = tostring(i),
 | 
			
		||||
    mods = 'ALT',
 | 
			
		||||
    mods = 'CTRL|ALT',
 | 
			
		||||
    action = act.ActivateTab(i - 1),
 | 
			
		||||
  })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
config.keys = {
 | 
			
		||||
  -- Tabs
 | 
			
		||||
  { key = 't', mods = 'ALT',      action = act.SpawnTab 'CurrentPaneDomain',        },
 | 
			
		||||
  { key = 'w', mods = "ALT|CTRL", action = act.CloseCurrentTab { confirm = false }, },
 | 
			
		||||
 | 
			
		||||
  -- Panes
 | 
			
		||||
  { key = 'v', mods = 'ALT', action = act.SplitVertical    { domain  = 'CurrentPaneDomain' }, },
 | 
			
		||||
  { key = 'h', mods = 'ALT', action = act.SplitHorizontal  { domain  = 'CurrentPaneDomain' }, },
 | 
			
		||||
  { key = 'x', mods = "ALT", action = act.CloseCurrentPane { confirm = false               }, },
 | 
			
		||||
 | 
			
		||||
  -- Navigation
 | 
			
		||||
  { key = 'LeftArrow',  mods = 'ALT', action = act.ActivateTabRelative(-1)       },
 | 
			
		||||
  { key = 'RightArrow', mods = 'ALT', action = act.ActivateTabRelative(1)        },
 | 
			
		||||
  { key = 'DownArrow',  mods = 'ALT', action = act.ActivatePaneDirection 'Next', },
 | 
			
		||||
  { key = 'UpArrow',    mods = 'ALT', action = act.ActivatePaneDirection 'Prev', },
 | 
			
		||||
 | 
			
		||||
  -- Copy Mode / Clipboard
 | 
			
		||||
  { key = 'X', mods = 'CTRL', action = act.ActivateCopyMode,                         },
 | 
			
		||||
  { key = 'C', mods = 'CTRL', action = act.CopyTo    'ClipboardAndPrimarySelection', },
 | 
			
		||||
  { key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard',                    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
return config
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue