diff --git a/wezterm/.wezterm.lua b/wezterm/.wezterm.lua deleted file mode 100644 index 5fddd1c..0000000 --- a/wezterm/.wezterm.lua +++ /dev/null @@ -1,83 +0,0 @@ --- pull in the wezterm API -local wezterm = require('wezterm') -local launch_menu = {} - --- This will hold the configuration -local config = wezterm.config_builder() -config.colors = { background = "#1e1e2e" } -config.color_scheme = 'Catppuccin Mocha' -config.window_background_opacity = 1.0 -config.default_prog = { 'C:/Program Files/PowerShell/7/pwsh.exe' } - -config.window_frame = { - font = wezterm.font { family = 'Roboto', weight = 'Bold' }, - font_size = 12, - active_titlebar_bg = '#1e1e2e', - inactive_titlebar_bg = '#1e1e2e', -} - -config.colors = { - tab_bar = { - active_tab = { - - bg_color = '#181825', - fg_color = "#B4BEFE" - }, - inactive_tab = { - bg_color = '#1e1e2e', - fg_color = "#CDD6F4" - }, - new_tab = { - bg_color = '#1e1e2e', - fg_color = "#CDD6F4" - }, - new_tab_hover ={ - bg_color = '#1b1032', - fg_color = '#808080', - } - }, -} - --- Keys -local act = wezterm.action -config.leader = { key = "a", mods="CTRL", timeout_milliseconds = 1000} - -config.keys = { - { key = "s", mods = "LEADER", action = act.SplitVertical { domain = "CurrentPaneDomain"}}, - { key = "v", mods = "LEADER", action = act.SplitHorizontal { domain = "CurrentPaneDomain" }}, - { key = "h", mods = "LEADER", action = act.ActivatePaneDirection("Left") }, - { key = "j", mods = "LEADER", action = act.ActivatePaneDirection("Down") }, - { key = "k", mods = "LEADER", action = act.ActivatePaneDirection("Up") }, - { key = "l", mods = "LEADER", action = act.ActivatePaneDirection("Right") }, - { key = "q", mods = "LEADER", action = act.CloseCurrentPane { confirm = false }}, - { key = "n", mods = "LEADER", action = act.ShowTabNavigator }, - { key = "t", mods = "LEADER", action = act.ShowLauncher }, -} - --- config.enable_tab_bar = false -config.window_decorations = "INTEGRATED_BUTTONS | TITLE | RESIZE" -if wezterm.target_triple == 'x86_64-pc-windows-msvc' then - table.insert(launch_menu, { - label = 'PowerShell 7', - args = { 'pwsh.exe', '-NoLogo' }, - }) - table.insert(launch_menu, { - label = 'PowerShell', - args = { 'PowerShell.exe', '-NoLogo' }, - }) - - for _, vsvers in - ipairs ( wezterm.glob('VisualStudio20*', 'D:/')) do - local year = vsvers:gsub('VisualStudio', '') - table.insert(launch_menu, { - label = 'X64 Native Tools VS ' .. year, - args = { - 'cmd.exe', - '/k', - 'D:/' .. vsvers .. '/VC/Auxiliary/Build/vcvars64.bat' }, - }) -end -end - -config.launch_menu = launch_menu -return config diff --git a/wezterm/dot-wezterm.lua b/wezterm/dot-wezterm.lua index 07f4d19..32477ae 100644 --- a/wezterm/dot-wezterm.lua +++ b/wezterm/dot-wezterm.lua @@ -1,68 +1,49 @@ -- pull in the wezterm API local wezterm = require('wezterm') -local launch_menu = {} +require "theme" +require "keys" -- This will hold the configuration local config = wezterm.config_builder() -config.colors = { background = "#1e1e2e" } -config.color_scheme = 'Catppuccin Mocha' -config.window_background_opacity = 0.8 - -config.window_frame = { - font = wezterm.font { family = 'Roboto', weight = 'Bold' }, - font_size = 12, - active_titlebar_bg = '#1e1e2e', - inactive_titlebar_bg = '#1e1e2e', -} - -config.colors = { - tab_bar = { - active_tab = { - - bg_color = '#181825', - fg_color = "#B4BEFE" - }, - inactive_tab = { - bg_color = '#1e1e2e', - fg_color = "#CDD6F4" - }, - new_tab = { - bg_color = '#1e1e2e', - fg_color = "#CDD6F4" - }, - new_tab_hover = { - bg_color = '#1b1032', - fg_color = '#808080', - } - }, -} - --- Keys -local act = wezterm.action -config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 } - -config.keys = { - { key = "s", mods = "LEADER", action = act.SplitVertical { domain = "CurrentPaneDomain" } }, - { key = "v", mods = "LEADER", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } }, - { key = "h", mods = "LEADER", action = act.ActivatePaneDirection("Left") }, - { key = "j", mods = "LEADER", action = act.ActivatePaneDirection("Down") }, - { key = "k", mods = "LEADER", action = act.ActivatePaneDirection("Up") }, - { key = "l", mods = "LEADER", action = act.ActivatePaneDirection("Right") }, - { key = "q", mods = "LEADER", action = act.CloseCurrentPane { confirm = false } }, - { key = "n", mods = "LEADER", action = act.ShowTabNavigator }, - { key = "t", mods = "LEADER", action = act.ShowLauncher }, -} config.enable_tab_bar = false -config.window_decorations = "INTEGRATED_BUTTONS | TITLE | RESIZE" +-- The most common triples are: +-- +-- x86_64-pc-windows-msvc - Windows +-- x86_64-apple-darwin - macOS (Intel) +-- aarch64-apple-darwin - macOS (Apple Silicon) +-- x86_64-unknown-linux-gnu - Linux +local launch_menu = {} if wezterm.target_triple == 'x86_64-pc-windows-msvc' then + table.insert(launch_menu, { + label = 'PowerShell', + args = { 'PowerShell.exe', '-NoLogo' }, + }) table.insert(launch_menu, { label = 'PowerShell 7', args = { 'pwsh.exe', '-NoLogo' }, }) table.insert(launch_menu, { - label = 'PowerShell', - args = { 'PowerShell.exe', '-NoLogo' }, + label = "Developer PowerShell", + args = { + 'pwsh.exe', + '-noe', + '-c', + '&{Import-Module "C:/Program Files (x86)/Microsoft Visual Studio/18/BuildTools/Common7/Tools/Microsoft.VisualStudio.DevShell.dll";Enter-VsDevShell 6c43edf9 };wezterm cli set-tab-title \'Developer Powershell\'' + }, + cwd = 'G:/git' + }) + + + table.insert(launch_menu, { + label = "Conda PowerShell", + args = { + 'pwsh.exe', + '-noe', + '-c', + '& \'C:/Users/nigel/miniconda3/shell/condabin/conda-hook.ps1\'; conda activate base ' + }, + cwd = 'G:/git/Machine Learning' }) for _, vsvers in @@ -78,5 +59,13 @@ if wezterm.target_triple == 'x86_64-pc-windows-msvc' then end end +if wezterm.target_triple == 'x86_64-pc-windows-msvc' then + config.default_prog = { 'C:/Program Files/Powershell/7/pwsh.exe' } +else + config.default_prog = { '/usr/bin/bash' } +end + + config.launch_menu = launch_menu +config.window_close_confirmation = "NeverPrompt" return config diff --git a/wezterm/keys.lua b/wezterm/keys.lua new file mode 100644 index 0000000..d05b205 --- /dev/null +++ b/wezterm/keys.lua @@ -0,0 +1,50 @@ +local wezterm = require 'wezterm' + +local act = wezterm.action + + +config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 } +config.keys = { + { key = "s", mods = "LEADER", action = act.SplitVertical { domain = "CurrentPaneDomain" } }, + { key = "v", mods = "LEADER", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } }, + { key = "h", mods = "ALT", action = act.ActivatePaneDirection("Left") }, + { key = "j", mods = "ALT", action = act.ActivatePaneDirection("Down") }, + { key = "k", mods = "ALT", action = act.ActivatePaneDirection("Up") }, + { key = "l", mods = "ALT", action = act.ActivatePaneDirection("Right") }, + { key = "q", mods = "LEADER", action = act.CloseCurrentPane { confirm = false } }, + { key = "t", mods = "LEADER", action = act.ShowTabNavigator }, + { key = "n", mods = "LEADER", action = act.ShowLauncher }, + { key = "t", mods = "ALT", action = act.ShowLauncherArgs { flags = "TABS|FUZZY" } }, + { key = 'w', mods = 'ALT', action = act.ShowLauncherArgs { flags = 'WORKSPACES|FUZZY' } }, +} + +local function isViProcess(pane) + return pane:get_foreground_process_name():find('n?vim') ~= nil or 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('ShowLauncherArgs', function(window, pane) + wezterm.info_log 'launcher args called ' +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) diff --git a/wezterm/theme.lua b/wezterm/theme.lua new file mode 100644 index 0000000..c758a43 --- /dev/null +++ b/wezterm/theme.lua @@ -0,0 +1,52 @@ +local wezterm = require 'wezterm' +config.window_decorations = "INTEGRATED_BUTTONS | TITLE | RESIZE" + +config.colors = { background = "#1e1e2e" } +config.color_scheme = 'Catppuccin Mocha' +config.window_background_opacity = 0.9 +config.window_decorations = "INTEGRATED_BUTTONS | TITLE | RESIZE" +config.window_frame = { + font = wezterm.font { family = 'Roboto', weight = 'Bold' }, + font_size = 12, + active_titlebar_bg = '#1e1e2e', + inactive_titlebar_bg = '#1e1e2e', +} + +config.colors = { + tab_bar = { + active_tab = { + + bg_color = '#181825', + fg_color = "#B4BEFE" + }, + inactive_tab = { + bg_color = '#1e1e2e', + fg_color = "#CDD6F4" + }, + new_tab = { + bg_color = '#1e1e2e', + fg_color = "#CDD6F4" + }, + new_tab_hover = { + bg_color = '#1b1032', + fg_color = '#808080', + } + }, +} + +wezterm.on('update-status', function(window) + local SOLID_LEFT_ARROW = utf8.char(0xe0b2) + + local color_scheme = window:effective_config().resolved_palette + local bg = color_scheme.background + local fg = color_scheme.foreground + + window:set_right_status(wezterm.format({ + { Background = { Color = 'none' } }, + { Foreground = { Color = bg } }, + { Text = SOLID_LEFT_ARROW }, + { Background = { Color = bg } }, + { Foreground = { Color = fg } }, + { Text = ' ' .. wezterm.hostname() .. ', WKSPC: ' .. wezterm.mux.get_active_workspace() .. '' }, + })) +end)