From c38a49f2b3c5a22e48d1b5c55f999851c36a6530 Mon Sep 17 00:00:00 2001 From: afonso Date: Thu, 22 Feb 2024 11:38:36 +0000 Subject: [PATCH] [ZSH] plugins, themes and prompt --- .config/zsh/main.zsh | 31 ++++++------------ .config/zsh/plugins/fast-syntax-highlighting | 1 + .config/zsh/plugins/fzf-tab | 1 + .config/zsh/plugins/zsh-autosuggestions | 1 + .config/zsh/plugins/zsh-completions | 1 + .../zsh/plugins/zsh-history-substring-search | 1 + .config/zsh/plugins/zsh-syntax-highlighting | 1 + .config/zsh/plugins/zsh-vi-mode | 1 + .config/zsh/prompts/pure | 1 + .config/zsh/qol.zsh | 9 ++++++ .config/zsh/replacements.zsh | 11 +++++-- .config/zsh/themes/catppuccin_frappe.zsh | 30 +++++++++++++++++ .config/zsh/themes/catppuccin_latte.zsh | 30 +++++++++++++++++ .config/zsh/themes/gruvbox_dark.zsh | 32 +++++++++++++++++++ .config/zsh/themes/gruvbox_light.zsh | 30 +++++++++++++++++ 15 files changed, 157 insertions(+), 24 deletions(-) create mode 160000 .config/zsh/plugins/fast-syntax-highlighting create mode 160000 .config/zsh/plugins/fzf-tab create mode 160000 .config/zsh/plugins/zsh-autosuggestions create mode 160000 .config/zsh/plugins/zsh-completions create mode 160000 .config/zsh/plugins/zsh-history-substring-search create mode 160000 .config/zsh/plugins/zsh-syntax-highlighting create mode 160000 .config/zsh/plugins/zsh-vi-mode create mode 160000 .config/zsh/prompts/pure diff --git a/.config/zsh/main.zsh b/.config/zsh/main.zsh index 2be6c70..2a1ad9d 100644 --- a/.config/zsh/main.zsh +++ b/.config/zsh/main.zsh @@ -15,30 +15,13 @@ setopt HIST_VERIFY export EDITOR=nvim export READER=mupdf -# Add paths -export PATH="/opt/homebrew/bin:$PATH" -export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH" -export PATH="$HOME/.bun/bin:$PATH" -export PATH="$HOME/go/bin:$PATH" -export PATH="$HOME/.local/share/nvim/mason/bin:$PATH" -export PATH="$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin:$PATH" -export PATH="$HOME/.local/bin:$PATH" -export PATH="$HOME/.cargo/bin:$PATH" -export PATH="$HOME/.ghcup/bin:$PATH" -export PATH="/usr/bin/vendor_perl:$PATH" -export PATH="/Applications/usdpython/usdpython/USD:$PATH" -export PATH="/Applications/usdpython/usdzconvert:$PATH" -export PATH="/Users/afonso/Library/Python/3.11/bin:$PATH" -[ -f "/Users/afonso/.ghcup/env" ] && source "/Users/afonso/.ghcup/env" # ghcup-env -export PYTHONPATH="/Applications/usdpython/USD/lib/python:$PYTHONPATH" -export JAVA_HOME="/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home" -if [ "$(arch)" = "arm64" ]; then - eval "$(/opt/homebrew/bin/brew shellenv)" -else - eval "$(/usr/local/bin/brew shellenv)" -fi +#if [ "$(arch)" = "arm64" ]; then +eval "$(/opt/homebrew/bin/brew shellenv)" +#else +# eval "$(/usr/local/bin/brew shellenv)" +#fi [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh @@ -49,3 +32,7 @@ enable-fzf-tab # opam configuration source $HOME/.opam/opam-init/init.zsh > /dev/null 2>&1 || true + +eval "$(zoxide init zsh)" + +eval "$(direnv hook zsh)" diff --git a/.config/zsh/plugins/fast-syntax-highlighting b/.config/zsh/plugins/fast-syntax-highlighting new file mode 160000 index 0000000..cf318e0 --- /dev/null +++ b/.config/zsh/plugins/fast-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit cf318e06a9b7c9f2219d78f41b46fa6e06011fd9 diff --git a/.config/zsh/plugins/fzf-tab b/.config/zsh/plugins/fzf-tab new file mode 160000 index 0000000..c2b4aa5 --- /dev/null +++ b/.config/zsh/plugins/fzf-tab @@ -0,0 +1 @@ +Subproject commit c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9 diff --git a/.config/zsh/plugins/zsh-autosuggestions b/.config/zsh/plugins/zsh-autosuggestions new file mode 160000 index 0000000..c3d4e57 --- /dev/null +++ b/.config/zsh/plugins/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5 diff --git a/.config/zsh/plugins/zsh-completions b/.config/zsh/plugins/zsh-completions new file mode 160000 index 0000000..f7c3173 --- /dev/null +++ b/.config/zsh/plugins/zsh-completions @@ -0,0 +1 @@ +Subproject commit f7c3173886f4f56bf97d622677c6d46ab005831f diff --git a/.config/zsh/plugins/zsh-history-substring-search b/.config/zsh/plugins/zsh-history-substring-search new file mode 160000 index 0000000..8dd05bf --- /dev/null +++ b/.config/zsh/plugins/zsh-history-substring-search @@ -0,0 +1 @@ +Subproject commit 8dd05bfcc12b0cd1ee9ea64be725b3d9f713cf64 diff --git a/.config/zsh/plugins/zsh-syntax-highlighting b/.config/zsh/plugins/zsh-syntax-highlighting new file mode 160000 index 0000000..bb27265 --- /dev/null +++ b/.config/zsh/plugins/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit bb27265aeeb0a22fb77f1275118a5edba260ec47 diff --git a/.config/zsh/plugins/zsh-vi-mode b/.config/zsh/plugins/zsh-vi-mode new file mode 160000 index 0000000..ea1f58a --- /dev/null +++ b/.config/zsh/plugins/zsh-vi-mode @@ -0,0 +1 @@ +Subproject commit ea1f58ab9b1f3eac50e2cde3e3bc612049ef683b diff --git a/.config/zsh/prompts/pure b/.config/zsh/prompts/pure new file mode 160000 index 0000000..4e0ce0a --- /dev/null +++ b/.config/zsh/prompts/pure @@ -0,0 +1 @@ +Subproject commit 4e0ce0a2f8576894e5dad83857e9a9851faa0f5b diff --git a/.config/zsh/qol.zsh b/.config/zsh/qol.zsh index e723104..b348137 100644 --- a/.config/zsh/qol.zsh +++ b/.config/zsh/qol.zsh @@ -16,3 +16,12 @@ capture() { } ' } + +sourceall(){ + set -e + pids=$(pgrep zsh) + while IFS= read -r pid; do + kill -USR1 "$pid" + done <<< "$pids" + set +e +} diff --git a/.config/zsh/replacements.zsh b/.config/zsh/replacements.zsh index 8eadaa1..eb1562c 100644 --- a/.config/zsh/replacements.zsh +++ b/.config/zsh/replacements.zsh @@ -4,6 +4,10 @@ ls() { eza --icons -l --sort type "$@" } +cd(){ + z "$@" +} + nvim() { /opt/homebrew/bin/nvim --listen /tmp/nvim.pipe "$@" } @@ -12,6 +16,9 @@ vim() { /opt/homebrew/bin/nvim --listen /tmp/nvim.pipe "$@" } -alias find="fd" -alias df="duf" +v() { + /opt/homebrew/bin/nvim --listen /tmp/nvim.pipe "$@" +} + alias lg="lazygit" +alias calcurse-caldav='CALCURSE_CALDAV_PASSWORD=$(keyring get caldav afonso) calcurse-caldav' diff --git a/.config/zsh/themes/catppuccin_frappe.zsh b/.config/zsh/themes/catppuccin_frappe.zsh index 37284d0..023ad23 100644 --- a/.config/zsh/themes/catppuccin_frappe.zsh +++ b/.config/zsh/themes/catppuccin_frappe.zsh @@ -72,3 +72,33 @@ ZSH_HIGHLIGHT_STYLES[redirection]='fg=#c6d0f5' ZSH_HIGHLIGHT_STYLES[arg0]='fg=#c6d0f5' ZSH_HIGHLIGHT_STYLES[default]='fg=#c6d0f5' ZSH_HIGHLIGHT_STYLES[cursor]='fg=#c6d0f5' + +#Pure prompt +# Define cappuccin frappe colors +pure_prompt_colors() { + local colors + colors=( + execution_time='%F{#bdae93}' # The execution time of the last command when exceeding PURE_CMD_MAX_EXEC_TIME. + git:arrow='%F{#bdae93}' # For PURE_GIT_UP_ARROW and PURE_GIT_DOWN_ARROW. + git:stash='%F{#bdae93}' # For PURE_GIT_STASH_SYMBOL. + git:branch='%F{#98971a}' # The name of the current branch when in a Git repository. + git:branch:cached='%F{#cc241d}' # The name of the current branch when the data isn't fresh. + git:action='%F{#b16286}' # The current action in progress (cherry-pick, rebase, etc.) when in a Git repository. + git:dirty='%F{#d65d0e}' # The asterisk showing the branch is dirty. + host='%F{#7c6f64}' # The hostname when on a remote machine. + path='%F{#458588}' # The current path, for example, PWD. + prompt:error='%F{#fb4934}' # The PURE_PROMPT_SYMBOL when the previous command has failed. + prompt:success='%F{#98971a}' # The PURE_PROMPT_SYMBOL when the previous command has succeeded. + prompt:continuation='%F{#b16286}' # The color for showing the state of the parser in the continuation prompt (PS2). + suspended_jobs='%F{#fb4934}' # The ✦ symbol indicates that jobs are running in the background. + user='%F{#7c6f64}' # The username when on remote machine. + user:root='%F{default}' # The username when the user is root. + virtualenv='%F{#b16286}' # The name of the Python virtualenv when in use. + ) + (( $#colors )) || echo $colors +} + +# Apply cappuccin frappe colors to Zsh Pure prompt +for color in $(pure_prompt_colors); do + zstyle ":prompt:pure:$color" color "$color" +done diff --git a/.config/zsh/themes/catppuccin_latte.zsh b/.config/zsh/themes/catppuccin_latte.zsh index 09b4cf9..7b9c6c5 100644 --- a/.config/zsh/themes/catppuccin_latte.zsh +++ b/.config/zsh/themes/catppuccin_latte.zsh @@ -72,3 +72,33 @@ ZSH_HIGHLIGHT_STYLES[redirection]='fg=#4c4f69' ZSH_HIGHLIGHT_STYLES[arg0]='fg=#4c4f69' ZSH_HIGHLIGHT_STYLES[default]='fg=#4c4f69' ZSH_HIGHLIGHT_STYLES[cursor]='fg=#4c4f69' + +#Pure prompt +# Define cappuccin latte colors +pure_prompt_colors() { + local colors + colors=( + execution_time='%F{#bdae93}' # The execution time of the last command when exceeding PURE_CMD_MAX_EXEC_TIME. + git:arrow='%F{#458588}' # For PURE_GIT_UP_ARROW and PURE_GIT_DOWN_ARROW. + git:stash='%F{#bdae93}' # For PURE_GIT_STASH_SYMBOL. + git:branch='%F{#98971a}' # The name of the current branch when in a Git repository. + git:branch:cached='%F{#cc241d}' # The name of the current branch when the data isn't fresh. + git:action='%F{#b16286}' # The current action in progress (cherry-pick, rebase, etc.) when in a Git repository. + git:dirty='%F{#d65d0e}' # The asterisk showing the branch is dirty. + host='%F{#7c6f64}' # The hostname when on a remote machine. + path='%F{#458588}' # The current path, for example, PWD. + prompt:error='%F{#cc241d}' # The PURE_PROMPT_SYMBOL when the previous command has failed. + prompt:success='%F{#98971a}' # The PURE_PROMPT_SYMBOL when the previous command has succeeded. + prompt:continuation='%F{#b16286}' # The color for showing the state of the parser in the continuation prompt (PS2). + suspended_jobs='%F{#cc241d}' # The ✦ symbol indicates that jobs are running in the background. + user='%F{#7c6f64}' # The username when on remote machine. + user:root='%F{default}' # The username when the user is root. + virtualenv='%F{#b16286}' # The name of the Python virtualenv when in use. + ) + (( $#colors )) || echo $colors +} + +# Apply cappuccin latte colors to Zsh Pure prompt +for color in $(pure_prompt_colors); do + zstyle ":prompt:pure:$color" color "$color" +done diff --git a/.config/zsh/themes/gruvbox_dark.zsh b/.config/zsh/themes/gruvbox_dark.zsh index c776a66..52a3092 100644 --- a/.config/zsh/themes/gruvbox_dark.zsh +++ b/.config/zsh/themes/gruvbox_dark.zsh @@ -74,3 +74,35 @@ ZSH_HIGHLIGHT_STYLES[default]='fg=#83a598' ZSH_HIGHLIGHT_STYLES[cursor]='fg=#83a598' #ZSH Syntax Highlighting ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#928374,italic,underline" + + + +#Pure prompt +# Define gruvbox dark colors +pure_prompt_colors() { + local colors + colors=( + execution_time='%F{#fabd2f}' # The execution time of the last command when exceeding PURE_CMD_MAX_EXEC_TIME. + git:arrow='%F{#83a598}' # For PURE_GIT_UP_ARROW and PURE_GIT_DOWN_ARROW. + git:stash='%F{#83a598}' # For PURE_GIT_STASH_SYMBOL. + git:branch='%F{#b8bb26}' # The name of the current branch when in a Git repository. + git:branch:cached='%F{#fb4934}' # The name of the current branch when the data isn't fresh. + git:action='%F{#d3869b}' # The current action in progress (cherry-pick, rebase, etc.) when in a Git repository. + git:dirty='%F{#fe8019}' # The asterisk showing the branch is dirty. + host='%F{#ebdbb2}' # The hostname when on a remote machine. + path='%F{#83a598}' # The current path, for example, PWD. + prompt:error='%F{#fb4934}' # The PURE_PROMPT_SYMBOL when the previous command has failed. + prompt:success='%F{#b16286}' # The PURE_PROMPT_SYMBOL when the previous command has succeeded. + prompt:continuation='%F{#d3869b}' # The color for showing the state of the parser in the continuation prompt (PS2). + suspended_jobs='%F{#fb4934}' # The ✦ symbol indicates that jobs are running in the background. + user='%F{#ebdbb2}' # The username when on remote machine. + user:root='%F{default}' # The username when the user is root. + virtualenv='%F{#d3869b}' # The name of the Python virtualenv when in use. + ) + (( $#colors )) || echo $colors +} + +# Apply gruvbox dark colors to Zsh Pure prompt +for color in $(pure_prompt_colors); do + zstyle ":prompt:pure:$color" color "$color" +done diff --git a/.config/zsh/themes/gruvbox_light.zsh b/.config/zsh/themes/gruvbox_light.zsh index bc2d666..1c2507e 100644 --- a/.config/zsh/themes/gruvbox_light.zsh +++ b/.config/zsh/themes/gruvbox_light.zsh @@ -72,3 +72,33 @@ ZSH_HIGHLIGHT_STYLES[redirection]='fg=#83a598' ZSH_HIGHLIGHT_STYLES[arg0]='fg=#83a598' ZSH_HIGHLIGHT_STYLES[default]='fg=#83a598' ZSH_HIGHLIGHT_STYLES[cursor]='fg=#83a598' + +#Pure prompt +# Define gruvbox light colors +pure_prompt_colors() { + local colors + colors=( + execution_time='%F{#d65d0e}' # The execution time of the last command when exceeding PURE_CMD_MAX_EXEC_TIME. + git:arrow='%F{#458588}' # For PURE_GIT_UP_ARROW and PURE_GIT_DOWN_ARROW. + git:stash='%F{#458588}' # For PURE_GIT_STASH_SYMBOL. + git:branch='%F{#98971a}' # The name of the current branch when in a Git repository. + git:branch:cached='%F{#cc241d}' # The name of the current branch when the data isn't fresh. + git:action='%F{#b16286}' # The current action in progress (cherry-pick, rebase, etc.) when in a Git repository. + git:dirty='%F{#d65d0e}' # The asterisk showing the branch is dirty. + host='%F{#3c3836}' # The hostname when on a remote machine. + path='%F{#458588}' # The current path, for example, PWD. + prompt:error='%F{#cc241d}' # The PURE_PROMPT_SYMBOL when the previous command has failed. + prompt:success='%F{#b16286}' # The PURE_PROMPT_SYMBOL when the previous command has succeeded. + prompt:continuation='%F{#b16286}' # The color for showing the state of the parser in the continuation prompt (PS2). + suspended_jobs='%F{#cc241d}' # The ✦ symbol indicates that jobs are running in the background. + user='%F{#3c3836}' # The username when on remote machine. + user:root='%F{default}' # The username when the user is root. + virtualenv='%F{#b16286}' # The name of the Python virtualenv when in use. + ) + (( $#colors )) || echo $colors +} + +# Apply gruvbox light colors to Zsh Pure prompt +for color in $(pure_prompt_colors); do + zstyle ":prompt:pure:$color" color "$color" +done