From 8406b0395a4307612ed9a42ccea5c3c92faed885 Mon Sep 17 00:00:00 2001 From: afranco Date: Wed, 5 Feb 2025 17:02:50 +0000 Subject: [PATCH] chore(zsh): cleanup zsh config --- .config/zsh/.zshenv | 28 ++++++++-------------------- .config/zsh/.zshrc | 25 ++++--------------------- .config/zsh/functions.zsh | 2 -- .config/zsh/plugins.zsh | 18 ++++++++---------- 4 files changed, 20 insertions(+), 53 deletions(-) diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 854dc53..050b921 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -1,11 +1,6 @@ -#This is used to reload the instance -if [[ ! $(tty) =~ ^/dev/tty[0-9]*$ ]]; then - TRAPUSR1() { - if [[ -o INTERACTIVE ]]; then - exec "${SHELL}" - fi - } -fi +export EDITOR=nvim +export VISUAL=nvim +export READER=mupdf export XDG_CONFIG_HOME="${HOME}/.config" export XDG_CACHE_HOME="${HOME}/.cache" @@ -13,17 +8,16 @@ export XDG_DATA_HOME="${HOME}/.local/share" export XDG_STATE_HOME="${HOME}/.local/state" export XDG_RUNTIME_DIR=/tmp -# Add exports +export GOPATH="$HOME/go" +export GOBIN="$GOPATH/bin" + +# OS-specific exports if [[ $(uname) == "Darwin" ]]; then - #ONLY MACOS export JAVA_HOME=$(/usr/libexec/java_home) + export GEM_HOME=$HOME/.gem export PATH="/opt/homebrew/bin:$PATH" export PATH="/opt/homebrew/opt/texlive/bin:$PATH" - export GEM_HOME=$HOME/.gem export PATH=$PATH:$GEM_HOME/bin -else - #ONLY LINUX - export LIBVA_DRIVER_NAME=nvidia fi @@ -34,12 +28,6 @@ export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/go/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.ghcup/bin:$PATH" -export PATH="$HOME/.miniforge3/bin:$PATH" export PATH="$HOME/.cabal/bin:$PATH" -export PATH="$XDG_CONFIG_HOME/emacs/bin:$PATH" - -export GOPATH="$HOME/go" -export GOBIN="$GOPATH/bin" - . "$HOME/.cargo/env" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 02628b5..7ab6c78 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,26 +1,9 @@ -# Setup History -HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history -HISTSIZE=100000000 -SAVEHIST=100000000 -setopt BANG_HIST # Treat the '!' character specially during expansion. -setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. -setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. -setopt SHARE_HISTORY # Share history between all sessions. -setopt HIST_FIND_NO_DUPS # Do not display a line previously found. -setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. -setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry. -setopt HIST_SAVE_NO_DUPS -setopt HIST_IGNORE_ALL_DUPS -setopt HIST_VERIFY +if [[ -z "$TMUX" ]]; then + tmux new-session -A -s 0 +fi -#Set EDITOR AND READER -export EDITOR=nvim -export VISUAL=nvim -export READER=mupdf - -#Prompt +source $ZDOTDIR/setup-history.zsh source $ZDOTDIR/prompts/simple-two-line.zsh - source $ZDOTDIR/functions.zsh source $ZDOTDIR/plugins.zsh diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh index 7433376..c309b22 100644 --- a/.config/zsh/functions.zsh +++ b/.config/zsh/functions.zsh @@ -16,9 +16,7 @@ function routevpn { alias ls="eza --icons -l --sort type" alias lg="lazygit" -alias calcurse-caldav='CALCURSE_CALDAV_PASSWORD=$(keyring get caldav afonso) calcurse-caldav' alias routes="netstat -rn -f inet" - alias lc='lazygit --work-tree="$HOME" --git-dir="$HOME/dotfiles"' alias config='git --work-tree="$HOME" --git-dir="$HOME/dotfiles"' diff --git a/.config/zsh/plugins.zsh b/.config/zsh/plugins.zsh index 3bf805a..ffb35ea 100644 --- a/.config/zsh/plugins.zsh +++ b/.config/zsh/plugins.zsh @@ -1,23 +1,21 @@ -#Completions -ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history completion) +# Completions zstyle ':completion:*' rehash true fpath+=$ZDOTDIR/plugins/zsh-completions/src autoload -U compinit && compinit + +# Autosuggestions +ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history completion) source $ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +# Syntax Highlighting source $ZDOTDIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh -source $ZDOTDIR/plugins/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh - +# Fzf-Tab zvm_after_init_commands+=('source <(fzf --zsh) && enable-fzf-tab') source $ZDOTDIR/plugins/fzf-tab/fzf-tab.plugin.zsh +# Vi mode source $ZDOTDIR/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh +# MacOS source $ZDOTDIR/plugins/zsh-macos.plugin.zsh - -source $ZDOTDIR/plugins/zsh-git.plugin.zsh - -source $ZDOTDIR/plugins/zsh-sudo.plugin.zsh - -source $ZDOTDIR/plugins/zsh-tmux/zsh-tmux.plugin.zsh