Compare commits
6 Commits
de2cc5ce0d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d85862d94 | |||
| 71c1ef142f | |||
| 0becf1e5cd | |||
| 13bd3b3704 | |||
| cc01130c63 | |||
| 3b661354ca |
59
wezterm.lua
59
wezterm.lua
@@ -1,15 +1,22 @@
|
||||
local wezterm = require('wezterm')
|
||||
local config = wezterm.config_builder()
|
||||
|
||||
config.default_prog = {
|
||||
wezterm.on('gui-startup', function()
|
||||
local tab, pane, window = wezterm.mux.spawn_window({})
|
||||
tab:set_title('home')
|
||||
end)
|
||||
|
||||
if string.find(wezterm.target_triple, 'windows') then
|
||||
config.default_prog = {
|
||||
'powershell.exe', '-ExecutionPolicy', 'Bypass', '-NoLogo', '-NoExit'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
config.font = wezterm.font('CaskaydiaCove Nerd Font Mono')
|
||||
config.font_size = 9
|
||||
config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }
|
||||
|
||||
config.color_scheme = 'Tango (terminal.sexy)'
|
||||
config.color_scheme = 'Firefly Traditional'
|
||||
config.colors = {
|
||||
foreground = '#D3D7CF',
|
||||
cursor_fg = 'black',
|
||||
@@ -44,16 +51,31 @@ config.keys = {
|
||||
mods = 'CTRL|SHIFT',
|
||||
action = wezterm.action.CloseCurrentPane { confirm = true },
|
||||
},
|
||||
-- TODO: Make CTRL|SHIFT T open in home directory
|
||||
-- TODO: Make CTRL|ALT " open in current directory
|
||||
-- TODO: Make CTRL|ALT % open in current directory
|
||||
}
|
||||
|
||||
local move_mods = 'CTRL|SHIFT'
|
||||
local function send_key(window, pane)
|
||||
-- TODO: Detect if tmux is running
|
||||
-- Detect if vim/nvim is running
|
||||
-- Failing that, check if there is only a single pane
|
||||
local function send_move_key(window, pane)
|
||||
-- TODO: Detect if vim/nvim is running
|
||||
-- We can't use pane:get_foreground_process_info() because it appears to
|
||||
-- contain info about the most recent process launched in the pane. During
|
||||
-- testing this was lua-language-server.exe so obisouly can't be used to
|
||||
-- determine if we're running inside neovim.
|
||||
-- WezTerm supports the OSC 1337 SetUserVar escape sequence, this could be
|
||||
-- used to inform WezTerm that neovim is running in a given tab.
|
||||
|
||||
if pane:get_user_vars()['vim'] ~= nil then
|
||||
if pane:get_user_vars().vim ~= '1' then
|
||||
return false
|
||||
end
|
||||
elseif #window:active_tab():panes() > 1 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local move_mods = 'CTRL'
|
||||
for _, map in pairs({
|
||||
{ key = 'h', direction = 'Left' },
|
||||
{ key = 'l', direction = 'Right' },
|
||||
@@ -64,9 +86,9 @@ for _, map in pairs({
|
||||
key = map.key,
|
||||
mods = move_mods,
|
||||
action = wezterm.action_callback(function(window, pane)
|
||||
if send_key(window, pane) then
|
||||
if send_move_key(window, pane) then
|
||||
window:perform_action(
|
||||
wezterm.action.SendKey({ key = map.key, modes = move_mods }), pane)
|
||||
wezterm.action.SendKey({ key = map.key, mods = move_mods }), pane)
|
||||
else
|
||||
window:perform_action(
|
||||
wezterm.action.ActivatePaneDirection(map.direction), pane)
|
||||
@@ -75,4 +97,21 @@ for _, map in pairs({
|
||||
})
|
||||
end
|
||||
|
||||
-- Attempt require(module) load a module, don't fail if its missing.
|
||||
-- Additionally, call the returned function passing in the wezterm and config
|
||||
-- objects defined in this file.
|
||||
local try_require = function(module)
|
||||
pcall(function() require(module)(wezterm, config) end)
|
||||
end;
|
||||
|
||||
-- Example of ~/.config/wezterm/local.lua to set the window size
|
||||
--
|
||||
-- ```lua
|
||||
-- return function(wezterm, config)
|
||||
-- config.initial_rows = 107
|
||||
-- config.initial_cols = 322
|
||||
-- end
|
||||
-- ```
|
||||
try_require('local')
|
||||
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user