From 0e3b5b928f186bd080b5f61ba4c70e08a4c21b27 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 23 Aug 2024 14:15:51 +0100 Subject: [PATCH 1/8] Simplify prompt Massively helped out by this article: https://sureshjoshi.com/development/zsh-prompts-that-dont-suck --- zshrc.zsh | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/zshrc.zsh b/zshrc.zsh index 7ba0e12..dbd344a 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -119,10 +119,33 @@ export BAT_THEME=$batTheme # Source the untracked `extra` file test -e $HOME/.extra && source $HOME/.extra -# Oh My Posh -if (( ${+commands[oh-my-posh]} )); then - eval "$(oh-my-posh init zsh --config $HOME/.config/jmb.omp.toml)" -fi +# Set the prompt +# We need zsh git integration +# Autoload zsh's `add-zsh-hook` and `vcs_info` functions +# (-U autoload w/o substition, -z use zsh style) +autoload -Uz add-zsh-hook vcs_info + +# Set prompt substitution so we can use the vcs_info_message variable +setopt prompt_subst + +# Run the `vcs_info` hook to grab git info before displaying the prompt +add-zsh-hook precmd vcs_info + +# Style the vcs_info message +zstyle ':vcs_info:*' enable git +zstyle ':vcs_info:git*' formats '%b%u%c' +# Format when the repo is in an action (merge, rebase, etc) +zstyle ':vcs_info:git*' actionformats '%F{14}⏱ %*%f' +zstyle ':vcs_info:git*' unstagedstr '*' +zstyle ':vcs_info:git*' stagedstr '+' +# This enables %u and %c (unstaged/staged changes) to work, +# but can be slow on large repos +zstyle ':vcs_info:*:*' check-for-changes true + +# Set the right prompt to the vcs_info message +RPROMPT='%F{8}⎇ ${vcs_info_msg_0_}' + +PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f %2~ %(!.#.$) ' # Finally we can have zsh auto source this rc file on command # attribution: https://www.reddit.com/r/commandline/comments/12g76v/ From 8f30fe328dd6c7ae2bf06c5223cf5b7a57bcbd47 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 23 Aug 2024 14:26:53 +0100 Subject: [PATCH 2/8] Make the branch icon only show when there is a branch --- zshrc.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zshrc.zsh b/zshrc.zsh index dbd344a..f32e362 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -133,7 +133,7 @@ add-zsh-hook precmd vcs_info # Style the vcs_info message zstyle ':vcs_info:*' enable git -zstyle ':vcs_info:git*' formats '%b%u%c' +zstyle ':vcs_info:git*' formats '⎇ %b%u%c' # Format when the repo is in an action (merge, rebase, etc) zstyle ':vcs_info:git*' actionformats '%F{14}⏱ %*%f' zstyle ':vcs_info:git*' unstagedstr '*' @@ -143,7 +143,7 @@ zstyle ':vcs_info:git*' stagedstr '+' zstyle ':vcs_info:*:*' check-for-changes true # Set the right prompt to the vcs_info message -RPROMPT='%F{8}⎇ ${vcs_info_msg_0_}' +RPROMPT='%F{8}${vcs_info_msg_0_}' PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f %2~ %(!.#.$) ' From ab55e0c1fc1af41e548678dab6a6c122b737666d Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Thu, 29 Aug 2024 09:37:36 +0100 Subject: [PATCH 3/8] Add symbol to show OS prompt is running on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will mainly be helpful detecting if I’m in an SSH session or not --- zshrc.zsh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/zshrc.zsh b/zshrc.zsh index f32e362..c4c6bad 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -145,7 +145,23 @@ zstyle ':vcs_info:*:*' check-for-changes true # Set the right prompt to the vcs_info message RPROMPT='%F{8}${vcs_info_msg_0_}' -PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f %2~ %(!.#.$) ' +# First set a dot that changes colour on success/fail or previous command +PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f ' +# Show a symbol for the OS +# First we set the os_symbol variable we will use in the prompt +if [[ "$OSTYPE" == "darwin"* ]]; then + os_symbol="" +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + os_symbol="󰣇" +else + os_symbol="" # Fallback symbol if OS is neither macOS nor Linux +fi + +PROMPT+='${os_symbol} ' +# Then show the working directory +PROMPT+='%2~ ' +# Finally we can adjust the prompt to show if we are a user or sudo +PROMPT+='%(!.#.$) ' # Finally we can have zsh auto source this rc file on command # attribution: https://www.reddit.com/r/commandline/comments/12g76v/ From ec0965551802283a783699f64db21ccf023646f3 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 13 Sep 2024 15:15:27 +0100 Subject: [PATCH 4/8] Remove thefuck command --- zsh/plugins/thefuck.plugin.zsh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 zsh/plugins/thefuck.plugin.zsh diff --git a/zsh/plugins/thefuck.plugin.zsh b/zsh/plugins/thefuck.plugin.zsh deleted file mode 100644 index ce9f8e0..0000000 --- a/zsh/plugins/thefuck.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env zsh - -# Init the fuck -if (( ${+commands[thefuck]} )); then - eval "$(thefuck --alias)" -fi From 2164512568e2da8b723bab129a93a1f47614f4a8 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 13 Sep 2024 15:18:36 +0100 Subject: [PATCH 5/8] Improve invocation of Fast Node Manager on shell load --- zsh/plugins/fnm.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/plugins/fnm.plugin.zsh b/zsh/plugins/fnm.plugin.zsh index da0daad..e93876a 100644 --- a/zsh/plugins/fnm.plugin.zsh +++ b/zsh/plugins/fnm.plugin.zsh @@ -2,5 +2,5 @@ # Setup Fast Node Manager if (( ${+commands[fnm]} )); then - eval "$(fnm env --use-on-cd)" + eval "$(fnm env --use-on-cd --shell zsh)" fi From 8a3cdacaaa53356e585e02063b46c5c9ddf9b909 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 20 Sep 2024 21:11:02 +0100 Subject: [PATCH 6/8] Stop loading github copilot --- sheldon.toml | 8 -------- zsh/plugins/github-copilot.plugin.zsh | 10 ---------- 2 files changed, 18 deletions(-) delete mode 100644 zsh/plugins/github-copilot.plugin.zsh diff --git a/sheldon.toml b/sheldon.toml index c131a27..af57878 100644 --- a/sheldon.toml +++ b/sheldon.toml @@ -86,10 +86,6 @@ apply = ["defer"] local = "~/.zsh/plugins" apply = ["defer"] -[plugins.thefuck] -local = "~/.zsh/plugins" -apply = ["defer"] - # This works best if it is placed last. [plugins.compinit] local = "~/.zsh/plugins" @@ -98,10 +94,6 @@ apply = ["defer"] # Plugins that are even more deferred # ----------------------------------- -[plugins.github-copilot] -local = "~/.zsh/plugins" -apply = ["defer-more"] - [plugins.ngrok] local = "~/.zsh/plugins" apply = ["defer-more"] diff --git a/zsh/plugins/github-copilot.plugin.zsh b/zsh/plugins/github-copilot.plugin.zsh deleted file mode 100644 index 677ad77..0000000 --- a/zsh/plugins/github-copilot.plugin.zsh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env zsh - -# Setup GitHub Copilot -# first check we even have the genereic `gh` command -if (( ${+commands[gh]} )); then - # Now check we have the copilot plugin installed with `gh` - if gh extension list | rg copilot -c > /dev/null; then - eval "$(gh copilot alias -- zsh)" - fi -fi From 215442575b148c7abb1677d25c1283606ff974bf Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 20 Sep 2024 21:18:21 +0100 Subject: [PATCH 7/8] Show Loading message in right prompt --- zshrc.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zshrc.zsh b/zshrc.zsh index c4c6bad..a1899df 100644 --- a/zshrc.zsh +++ b/zshrc.zsh @@ -142,8 +142,11 @@ zstyle ':vcs_info:git*' stagedstr '+' # but can be slow on large repos zstyle ':vcs_info:*:*' check-for-changes true -# Set the right prompt to the vcs_info message -RPROMPT='%F{8}${vcs_info_msg_0_}' +# First show the Loading indicator in the right prompt if shell plugins are still loading +RPROMPT='%F{8}$(if [[ -n $SHELL_LOADING ]]; then echo "Loading... "; fi)' + +# Then we can also show the git branch +RPROMPT+='${vcs_info_msg_0_}' # First set a dot that changes colour on success/fail or previous command PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f ' From bcd3112ec95a80830cd28f8532912cb782286061 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sat, 21 Sep 2024 09:02:04 +0100 Subject: [PATCH 8/8] Add phpactor support for neovim --- .gitmodules | 3 +++ neovim/init.lua | 1 + neovim/pack/vendor/start/nvim-lspconfig | 1 + 3 files changed, 5 insertions(+) create mode 160000 neovim/pack/vendor/start/nvim-lspconfig diff --git a/.gitmodules b/.gitmodules index 7e0bacf..95a093c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,6 @@ [submodule "neovim/pack/vendor/start/gitsigns.nvim"] path = neovim/pack/vendor/start/gitsigns.nvim url = https://github.com/lewis6991/gitsigns.nvim +[submodule "neovim/pack/vendor/start/nvim-lspconfig"] + path = neovim/pack/vendor/start/nvim-lspconfig + url = https://github.com/neovim/nvim-lspconfig diff --git a/neovim/init.lua b/neovim/init.lua index 8f772cc..37f0487 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -5,6 +5,7 @@ My NeoVim configuration require('nvim-web-devicons').setup() require('oil').setup() require('gitsigns').setup() +require('lspconfig').phpactor.setup({}) -- Editor options vim.wo.number = true diff --git a/neovim/pack/vendor/start/nvim-lspconfig b/neovim/pack/vendor/start/nvim-lspconfig new file mode 160000 index 0000000..3ad5627 --- /dev/null +++ b/neovim/pack/vendor/start/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 3ad562700d0615818bf358268ac8914f6ce2b079