From 75e431fe824b192611d607f8477970b3c84fe8a9 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Fri, 4 Oct 2024 07:33:27 -0400 Subject: [PATCH] changed some configs --- nvim/.config/nvim | 2 +- skhd/.config/skhd/skhdrc | 102 +++--- starship/.config/starship.toml | 1 + .../wezterm/{projects => profiles}/infra.lua | 13 +- .../{projects => profiles}/job_req.lua | 0 .../wezterm/{projects => profiles}/neovim.lua | 0 wezterm/.config/wezterm/theme-switcher.lua | 17 +- wezterm/.wezterm.lua | 326 ++++++++++-------- yabai/.config/yabai/yabairc | 5 +- zsh/.zprofile | 46 +-- zsh/.zshenv | 84 +++++ zsh/.zshrc | 80 ++--- 12 files changed, 379 insertions(+), 297 deletions(-) rename wezterm/.config/wezterm/{projects => profiles}/infra.lua (68%) rename wezterm/.config/wezterm/{projects => profiles}/job_req.lua (100%) rename wezterm/.config/wezterm/{projects => profiles}/neovim.lua (100%) create mode 100755 zsh/.zshenv diff --git a/nvim/.config/nvim b/nvim/.config/nvim index 3a09e91..0ff8a55 160000 --- a/nvim/.config/nvim +++ b/nvim/.config/nvim @@ -1 +1 @@ -Subproject commit 3a09e91ad6393c50c33ec628c2b4b410914664b8 +Subproject commit 0ff8a55592922e5192f225d1a60d374478a5ba9b diff --git a/skhd/.config/skhd/skhdrc b/skhd/.config/skhd/skhdrc index 475d830..4860e4b 100755 --- a/skhd/.config/skhd/skhdrc +++ b/skhd/.config/skhd/skhdrc @@ -1,90 +1,94 @@ -#change window focus within space +# Change window focus within space shift + cmd - j : yabai -m window --focus south shift + cmd - k : yabai -m window --focus north shift + cmd - h : yabai -m window --focus west shift + cmd - l : yabai -m window --focus east # Resize windows -lctrl + alt - h : yabai -m window --resize left:-50:0; \ - yabai -m window --resize right:-50:0 -lctrl + alt - j : yabai -m window --resize bottom:0:50; \ - yabai -m window --resize top:0:50 -lctrl + alt - k : yabai -m window --resize top:0:-50; \ - yabai -m window --resize bottom:0:-50 -lctrl + alt - l : yabai -m window --resize right:50:0; \ - yabai -m window --resize left:50:0 +lctrl + alt - h : yabai -m window --resize left:-50:0; yabai -m window --resize right:-50:0 +lctrl + alt - j : yabai -m window --resize bottom:0:50; yabai -m window --resize top:0:50 +lctrl + alt - k : yabai -m window --resize top:0:-50; yabai -m window --resize bottom:0:-50 +lctrl + alt - l : yabai -m window --resize right:50:0; yabai -m window --resize left:50:0 # Equalize size of windows lctrl + alt - e : yabai -m space --balance -# change space # -shift + cmd - 1 : yabai -m space --display 1 -shift + cmd - 2 : yabai -m space --display 2 -shift + cmd - 3 : yabai -m space --display 3 -shift + cmd - 4 : yabai -m space --display 4 -shift + cmd - 5 : yabai -m space --display 5 -shift + cmd - 6 : yabai -m space --display 6 -shift + cmd - 7 : yabai -m space --display 7 +# Change space +shift + cmd - 1 : yabai -m space --focus 1 +shift + cmd - 2 : yabai -m space --focus 2 +shift + cmd - 3 : yabai -m space --focus 3 +shift + cmd - 4 : yabai -m space --focus 4 +shift + cmd - 5 : yabai -m space --focus 5 +shift + cmd - 6 : yabai -m space --focus 6 +shift + cmd - 7 : yabai -m space --focus 7 -#change focus between external displays (left and right) -cmd - h: yabai -m display --focus west -cmd - l: yabai -m display --focus east +# Change focus between external displays (left and right) +cmd - h : yabai -m display --focus west +cmd - l : yabai -m display --focus east -# rotate layout clockwise +# Rotate layout clockwise shift + alt - r : yabai -m space --rotate 270 -# flip along y-axis +# Flip along y-axis shift + alt - y : yabai -m space --mirror y-axis -# flip along x-axis +# Flip along x-axis shift + alt - x : yabai -m space --mirror x-axis -# toggle window float +# Toggle window float shift + alt - t : yabai -m window --toggle float --grid 4:4:1:1:2:2 -# maximize a window +# Maximize a window shift + alt - m : yabai -m window --toggle zoom-fullscreen -# toggle whether the focused window should be shown on all spaces +# Toggle whether the focused window should be shown on all spaces shift + alt - a : yabai -m window --toggle sticky -# swap windows +# Swap windows shift + alt - j : yabai -m window --swap south shift + alt - k : yabai -m window --swap north shift + alt - h : yabai -m window --swap west shift + alt - l : yabai -m window --swap east -# move window and split +# Move window and split ctrl + alt - j : yabai -m window --warp south ctrl + alt - k : yabai -m window --warp north ctrl + alt - h : yabai -m window --warp west ctrl + alt - l : yabai -m window --warp east -# move window to display left and right -shift + alt - s : yabai -m window --display west; yabai -m display --focus west; -shift + alt - g : yabai -m window --display east; yabai -m display --focus east; +# Move window to display left and right +shift + alt - s : yabai -m window --display west; yabai -m display --focus west +shift + alt - g : yabai -m window --display east; yabai -m display --focus east -#move window to prev and next space -shift + alt - p : yabai -m window --space prev; -shift + alt - n : yabai -m window --space next; +# Move window to previous and next space +shift + alt - p : yabai -m window --space prev +shift + alt - n : yabai -m window --space next -# move window to space # -shift + alt - 1 : yabai -m window --space 1; -shift + alt - 2 : yabai -m window --space 2; -shift + alt - 3 : yabai -m window --space 3; -shift + alt - 4 : yabai -m window --space 4; -shift + alt - 5 : yabai -m window --space 5; -shift + alt - 6 : yabai -m window --space 6; -shift + alt - 7 : yabai -m window --space 7; +# Move window to space # +shift + alt - 1 : yabai -m window --space 1 +shift + alt - 2 : yabai -m window --space 2 +shift + alt - 3 : yabai -m window --space 3 +shift + alt - 4 : yabai -m window --space 4 +shift + alt - 5 : yabai -m window --space 5 +shift + alt - 6 : yabai -m window --space 6 +shift + alt - 7 : yabai -m window --space 7 -# # open apps -ctrl + shift - t : open -a /Applications/WezTerm.app/Contents/MacOS/wezterm -ctrl + shift - b : open -an /Applications/Firefox.app/Contents/MacOS/firefox -ctrl + shift - v : open -an /Applications/VSCodium.app/Contents/MacOS/Electron -ctrl + shift - m : open -a Mail.app -ctrl + shift - w : open -a /Applications/Bitwarden.app/Contents/MacOS/Bitwarden +# Move window to different positions within the mosaic grid +shift + ctrl + alt - h : yabai -m window --warp west +shift + ctrl + alt - j : yabai -m window --warp south +shift + ctrl + alt - k : yabai -m window --warp north +shift + ctrl + alt - l : yabai -m window --warp east -# stop/start/restart yabai +# Focus or open Applications +alt - t : open -a /Applications/WezTerm.app +alt - f : open -a /Applications/Firefox.app +alt - n : open -a /Applications/Safari.app +alt - s : open -a /Applications/Slack.app +alt - v : open -a /Applications/VSCodium.app +alt - m : open -a /System/Applications/Mail.app +alt - w : open -a /Applications/Bitwarden.app + +# Stop/start/restart yabai ctrl + alt - q : yabai --stop-service ctrl + alt - s : yabai --start-service ctrl + alt - r : yabai --restart-service diff --git a/starship/.config/starship.toml b/starship/.config/starship.toml index 7fa4347..c93b665 100644 --- a/starship/.config/starship.toml +++ b/starship/.config/starship.toml @@ -49,6 +49,7 @@ disabled = false [character] success_symbol = "[ ❯](bold green)" error_symbol = "[ ✗](bold red)" +vicmd_symbol = "[ V](bold green)" # Directory [directory] diff --git a/wezterm/.config/wezterm/projects/infra.lua b/wezterm/.config/wezterm/profiles/infra.lua similarity index 68% rename from wezterm/.config/wezterm/projects/infra.lua rename to wezterm/.config/wezterm/profiles/infra.lua index f151b93..af05d55 100644 --- a/wezterm/.config/wezterm/projects/infra.lua +++ b/wezterm/.config/wezterm/profiles/infra.lua @@ -2,18 +2,25 @@ local wezterm = require("wezterm") local function startup() local mux = wezterm.mux - local project_dir = wezterm.home_dir .. "/Documents/projects/infra" + + local project_name = os.getenv("WZ_PROFILE") + if not project_name then + wezterm.log_error("WZ_PROFILE is not set") + return + end + + local profiles_dir = wezterm.home_dir .. "/Documents/profiles/infra" -- Spawn a new window with the specified project directory as the working directory local tab, main_pane, window = mux.spawn_window({ - cwd = project_dir, + cwd = profiles_dir, }) main_pane:send_text("vim .\n") -- Split the main pane to the right and start ipython local ssh_pane = main_pane:split({ direction = "Right", - cwd = project_dir, + cwd = profiles_dir, }) ssh_pane:send_text("wezterm ssh ansible@jfraeys.com\n") diff --git a/wezterm/.config/wezterm/projects/job_req.lua b/wezterm/.config/wezterm/profiles/job_req.lua similarity index 100% rename from wezterm/.config/wezterm/projects/job_req.lua rename to wezterm/.config/wezterm/profiles/job_req.lua diff --git a/wezterm/.config/wezterm/projects/neovim.lua b/wezterm/.config/wezterm/profiles/neovim.lua similarity index 100% rename from wezterm/.config/wezterm/projects/neovim.lua rename to wezterm/.config/wezterm/profiles/neovim.lua diff --git a/wezterm/.config/wezterm/theme-switcher.lua b/wezterm/.config/wezterm/theme-switcher.lua index be97041..94462a1 100644 --- a/wezterm/.config/wezterm/theme-switcher.lua +++ b/wezterm/.config/wezterm/theme-switcher.lua @@ -84,7 +84,7 @@ local tab_bar_colors = { -- @return: Whether the command is available local function is_command_available(cmd) -- Use os.execute with a command that checks for command existence - local result = os.execute('command -v ' .. cmd) + local result = os.execute("command -v " .. cmd) return result end @@ -101,22 +101,16 @@ local function update_starship_palette(palette_name) if is_command_available("sd") then -- Use sd if available - replace_command = string.format( - 'sd \'palette = .+\' \'palette = "%s"\' %s', - palette_name, - starship_config_path - ) + replace_command = string.format("sd 'palette = .+' 'palette = \"%s\"' %s", palette_name, starship_config_path) else -- Fall back to sed for both macOS and Linux - replace_command = string.format( - 'sed -i \'\' -e \'s/palette = .*/palette = "%s"/\' %s', - palette_name, - starship_config_path - ) + replace_command = + string.format("sed -i '' -e 's/palette = .*/palette = \"%s\"/' %s", palette_name, starship_config_path) end os.execute(replace_command) end + -- Apply the configuration and update the Starship palette -- @param config: The configuration object -- @return: The updated configuration object @@ -139,4 +133,3 @@ function M.apply_to_config(config) end return M - diff --git a/wezterm/.wezterm.lua b/wezterm/.wezterm.lua index 2a9d08e..f627167 100644 --- a/wezterm/.wezterm.lua +++ b/wezterm/.wezterm.lua @@ -4,36 +4,38 @@ local act = wezterm.action -- Pull custom modules local theme = require("theme-switcher") -local meeting_notifier = require("meeting-notifier") --- local history = require("history") local config = {} local keys = {} local key_tables = {} -- This will hold the configuration. -if wezterm.config_builer then +if wezterm.config_builder then config = wezterm.config_builder() end -config.debug_key_events = true +-- config.debug_key_events = true +-- Check the platform and configure settings accordingly if wezterm.target_triple == "x86_64-pc-windows-msvc" then config.default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" } elseif wezterm.target_triple == "x86_64-apple-darwin" then config.macos_window_background_blur = 10 config.default_prog = { "/bin/zsh", "-l" } config.font = wezterm.font_with_fallback({ - { family = "MesloLGS Nerd Font", scale = 0.9 }, - { family = "Menlo", scale = 0.9 }, + { family = "MesloLGS NF", scale = 0.9 }, + { family = "Menlo", scale = 0.9 }, }) elseif wezterm.target_triple == "aarch64-apple-darwin" then config.macos_window_background_blur = 10 config.default_prog = { "/bin/zsh", "-l" } config.font = wezterm.font_with_fallback({ - { family = "MesloLGS Nerd Font", scale = 0.9 }, - { family = "Menlo", scale = 0.9 }, + -- { family = "JetBrainsMono Nerd Font", scale = 0.9 }, + { family = "MesloLGS NF", scale = 0.9 }, + { family = "Menlo", scale = 0.9 }, }) + + config.front_end = "WebGpu" elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then config.default_prog = { "/bin/bash", "-l" } config.font = wezterm.font_with_fallback({ @@ -44,6 +46,7 @@ end config.check_for_updates = true config.use_ime = true +config.use_dead_keys = false config.term = "xterm-256color" theme.apply_to_config(config) config.line_height = 1.1 @@ -78,6 +81,9 @@ if config.enable_tab_bar then config.use_fancy_tab_bar = false config.tab_max_width = 25 config.show_new_tab_button_in_tab_bar = false + config.window_frame = { + font = wezterm.font({ family = "Meslo NF", weight = "Regular" }), + } end config.switch_to_last_active_tab_when_closing_tab = true @@ -85,10 +91,6 @@ config.window_close_confirmation = "NeverPrompt" config.audible_bell = "Disabled" -config.window_frame = { - font = wezterm.font({ family = "Meslo NF", weight = "Regular" }), -} - config.hyperlink_rules = { -- Matches: a URL in parens: (URL) { @@ -128,78 +130,83 @@ config.hyperlink_rules = { } config.set_environment_variables = { - PATH = wezterm.home_dir .. "/.local/bin/scripts:" .. "/usr/local/bin:" .. os.getenv("PATH"), + PATH = wezterm.home_dir .. "/.local/bin/scripts:" .. "/opt/homebrew/bin:" .. "/usr/local/bin:" .. os.getenv("PATH"), } config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 } + keys = { - { key = "LeftArrow", mods = "OPT", action = act.SendString("\x1bb") }, - { key = "RightArrow", mods = "OPT", action = act.SendString("\x1bf") }, + { key = "LeftArrow", mods = "OPT", action = act.SendString("\x1bb") }, + { key = "RightArrow", mods = "OPT", action = act.SendString("\x1bf") }, -- The physical CMD key on OSX is the Alt key on Win/*nix, so map the common Alt-combo commands. - { key = ".", mods = "CMD", action = act.SendString("\x1b.") }, - { key = "p", mods = "CMD", action = act.SendString("\x1bp") }, - { key = "n", mods = "CMD", action = act.SendString("\x1bn") }, - { key = "b", mods = "CMD", action = act.SendString("\x1bb") }, - { key = "f", mods = "CMD", action = act.SendString("\x1bf") }, + { key = ".", mods = "CMD", action = act.SendString("\x1b.") }, + { key = "p", mods = "CMD", action = act.SendString("\x1bp") }, + { key = "n", mods = "CMD", action = act.SendString("\x1bn") }, + { key = "b", mods = "CMD", action = act.SendString("\x1bb") }, + { key = "f", mods = "CMD", action = act.SendString("\x1bf") }, -- Window management - { key = "a", mods = "LEADER", action = act({ SendString = "`" }) }, - { key = "v", mods = "LEADER", action = act({ SplitVertical = { domain = "CurrentPaneDomain" } }) }, - { key = "b", mods = "LEADER", action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, - { key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, - { key = "c", mods = "LEADER", action = act({ SpawnTab = "CurrentPaneDomain" }) }, - { key = "n", mods = "LEADER", action = act({ ActivateTabRelative = 1 }) }, - { key = "p", mods = "LEADER", action = act({ ActivateTabRelative = -1 }) }, + { key = "a", mods = "LEADER", action = act({ SendString = "`" }) }, + { key = "v", mods = "LEADER", action = act({ SplitVertical = { domain = "CurrentPaneDomain" } }) }, + { key = "b", mods = "LEADER", action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, + { key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, + { key = "c", mods = "LEADER", action = act({ SpawnTab = "CurrentPaneDomain" }) }, + { key = "n", mods = "LEADER", action = act({ ActivateTabRelative = 1 }) }, + { key = "p", mods = "LEADER", action = act({ ActivateTabRelative = -1 }) }, - { 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 = "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 = "H", mods = "LEADER", action = act({ AdjustPaneSize = { "Left", 5 } }) }, - { key = "J", mods = "LEADER", action = act({ AdjustPaneSize = { "Down", 5 } }) }, - { key = "K", mods = "LEADER", action = act({ AdjustPaneSize = { "Up", 5 } }) }, - { key = "L", mods = "LEADER", action = act({ AdjustPaneSize = { "Right", 5 } }) }, + { key = "H", mods = "LEADER", action = act({ AdjustPaneSize = { "Left", 5 } }) }, + { key = "J", mods = "LEADER", action = act({ AdjustPaneSize = { "Down", 5 } }) }, + { key = "K", mods = "LEADER", action = act({ AdjustPaneSize = { "Up", 5 } }) }, + { key = "L", mods = "LEADER", action = act({ AdjustPaneSize = { "Right", 5 } }) }, - { key = "`", mods = "LEADER", action = act.ActivateLastTab }, - { key = " ", mods = "LEADER", action = act.ActivateTabRelative(1) }, - { key = "x", mods = "LEADER", action = act({ CloseCurrentPane = { confirm = true } }) }, - - -- { - -- key = "f", - -- mods = "LEADER", - -- action = act.SpawnCommandInNewTab({ - -- args = { "sessionizer" }, - -- }), - -- }, + { key = "`", mods = "LEADER", action = act.ActivateLastTab }, + { key = " ", mods = "LEADER", action = act.ActivateTabRelative(1) }, + { key = "x", mods = "LEADER", action = act({ CloseCurrentPane = { confirm = true } }) }, { key = "f", mods = "LEADER", - action = wezterm.action_callback(function(window, pane) - -- Check if the pane is a command-line environment - local title = pane:get_title() - if title:match("^[%a%d%._-]+[%s]*$") then - -- Example condition: check if the title matches common command-line patterns - window:perform_action(wezterm.action.SendString("sessionizer\n"), pane) - end - end), + action = act.SpawnCommandInNewTab({ + args = { config.default_prog[1], "-c", "sessionizer" }, + }), }, { - key = "d", + key = "]", mods = "LEADER", - action = wezterm.action_callback(function(window, pane) - window:perform_action(act.SendString("wzp\n"), pane) - end), + action = act.SpawnCommandInNewTab({ + args = { config.default_prog[1], "-c", "wzp" }, + }), }, { key = "o", mods = "LEADER", action = wezterm.action_callback(function(window, pane) - window:perform_action(act.SendString("vim .\n"), pane) + local editor = os.getenv("EDITOR") or "vi" + window:perform_action(wezterm.action.SendString(editor .. " ."), pane) + end), + }, + + { + key = "m", + mods = "LEADER", + action = act.SpawnCommandInNewTab({ + args = { config.default_prog[1], "-c", "notetaker" }, + }), + }, + + { + key = "m", + mods = "LEADER|SHIFT", + action = wezterm.action_callback(function(window, pane) + window.perform_action(wezterm.action.SendString("most_recent_note"), pane) end), }, @@ -232,24 +239,19 @@ keys = { -- end), -- }, - { key = "w", mods = "LEADER", action = act.ShowTabNavigator }, - - -- Activate Copy Mode - { key = "[", mods = "LEADER", action = act.ActivateCopyMode }, - -- Paste from Copy Mode - { key = "y", mods = "LEADER", action = act.PasteFrom("PrimarySelection") }, - --open wezterm config quickly { key = ",", mods = "LEADER", - action = act.SpawnCommandInNewTab({ - cwd = os.getenv("WEZTERM_CONFIG_DIR"), + action = wezterm.action.SpawnCommandInNewTab({ + cwd = os.getenv("WEZTERM_CONFIG_DIR") or os.getenv("HOME"), -- Use home directory if $WEZTERM_CONFIG_DIR is not set set_environment_variables = { TERM = "screen-256color", }, args = { - "/usr/local/bin/nvim", + config.default_prog[1], + "-c", + os.getenv("EDITOR") or "vi", -- Default to vi if $EDITOR is not set os.getenv("WEZTERM_CONFIG_FILE"), }, }), @@ -261,13 +263,13 @@ keys = { action = act.ReloadConfiguration, }, - -- Swich to default workspace + -- Swich to default orkspace { key = "y", mods = "CTRL | SHIFT", action = act.SwitchToWorkspace({ name = "default", - }) + }), }, --Switch to monitoring workspace @@ -277,28 +279,37 @@ keys = { action = act.SwitchToWorkspace({ name = "monitoring", spawn = { - args = { "top" }, + args = { "btm" }, }, }), }, - -- Create a new workspace with a randomm anem and switch to it + -- Create a new workspace with a randomm name and switch to it { key = "i", mods = "CTRL | SHIFT", action = act.SwitchToWorkspace }, - -- Show command history - -- { - -- key = "r", - -- mods = "CTRL", - -- action = wezterm.action_callback(function() - -- history.show_command_history() - -- end), - -- }, - + -- Rename workspaces { - key = "]", - mods = "LEADER", - action = act.SpawnCommandInNewTab({ - args = { "wzp" }, + key = "r", + mods = "CTRL|SHIFT", + action = act.PromptInputLine({ + description = wezterm.format({ + { Attribute = { Intensity = "Bold" } }, + { Foreground = { AnsiColor = "Fuchsia" } }, + { Text = "Enter name for new workspace" }, + }), + action = wezterm.action_callback(function(window, pane, line) + -- line will be `nil` if they hit escape without entering anything + -- An empty string if they just hit enter + -- Or the actual line of text they wrote + if line then + window:perform_action( + act.SwitchToWorkspace({ + name = line, + }), + pane + ) + end + end), }), }, @@ -310,65 +321,71 @@ keys = { flags = "FUZZY|WORKSPACES", }), }, -} + { key = "w", mods = "LEADER", action = act.ShowTabNavigator }, + + -- Activate Copy Mode + { key = "[", mods = "LEADER", action = act.ActivateCopyMode }, + -- Paste from Copy Mode + { key = "y", mods = "LEADER", action = act.PasteFrom("PrimarySelection") }, +} key_tables = { copy_mode = { - { key = "c", mods = "CTRL", action = act.CopyMode("Close") }, - { key = "q", mods = "NONE", action = act.CopyMode("Close") }, - { key = "Escape", mods = "NONE", action = act.CopyMode("Close") }, + { key = "c", mods = "CTRL", action = act.CopyMode("Close") }, + { key = "q", mods = "NONE", action = act.CopyMode("Close") }, + { key = "Escape", mods = "NONE", action = act.CopyMode("Close") }, - { key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") }, - { key = "j", mods = "NONE", action = act.CopyMode("MoveDown") }, - { key = "k", mods = "NONE", action = act.CopyMode("MoveUp") }, - { key = "l", mods = "NONE", action = act.CopyMode("MoveRight") }, + { key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") }, + { key = "j", mods = "NONE", action = act.CopyMode("MoveDown") }, + { key = "k", mods = "NONE", action = act.CopyMode("MoveUp") }, + { key = "l", mods = "NONE", action = act.CopyMode("MoveRight") }, - { key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") }, - { key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") }, - { key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") }, - { key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") }, + { key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") }, + { key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") }, + { key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") }, + { key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") }, - { key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, - { key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, - { key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, + { key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, + { key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, + { key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, - { key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, - { key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, - { key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") }, + { key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, + { key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, + { key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") }, - { key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, - { key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") }, + { key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, + { key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") }, - { key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, - { key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") }, - { key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") }, - { key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") }, + { key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, + { key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") }, + { key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") }, + { key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") }, - { key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, - { key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) }, + { key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, + { key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) }, + { key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) }, + { key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) }, - { key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") }, - { key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") }, - { key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") }, + { key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") }, + { key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") }, + { key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") }, - { key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") }, - { key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") }, - { key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") }, - { key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") }, - { key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") }, - { key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") }, + { key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") }, + { key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") }, + { key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") }, + { key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") }, + { key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") }, + { key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") }, - { key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") }, - { key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, - { key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, + { key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") }, + { key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, + { key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, - { key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") }, - { key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") }, + { key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") }, + { key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") }, - { key = "b", mods = "CTRL", action = act.CopyMode("PageUp") }, - { key = "f", mods = "CTRL", action = act.CopyMode("PageDown") }, + { key = "b", mods = "CTRL", action = act.CopyMode("PageUp") }, + { key = "f", mods = "CTRL", action = act.CopyMode("PageDown") }, -- Enter y to copy and quit the copy mode. { @@ -392,12 +409,12 @@ key_tables = { { key = "Escape", mods = "NONE", action = act({ CopyMode = "Close" }) }, -- Go back to copy mode when pressing enter, so that we can use unmodified keys like "n" -- to navigate search results without conflicting with typing into the search area. - { key = "Enter", mods = "NONE", action = "ActivateCopyMode" }, - { key = "c", mods = "CTRL", action = "ActivateCopyMode" }, - { key = "n", mods = "CTRL", action = act({ CopyMode = "NextMatch" }) }, - { key = "p", mods = "CTRL", action = act({ CopyMode = "PriorMatch" }) }, - { key = "r", mods = "CTRL", action = act.CopyMode("CycleMatchType") }, - { key = "u", mods = "CTRL", action = act.CopyMode("ClearPattern") }, + { key = "Enter", mods = "NONE", action = "ActivateCopyMode" }, + { key = "c", mods = "CTRL", action = "ActivateCopyMode" }, + { key = "n", mods = "CTRL", action = act({ CopyMode = "NextMatch" }) }, + { key = "p", mods = "CTRL", action = act({ CopyMode = "PriorMatch" }) }, + { key = "r", mods = "CTRL", action = act.CopyMode("CycleMatchType") }, + { key = "u", mods = "CTRL", action = act.CopyMode("ClearPattern") }, }, } @@ -409,17 +426,39 @@ key_tables = { config.keys = keys config.key_tables = key_tables -wezterm.on("window-config-reload", function() - -- Set up the meeting notifier to check every 60 seconds - -- meeting_notifier.setup_update_timer(15) - meeting_notifier.test_meeting_notifier() -end) +-- wezterm.on("window-config-reload", function() +-- -- Set up the meeting notifier to check every 60 seconds +-- -- meeting_notifier.setup_update_timer(15) +-- meeting_notifier.test_meeting_notifier() +-- end) -wezterm.on("mux-is-process-stateful", function(proc) - _ = proc +wezterm.on("mux-is-process-stateful", function(_) return nil end) +-- wezterm.on("user-var-changed", function(window, pane, name, value) +-- local overrides = window:get_config_overrides() or {} +-- if name == "ZEN_MODE" then +-- local incremental = value:find("+") +-- local number_value = tonumber(value) +-- if incremental ~= nil then +-- while number_value > 0 do +-- window:perform_action(wezterm.action.IncreaseFontSize, pane) +-- number_value = number_value - 1 +-- end +-- overrides.enable_tab_bar = false +-- elseif number_value < 0 then +-- window:perform_action(wezterm.action.ResetFontSize, pane) +-- overrides.font_size = nil +-- overrides.enable_tab_bar = true +-- else +-- overrides.font_size = number_value +-- overrides.enable_tab_bar = false +-- end +-- end +-- window:set_config_overrides(overrides) +-- end) + -- wezterm.on("format-tab-title", function(tab) -- local pane = tab.active_pane -- local title = pane.title @@ -451,4 +490,3 @@ end) -- end) return config - diff --git a/yabai/.config/yabai/yabairc b/yabai/.config/yabai/yabairc index 4697575..e45cbb9 100755 --- a/yabai/.config/yabai/yabairc +++ b/yabai/.config/yabai/yabairc @@ -8,14 +8,18 @@ yabai -m config window_placement second_child yabai -m config window_opacity off yabai -m config window_opacity_duration 0.0 yabai -m config window_shadow off + # Uncomment the following line to disable window borders # yabai -m config window_border off # yabai -m config window_border_width 2 +# window management settings yabai -m config active_window_opacity 1.0 yabai -m config normal_window_opacity 0.75 yabai -m config split_ratio 0.65 yabai -m config auto_balance on + +# Mouse settings yabai -m config mouse_modifier fn yabai -m config mouse_action1 move yabai -m config mouse_action2 resize @@ -27,4 +31,3 @@ yabai -m config bottom_padding 50 yabai -m config left_padding 5 yabai -m config right_padding 5 yabai -m config window_gap 3 - diff --git a/zsh/.zprofile b/zsh/.zprofile index 9ea393a..0e15fcf 100755 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,9 +1,3 @@ -# Ensure XDG_CONFIG_HOME is set -: "${XDG_CONFIG_HOME:=$HOME/.config}" - -# Set default pager -export PAGER="less -i -N -S -R" - # Determine architecture and set brew paths if [[ "$(uname -m)" == "arm64" ]]; then # ARM-based Mac (Apple Silicon) @@ -13,18 +7,9 @@ else HOMEBREW_PREFIX="/usr/local" fi -# Ensure PYENV_ROOT is set and its bin directory is in PATH -if [[ -n "$PYENV_ROOT" && ! "$PATH" =~ (^|:)${PYENV_ROOT}/bin(:|$) ]]; then - export PATH="$PYENV_ROOT/bin:$PATH" -fi - -if command -v pyenv >/dev/null 2>&1; then - eval "$(pyenv init -)" -fi - -# Add ~/.local/bin to PATH if it exists -if [[ -d "$HOME/.local/bin" && ! "$PATH" =~ (^|:)${HOME}/.local/bin(:|$) ]]; then - export PATH="$HOME/.local/bin:$PATH" +# Conditionally set the editor based on whether you're using SSH +if [[ -n $SSH_CONNECTION ]]; then + export EDITOR='vim' fi # Read fzf theme options if the file exists @@ -40,27 +25,12 @@ fi [ -f ~/.fzf.zsh ] && . ~/.fzf.zsh -# Add RVM to PATH -if [[ -d "$HOME/.rvm/bin" && ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then - export PATH="$PATH:$HOME/.rvm/bin" +# Initialize pyenv +if command -v pyenv >/dev/null 2>&1; then + eval "$(pyenv init -)" fi -# Add Node to PATH -if command -v node &> /dev/null; then - export PATH="$PATH:$(npm bin)" -fi - -# Add Golang to PATH -if command -v go &> /dev/null; then - # Set GOPATH and add Go binaries to PATH - export GOPATH="${GOPATH:-$HOME/Documents/projects:$HOME/.go}" - if [[ ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then - export PATH="$PATH:$(go env GOPATH)/bin" - fi -fi - -# Cargo setup -if [[ -d "$HOME/.cargo/bin" && ! "$PATH" =~ (^|:)${HOME}/.cargo/bin(:|$) ]]; then - export PATH="$HOME/.cargo/bin:$PATH" +if ! command -v nvm >/dev/null 2>&1; then + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh 2>&1 | bash >/dev/null 2>&1 fi diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100755 index 0000000..f0c788c --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,84 @@ +# Ensure XDG_CONFIG_HOME is set +: "${XDG_CONFIG_HOME:=$HOME/.config}" + +# Set default pager and editor globally +export PAGER="less -i -N -S -R" +export EDITOR="nvim" +export BROWSER="firefox" + +# Set platform-specific Homebrew paths +if [[ "$(uname -m)" == "arm64" ]]; then + # ARM Apple Silicon + HOMEBREW_PREFIX="/opt/homebrew" +else + # Intel + HOMEBREW_PREFIX="/usr/local" +fi + +# Ensure Homebrew bin/sbin are in the PATH +if [[ -d "$HOMEBREW_PREFIX" && ! "$PATH" =~ (^|:)${HOMEBREW_PREFIX}/bin(:|$) ]]; then + export PATH="${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:$PATH" +fi + +# Ensure PYENV_ROOT is set and its bin directory is in PATH +if [[ -n "$PYENV_ROOT" && ! "$PATH" =~ (^|:)${PYENV_ROOT}/bin(:|$) ]]; then + export PATH="$PYENV_ROOT/bin:$PATH" +fi + +export MODULAR_HOME="/Users/$(whoami)/.modular" +export PATH="/Users/$(whoami)/.modular/pkg/packages.modular.com_mojo:$PATH" + +# Add ~/.local/bin to PATH if it exists +if [[ -d "$HOME/.local/bin" && ! "$PATH" =~ (^|:)${HOME}/.local/bin(:|$) ]]; then + export PATH="$HOME/.local/bin:$PATH" +fi + +# Add RVM to PATH if it exists +if [[ -d "$HOME/.rvm/bin" && ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then + export PATH="$PATH:$HOME/.rvm/bin" +fi + +# Add Go binaries to PATH if Go is installed +if command -v go &> /dev/null; then + # Set GOPATH and add Go binaries to PATH + export GOPATH="${GOPATH:-$HOME/.go}" + if [[ ! "$PATH" =~ (^|:)${GOPATH}/bin(:|$) ]]; then + export PATH="$PATH:${GOPATH}/bin" + fi +fi + +# Add Cargo (Rust) binaries to PATH if they exist +if [[ -d "$HOME/.cargo/bin" && ! "$PATH" =~ (^|:)${HOME}/.cargo/bin(:|$) ]]; then + export PATH="$HOME/.cargo/bin:$PATH" +fi + +# nvm setup (Node Version Manager) +if [[ -d "$HOME/.nvm" && ! "$PATH" =~ (^|:)${HOME}/.nvm(:|$) ]]; then + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # Load nvm + [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # nvm bash completion +fi + +# Add macOS-specific command-line utilities (GNU coreutils) to PATH if installed via Homebrew +if [[ -d "${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin" && ! "$PATH" =~ (^|:)${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin(:|$) ]]; then + export PATH="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin:$PATH" +fi + +# Add directories to PATH if they exist and are not already present +dirs=("${HOMEBREW_PREFIX}/bin" "${HOMEBREW_PREFIX}/sbin" "/usr/local/bin" "/usr/local/sbin") +for dir in "${dirs[@]}"; do + if [[ -d "$dir" && ! "$PATH" =~ (^|:)$dir(:|$) ]]; then + export PATH="$dir:$PATH" + fi +done + +# Ensure /usr/local/opt/openssl@1.1/bin is in the PATH if installed +if [[ -d "/usr/local/opt/openssl@1.1/bin" && ! "$PATH" =~ (^|:)/usr/local/opt/openssl@1.1/bin(:|$) ]]; then + export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" +fi + +# Ensure /usr/local/opt/llvm/bin is in the PATH if installed +if [[ -d "/usr/local/opt/llvm/bin" && ! "$PATH" =~ (^|:)/usr/local/opt/llvm/bin(:|$) ]]; then + export PATH="/usr/local/opt/llvm/bin:$PATH" +fi + diff --git a/zsh/.zshrc b/zsh/.zshrc index 783aca2..811b8ed 100755 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -6,24 +6,6 @@ # export ZSH_CUSTOM="$HOME/.oh-my-zsh/custom" # export UPDATE_ZSH_DAYS=1 -# Ensure /opt/homebrew is in the PATH if it exists -if [[ -d /opt/homebrew && ! "$PATH" =~ (^|:)/opt/homebrew/(bin|sbin)($|:) ]]; then - export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" -fi - -# Add macOS specific command-line utilities -if [[ -d /usr/local/opt/coreutils/libexec/gnubin && ! "$PATH" =~ (^|:)/usr/local/opt/coreutils/libexec/gnubin(:|$) ]]; then - export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" -fi - -# Add /usr/local/bin and /usr/local/sbin to PATH if they are not already present -dirs=("/usr/local/bin" "/usr/local/sbin") -for dir in "${dirs[@]}"; do - if [[ -d $dir && ! "$PATH" =~ (^|:)$dir(:|$) ]]; then - export PATH="$dir:$PATH" - fi -done - # Disable auto title DISABLE_AUTO_TITLE="true" @@ -48,7 +30,11 @@ DISABLE_AUTO_TITLE="true" # autoload -Uz add-zsh-hook # # Load zsh completions -# autoload -Uz compinit && compinit -C +autoload -Uz compinit + +# Fix: Ensure correct completion directory for Apple Silicon +fpath=(/opt/homebrew/share/zsh/site-functions $fpath) +compinit # Plugins to load # plugins=( @@ -69,22 +55,30 @@ DISABLE_AUTO_TITLE="true" # Source oh-my-zsh.sh # . $ZSH/oh-my-zsh.sh -# Load zinit +# Load Zinit ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" -[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)" -[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" -. "${ZINIT_HOME}/zinit.zsh" +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname "$ZINIT_HOME")" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi +source "${ZINIT_HOME}/zinit.zsh" # Ensure compinit is loaded after zinit autoload -Uz _zinit (( ${+_comps} )) && _comps[zinit]=_zinit # Load plugins with zinit -zinit light zsh-users/zsh-syntax-highlighting -zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-history-substring-search +# Lazy load zsh-syntax-highlighting +zinit ice wait lucid atinit"ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)" +zinit load zsh-users/zsh-syntax-highlighting + +# Load async auto-suggestions +zinit ice wait lucid atload"zle-line-init() { zle autosuggest-enable }; zle -N zle-line-init" +zinit load zsh-users/zsh-autosuggestions + # zoxide zinit ice from"gh-r" as"program" pick"bin/zoxide" zinit load ajeetdsouza/zoxide @@ -92,12 +86,6 @@ zinit load ajeetdsouza/zoxide # Load eza completions if needed [[ ! "$FPATH" =~ (^|:)${HOME}/.local/bin/eza/completions/zsh(:|$) ]] && export FPATH="$HOME/.local/bin/eza/completions/zsh:$FPATH" -# Initialize pyenv -if command -v pyenv 1>/dev/null 2>&1; then - export PATH="$HOME/.pyenv/bin:$PATH" - eval "$(pyenv init -)" -fi - # Initialize direnv eval "$(direnv hook zsh)" @@ -108,20 +96,18 @@ eval "$(zoxide init --cmd cd zsh)" eval "$(starship init zsh)" export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml" -# Contents within this block are managed by 'conda init' -CONDA_PATHS=("/usr/local/Caskroom/miniforge/base" "/opt/homebrew/Caskroom/miniforge/base") +# ----------------- Conda & Mamba Setup ----------------- +# Conda paths where Miniforge is installed (for Apple Silicon) +CONDA_PATHS=("/opt/homebrew/Caskroom/miniforge/base" "/usr/local/Caskroom/miniforge/base") for CONDA_PATH in "${CONDA_PATHS[@]}"; do if [ -d "$CONDA_PATH" ]; then - __conda_setup="$('$CONDA_PATH/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" - if [ $? -eq 0 ]; then - eval "$__conda_setup" + # Manually set up Conda if available + if [ -f "$CONDA_PATH/etc/profile.d/conda.sh" ]; then + . "$CONDA_PATH/etc/profile.d/conda.sh" else - if [ -f "$CONDA_PATH/etc/profile.d/conda.sh" ]; then - . "$CONDA_PATH/etc/profile.d/conda.sh" - else - export PATH="$CONDA_PATH/bin:$PATH" - fi + # Fall back to adding Conda's bin directory to PATH if the profile.d script isn't found + export PATH="$CONDA_PATH/bin:$PATH" fi # Initialize Mamba if available @@ -129,18 +115,14 @@ for CONDA_PATH in "${CONDA_PATHS[@]}"; do . "$CONDA_PATH/etc/profile.d/mamba.sh" fi + # Break after initializing the first found Conda path break fi done -unset __conda_setup - -# Set default editor -if [[ -n $SSH_CONNECTION ]]; then - export EDITOR='vim' -else - export EDITOR='nvim' -fi +# ----------------- Skip Conda Init ----------------- +# Prevent 'conda init' from running again to avoid resetting setup +# conda init "$(basename "${SHELL}")" >/dev/null 2>&1 # Compilation flags # export ARCHFLAGS="-arch x86_64 -arch arm64"