From fd46ba319e473087a61837656e0c659c11ab4441 Mon Sep 17 00:00:00 2001 From: Tri Vo Khac <33442340+vokhactri@users.noreply.github.com> Date: Wed, 24 May 2023 22:33:35 +0700 Subject: [PATCH] refactor: follow arch linux zsh docs --- zsh/{ => .config/zsh}/.zshenv | 2 -- zsh/.config/zsh/.zshrc | 27 ++++++++++++++++--------- zsh/.config/zsh/{.zprofile => zsh-eval} | 4 +++- zsh/.config/zsh/zsh-exports | 4 ++-- zsh/.config/zsh/zsh-prompt | 3 --- 5 files changed, 22 insertions(+), 18 deletions(-) rename zsh/{ => .config/zsh}/.zshenv (62%) rename zsh/.config/zsh/{.zprofile => zsh-eval} (69%) delete mode 100644 zsh/.config/zsh/zsh-prompt diff --git a/zsh/.zshenv b/zsh/.config/zsh/.zshenv similarity index 62% rename from zsh/.zshenv rename to zsh/.config/zsh/.zshenv index 95a8577..7934681 100644 --- a/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -1,4 +1,2 @@ export XDG_CONFIG_HOME="${HOME}/.config" export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" - -[[ -f $ZDOTDIR/.zshenv ]] && . $ZDOTDIR/.zshenv diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 5f1bddf..82ef322 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -3,25 +3,32 @@ # workaround for vscode terminal [[ -z "${XDG_CONFIG_HOME}" ]] && export XDG_CONFIG_HOME="${HOME}/.config" [[ -z "${ZDOTDIR}" ]] && export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" +HISTFILE="$HOME"/.zsh_history + # some useful options (man zshoptions) -setopt autocd extendedglob nomatch menucomplete -setopt interactive_comments +setopt AUTO_CD EXTENDED_GLOB NOMATCH MENU_COMPLETE +setopt INTERACTIVE_COMMENTS stty stop undef # Disable ctrl-s to freeze terminal. zle_highlight=('paste:none') # history -setopt appendhistory -setopt incappendhistory # Immediately append commands to history file. -setopt histignoredups # Never add duplicate entries. -setopt histignorespace # Ignore commands that start with a space. -setopt histreduceblanks # Remove unnecessary blank lines. +setopt APPEND_HISTORY +setopt INC_APPEND_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_SPACE +setopt HIST_FIND_NO_DUPS +setopt HIST_SAVE_NO_DUPS + +unsetopt EXTENDED_HISTORY # beeping is annoying -unsetopt beep +unsetopt BEEP # remove % symbol on prompt -unsetopt promptsp +unsetopt PROMPT_SP # completions @@ -52,7 +59,7 @@ source "$ZDOTDIR/zsh-functions" # Normal files to source zsh_add_file "zsh-exports" zsh_add_file "zsh-aliases" -zsh_add_file "zsh-prompt" +zsh_add_file "zsh-eval" # Plugins repos=( diff --git a/zsh/.config/zsh/.zprofile b/zsh/.config/zsh/zsh-eval similarity index 69% rename from zsh/.config/zsh/.zprofile rename to zsh/.config/zsh/zsh-eval index 36a0f23..afe82e0 100644 --- a/zsh/.config/zsh/.zprofile +++ b/zsh/.config/zsh/zsh-eval @@ -1,4 +1,6 @@ -# Set PATH, MANPATH, etc., for Homebrew. +#!/usr/bin/env bash + [ -f /opt/homebrew/bin/brew ] && eval "$(/opt/homebrew/bin/brew shellenv)" command -v fnm > /dev/null 2>&1 && eval "$(fnm env --use-on-cd)" command -v zoxide > /dev/null 2>&1 && eval "$(zoxide init zsh)" +command -v starship > /dev/null 2>&1 && eval "$(starship init zsh)" diff --git a/zsh/.config/zsh/zsh-exports b/zsh/.config/zsh/zsh-exports index 06e3989..26af6bb 100644 --- a/zsh/.config/zsh/zsh-exports +++ b/zsh/.config/zsh/zsh-exports @@ -1,10 +1,10 @@ #!/usr/bin/env bash HISTSIZE=1000000 +SAVEHIST=1000000 -export PATH="$HOME/.local/bin":$PATH export MANWIDTH=999 -export HISTFILE="$ZDOTDIR"/.zsh_history +export PATH="$HOME/.local/bin":$PATH export EDITOR="micro" export PAGE="bat" diff --git a/zsh/.config/zsh/zsh-prompt b/zsh/.config/zsh/zsh-prompt deleted file mode 100644 index 3a2f512..0000000 --- a/zsh/.config/zsh/zsh-prompt +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -command -v starship > /dev/null 2>&1 && eval "$(starship init zsh)"