diff --git a/dot_config/nvim/lazy-lock.json b/dot_config/nvim/lazy-lock.json index 6d35c8f..ca09282 100644 --- a/dot_config/nvim/lazy-lock.json +++ b/dot_config/nvim/lazy-lock.json @@ -18,7 +18,9 @@ "feline.nvim": { "branch": "master", "commit": "d48b6f92c6ccdd6654c956f437be49ea160b5b0c" }, "friendly-snippets": { "branch": "main", "commit": "1645e7cd98ed99e766c84ab3cf13a1612c77dcee" }, "gitsigns.nvim": { "branch": "main", "commit": "a5caac26768af80b7c57b919f77b3fed3d7424d0" }, - "haskell-tools.nvim": { "branch": "master", "commit": "9af20e99b32a4697946a1288e0c393d69e453581" }, + "go.nvim": { "branch": "master", "commit": "37d226ca7444a3950a133acc205aaba7a2339f69" }, + "guihua.lua": { "branch": "master", "commit": "d331b1526a87edbe13679298c3547d49f8a14ffc" }, + "haskell-tools.nvim": { "branch": "1.x.x", "commit": "66e78bb7184a992c25669c46e6b9af39623bb739" }, "lazy.nvim": { "branch": "main", "commit": "c778b7aa04c484e1536ba219e71f2fd0f05302aa" }, "lsp_signature.nvim": { "branch": "master", "commit": "6f6252f63b0baf0f2224c4caea33819a27f3f550" }, "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua index f8b2182..aa2bc01 100644 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -82,30 +82,6 @@ return { require("py_lsp").setup(lsp.default_config) end, - ["hls"] = function() - local ht = require("haskell-tools") - local def_opts = { noremap = true, silent = true } - ht.setup({ - hls = { - on_attach = function(client, bufnr) - local opts = vim.tbl_extend("keep", def_opts, { buffer = bufnr }) - -- haskell-language-server relies heavily on codeLenses, - -- so auto-refresh (see advanced configuration) is enabled by default - -- vim.keymap.set("n", "ca", vim.lsp.codelens.run, opts) - -- vim.keymap.set("n", "hs", ht.hoogle.hoogle_signature, opts) - end, - }, - }) - -- Suggested keymaps that do not depend on haskell-language-server - -- Toggle a GHCi repl for the current package - -- vim.keymap.set("n", "rr", ht.repl.toggle, def_opts) - -- Toggle a GHCi repl for the current buffer - -- vim.keymap.set("n", "rf", function() - -- ht.repl.toggle(vim.api.nvim_buf_get_name(0)) - -- end, def_opts) - -- vim.keymap.set("n", "rq", ht.repl.quit, def_opts) - end, - ["lua_ls"] = function() require("lspconfig")["lua_ls"].setup(custom_config({ settings = { @@ -136,7 +112,39 @@ return { }, }, "simrat39/rust-tools.nvim", - "mrcjkb/haskell-tools.nvim", + { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("go").setup() + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + }, + { + "mrcjkb/haskell-tools.nvim", + branch = "1.x.x", + config = function() + local ht = require("haskell-tools") + local def_opts = { noremap = true, silent = true } + + ht.setup({ + hls = { + on_attach = function(client, bufnr) + local opts = vim.tbl_extend("keep", def_opts, { buffer = bufnr }) + -- haskell-language-server relies heavily on codeLenses, + -- so auto-refresh (see advanced configuration) is enabled by default + vim.keymap.set("n", "ca", vim.lsp.codelens.run, opts) + vim.keymap.set("n", "le", ht.lsp.buf_eval_all, opts) + end, + }, + }) + end, + }, "HallerPatrick/py_lsp.nvim", "mfussenegger/nvim-jdtls", { diff --git a/dot_config/starship.toml b/dot_config/starship.toml index 5d8652e..b3b3657 100644 --- a/dot_config/starship.toml +++ b/dot_config/starship.toml @@ -8,7 +8,6 @@ $hostname\ $localip\ $shlvl\ $singularity\ -$kubernetes\ $directory\ $vcsh\ $git_branch\ @@ -57,6 +56,7 @@ $vagrant\ $zig\ $buf\ $nix_shell\ +$kubernetes\ $conda\ $meson\ $spack\ @@ -71,7 +71,6 @@ $custom\ $sudo\ $cmd_duration\ $line_break\ -$jobs\ $time\ $status\ $container\ @@ -94,6 +93,10 @@ success_symbol = "[\\$](bold green)" # The "success_symbol" segment is being set error_symbol = "[\\$](bold red)" # The "success_symbol" segment is being set to "➜" with the color "bold green" vimcmd_symbol = "[\\$](bold green)" +[hostname] +style = "#74c7ec bold" +ssh_symbol = "🐴 " + [aws] style = "#74c7ec bold" symbol = " " @@ -203,3 +206,9 @@ symbol = " " [spack] style = "#74c7ec bold" + +[kubernetes] +style = "#74c7ec bold" +symbol = '󱃾 ' +format = '[ $symbol($cluster/$namespace) ]($style)' +disabled = false diff --git a/dot_config/wezterm/wezterm.lua b/dot_config/wezterm/wezterm.lua index dbda5b2..a7334b9 100644 --- a/dot_config/wezterm/wezterm.lua +++ b/dot_config/wezterm/wezterm.lua @@ -1,6 +1,7 @@ local wezterm = require("wezterm") local act = wezterm.action local wsl_domains = wezterm.default_wsl_domains() +local c = wezterm.config_builder() -- WSL related for _, dom in ipairs(wsl_domains) do @@ -23,228 +24,116 @@ if get_os() == "windows" then default_domain = "WSL:Ubuntu-20.04" end --- Superscript/Subscript -local function numberStyle(number, script) - local scripts = { - superscript = { - "⁰", - "¹", - "²", - "³", - "⁴", - "⁵", - "⁶", - "⁷", - "⁸", - "⁹", - }, - subscript = { - "₀", - "₁", - "₂", - "₃", - "₄", - "₅", - "₆", - "₇", - "₈", - "₉", - }, - } - local numbers = scripts[script] - local number_string = tostring(number) - local result = "" - for i = 1, #number_string do - local char = number_string:sub(i, i) - local num = tonumber(char) - if num then - result = result .. numbers[num + 1] - else - result = result .. char - end - end - return result -end - --- Custom Tab Bar -wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width) - local RIGHT_DIVIDER = utf8.char(0xe0bc) - local colours = config.resolved_palette.tab_bar - - local active_tab_index = 0 - for _, t in ipairs(tabs) do - if t.is_active == true then - active_tab_index = t.tab_index - end - end - - local active_bg = colours.active_tab.bg_color - local active_fg = colours.active_tab.fg_color - local inactive_bg = colours.inactive_tab.bg_color - local inactive_fg = colours.inactive_tab.fg_color - local new_tab_bg = colours.new_tab.bg_color - - local s_bg, s_fg, e_bg, e_fg - - -- the last tab - if tab.tab_index == #tabs - 1 then - if tab.is_active then - s_bg = active_bg - s_fg = active_fg - e_bg = new_tab_bg - e_fg = active_bg - else - s_bg = inactive_bg - s_fg = inactive_fg - e_bg = new_tab_bg - e_fg = inactive_bg - end - elseif tab.tab_index == active_tab_index - 1 then - s_bg = inactive_bg - s_fg = inactive_fg - e_bg = active_bg - e_fg = inactive_bg - elseif tab.is_active then - s_bg = active_bg - s_fg = active_fg - e_bg = inactive_bg - e_fg = active_bg - else - s_bg = inactive_bg - s_fg = inactive_fg - e_bg = inactive_bg - e_fg = inactive_bg - end +c.set_environment_variables = { + ZVM_TERM = "xterm-256color", +} - local muxpanes = wezterm.mux.get_tab(tab.tab_id):panes() - local count = #muxpanes == 1 and "" or #muxpanes - - return { - { Background = { Color = s_bg } }, - { Foreground = { Color = s_fg } }, - { - Text = " " .. tab.tab_index + 1 .. ": " .. tab.active_pane.title .. numberStyle(count, "superscript") .. " ", - }, - { Background = { Color = e_bg } }, - { Foreground = { Color = e_fg } }, - { Text = RIGHT_DIVIDER }, - } -end) +c.term = "wezterm" +c.font = wezterm.font_with_fallback({ "VictorMono Nerd Font" }) +c.font_size = 13 +c.background = { + { + source = { File = "Pictures/astronaut.png" }, + hsb = { brightness = 0.07, hue = 1.0, saturation = 0.1 }, + }, +} -return { - set_environment_variables = { - ZVM_TERM = "xterm-256color" +c.default_domain = default_domain +c.wsl_domains = wsl_domains +c.default_prog = default_prog + +c.window_padding = { top = 0, bottom = 0, left = 0, right = 0 } +c.adjust_window_size_when_changing_font_size = false +c.window_decorations = "RESIZE" +c.window_close_confirmation = "NeverPrompt" + +c.use_fancy_tab_bar = false +c.tab_bar_at_bottom = true +c.hide_tab_bar_if_only_one_tab = true +c.tab_max_width = 32 +c.scrollback_lines = 1000000 + +c.exit_behavior = "CloseOnCleanExit" +c.clean_exit_codes = { 130 } +c.audible_bell = "Disabled" +c.disable_default_key_bindings = false + +c.mouse_bindings = { + -- Ctrl-click will open the link under the mouse cursor + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = wezterm.action.OpenLinkAtMouseCursor, }, - term = "wezterm", - color_scheme = "Catppuccin Mocha", - font = wezterm.font_with_fallback({ "VictorMono Nerd Font" }), - font_size = 13, - background = { - { - source = { File = "Pictures/astronaut.png" }, - hsb = { brightness = 0.07, hue = 1.0, saturation = 0.1 }, - }, +} +c.keys = { + -- Fullscreen + { key = "F11", action = wezterm.action.ToggleFullScreen }, + -- Zoom + { key = "z", mods = "ALT|SHIFT", action = wezterm.action.TogglePaneZoomState }, + -- Copy / Paste + { key = "c", mods = "ALT|SHIFT", action = wezterm.action.CopyTo("Clipboard") }, + { key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("Clipboard") }, + + -- CMD Palette + { key = "p", mods = "ALT|SHIFT", action = act.ActivateCommandPalette }, + + -- Navigating Panes + { key = "h", mods = "ALT|SHIFT", action = act.ActivateTabRelative(-1) }, + { key = "l", mods = "ALT|SHIFT", action = act.ActivateTabRelative(1) }, + -- Close Pane + { key = "d", mods = "ALT|SHIFT", action = act.CloseCurrentTab({ confirm = false }) }, + -- Swap Panes + { key = "i", mods = "ALT|SHIFT", action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "Activate" }) }, + { + key = "s", + mods = "ALT|SHIFT", + action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "SwapWithActive" }), }, - - default_domain = default_domain, - wsl_domains = wsl_domains, - default_prog = default_prog, - - window_padding = { top = 0, bottom = 0, left = 0, right = 0 }, - adjust_window_size_when_changing_font_size = false, - window_decorations = "RESIZE", - window_close_confirmation = "NeverPrompt", - - use_fancy_tab_bar = false, - tab_bar_at_bottom = true, - hide_tab_bar_if_only_one_tab = true, - tab_max_width = 32, - scrollback_lines = 1000000, - - exit_behavior = "CloseOnCleanExit", - clean_exit_codes = { 130 }, - audible_bell = "Disabled", - disable_default_key_bindings = false, - - keys = { - -- Fullscreen - { key = "F11", action = wezterm.action.ToggleFullScreen }, - -- Zoom - { key = "z", mods = "ALT|SHIFT", action = wezterm.action.TogglePaneZoomState }, - -- Copy / Paste - { key = "C", mods = "CTRL", action = wezterm.action.CopyTo("Clipboard") }, - { key = "V", mods = "CTRL", action = act.PasteFrom("Clipboard") }, - - -- Open Pane - -- https://github.com/wez/wezterm/discussions/2426 - -- https://github.com/neovim/neovim/issues/2252 - { - key = "n", - mods = "ALT|SHIFT", + -- Resize Panes + { key = "LeftArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Left", 5 } }) }, + { key = "DownArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Down", 5 } }) }, + { key = "UpArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Up", 5 } }) }, + { key = "RightArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Right", 5 } }) }, + + -- New Tab + { key = "n", mods = "ALT|SHIFT", action = act({ SpawnTab = "CurrentPaneDomain" }) }, + + -- Open Links Via Keyboard + { + key = "o", + mods = "ALT|SHIFT", + action = wezterm.action.QuickSelectArgs({ + label = "open url", + patterns = { + "https?://\\S+", + }, action = wezterm.action_callback(function(window, pane) - if pane:get_title() == "nvim" then - window:perform_action(act.SendKey({ key = "n", mods = "ALT|SHIFT" }), pane) - else - window:perform_action(act.SplitPane({ direction = "Right", size = { Percent = 50 } }), pane) - end + local url = window:get_selection_text_for_pane(pane) + wezterm.open_with(url) end), - }, - { - key = "m", - mods = "ALT|SHIFT", - action = wezterm.action_callback(function(window, pane) - if pane:get_title() == "nvim" then - window:perform_action(act.SendKey({ key = "m", mods = "ALT|SHIFT" }), pane) - else - window:perform_action(act.SplitPane({ direction = "Down", size = { Percent = 50 } }), pane) - end - end), - }, - - -- Navigating Panes - { key = "h", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Left") }, - { key = "l", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Right") }, - { key = "k", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Up") }, - { key = "j", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Down") }, - -- Close Pane - { key = "c", mods = "ALT|SHIFT", action = wezterm.action.CloseCurrentPane({ confirm = false }) }, - -- Swap Panes - { key = "i", mods = "ALT|SHIFT", action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "Activate" }) }, - { - key = "s", - mods = "ALT|SHIFT", - action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "SwapWithActive" }), - }, - -- Resize Panes - { key = "LeftArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Left", 5 } }) }, - { key = "DownArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Down", 5 } }) }, - { key = "UpArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Up", 5 } }) }, - { key = "RightArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Right", 5 } }) }, - - -- New Tab - { key = "n", mods = "CTRL|SHIFT", action = act({ SpawnTab = "CurrentPaneDomain" }) }, - -- Swap Tabs - { key = "h", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(-1) }, - { key = "l", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(1) }, - - -- Open Links - { - key = "o", - mods = "ALT|SHIFT", - action = wezterm.action.QuickSelectArgs({ - label = "open url", - patterns = { - "https?://\\S+", - }, - action = wezterm.action_callback(function(window, pane) - local url = window:get_selection_text_for_pane(pane) - wezterm.open_with(url) - end), - }), - }, - - -- ScrollBack To Prompt - { key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(-1) }, - { key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(1) }, + }), }, + + -- ScrollBack To Prompt + { key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(-1) }, + { key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(1) }, } + +wezterm.plugin.require("https://github.com/catppuccin/wezterm").apply_to_config(c, { + flavor = "mocha", + sync = wezterm.target_triple:find("darwin") ~= nil, + sync_flavors = { light = "latte", dark = "mocha" }, +}) +wezterm.plugin.require("https://github.com/nekowinston/wezterm-bar").apply_to_config(c, { + indicator = { + leader = { enabled = false }, + }, +}) + +wezterm.on("update-status", function(window, pane) + -- local colours = conf.resolved_palette.tab_bar + wezterm.log_info(window:effective_config()) +end) + +return c diff --git a/dot_zshenv b/dot_zshenv index 0200650..2b530a7 100644 --- a/dot_zshenv +++ b/dot_zshenv @@ -1,8 +1,19 @@ +# Needed for .antidote +# https://github.com/mattmc3/antidote/issues/24 +autoload -Uz compinit && compinit + +# I don't even know anymore... +# https://github.com/ohmyzsh/ohmyzsh/issues/10581 +source <(kubectl completion zsh) + # PATH export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/.local/scripts" export PATH="$PATH:$HOME/.local/share/nvim/mason/bin" +# Krew +export PATH="$PATH:${KREW_ROOT:-$HOME/.krew}/bin" + # JetBrains Toolbox export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" diff --git a/dot_zshrc b/dot_zshrc index 50a3727..338f5b1 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -6,34 +6,34 @@ source "$HOME/.config/wezterm/wezterm.sh" # Prompt eval "$(starship init zsh)" -# Plugins - Antigen -ADOTDIR="$HOME/.local/share/antigen" -if [[ ! -d "$ADOTDIR" ]]; then - mkdir -p "$ADOTDIR" - curl -L https://git.io/antigen > "$ADOTDIR/antigen.zsh" - chmod +x "$ADOTDIR" -fi +# source antidote +source ${ZDOTDIR:-~}/.antidote/antidote.zsh -# Load Antigen -source "$ADOTDIR/antigen.zsh" -antigen use oh-my-zsh -antigen bundle colored-man-pages -antigen bundle colorize -antigen bundle command-not-found -antigen bundle git -antigen bundle jeffreytse/zsh-vi-mode -antigen bundle zsh-users/zsh-autosuggestions -antigen bundle zsh-users/zsh-completions -antigen bundle zsh-users/zsh-syntax-highlighting +# set omz variables +ZSH=$(antidote path ohmyzsh/ohmyzsh) +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh" +[[ -d $ZSH_CACHE_DIR ]] || mkdir -p $ZSH_CACHE_DIR -antigen apply +# initialize plugins statically with ${ZDOTDIR:-~}/.zsh_plugins.txt +antidote load # Make 'less' friendlier for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" +# Konf +# source <(konf-go shellwrapper zsh) +# Autocompletion +# source <(konf completion zsh) +# Auto load context +# export KUBECONFIG=$(konf set -) + # Aliases alias magit="nvim '+Neogit kind=replace'" alias clipboard='xclip -sel clip' +alias dc="docker compose" +alias dcud="docker compose down && docker compose up -d" +alias kctx="konf set" +alias kns="konf ns" # Keep History export HISTFILE="$HOME/.zhistory" @@ -60,6 +60,22 @@ function mkcd() { mkdir -p $@ && cd ${@:$#} } +# Use 'wezterm ssh' if available +function ssh() { + if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then + bj wezterm ssh $@ + else + echo "Falling back to normal 'ssh' as WezTerm hasn't been detected" + command ssh $@ + fi +} + +# Easily run background jobs +function bj() { + nohup $@ /dev/null & +} + + # Display images in the terminal function icat() { function display() { @@ -119,6 +135,8 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +eval "$(direnv hook zsh)" + #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"