rearange sz.env and optimize for zsh
This commit is contained in:
parent
39a136f9e9
commit
0acdc146c4
|
@ -0,0 +1,65 @@
|
||||||
|
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
[ -z "$ZSH_CACHE_DIR" ] && export ZSH_CACHE_DIR=$HOME/.cache/zsh
|
||||||
|
mkdir -p $ZSH_CACHE_DIR/completions
|
||||||
|
mkdir -p "$HOME/.local/share/zsh/completions"
|
||||||
|
|
||||||
|
# Remove duplicates from fpath, and add local completion dir
|
||||||
|
fpath=( $(
|
||||||
|
for d in $(
|
||||||
|
awk '!seen[$0]++' <(
|
||||||
|
echo "$HOME/.local/share/zsh/completions"
|
||||||
|
printf '%s\n' $fpath
|
||||||
|
)
|
||||||
|
); do
|
||||||
|
[ -d "$d" ] && echo "$d"
|
||||||
|
done
|
||||||
|
) )
|
||||||
|
|
||||||
|
skip_global_compinit=1
|
||||||
|
|
||||||
|
# # Jump to the bottom of the screen
|
||||||
|
# SZ_TPUT_END=$(tput cup 9999 0)
|
||||||
|
# echo $SZ_TPUT_END
|
||||||
|
|
||||||
|
PS1="$(zsh -c '. <([ -n "$(echo /etc/*-release(N))" ] && cat /etc/*-release(N) | uniq -u || NAME="$VENDOR" ); echo "$NAME $VERSION_ID "')| ZSH ${ZSH_VERSION} LOADING >"
|
||||||
|
|
||||||
|
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
#""" Shell Settings """
|
||||||
|
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
typeset -g HISTFILE="$HOME/.zsh_history"
|
||||||
|
typeset -g HISTSIZE=1000000
|
||||||
|
typeset -g SAVEHIST=$HISTSIZE
|
||||||
|
typeset -g COMPLETION_WAITING_DOTS="true"
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fix "+[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called" issue
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# SETOPT #
|
||||||
|
#####################
|
||||||
|
setopt promptsubst
|
||||||
|
setopt extended_history # record timestamp of command in HISTFILE
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_all_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
setopt inc_append_history # add commands to HISTFILE in order of execution
|
||||||
|
setopt share_history # share command history data
|
||||||
|
setopt always_to_end # cursor moved to the end in full completion
|
||||||
|
setopt hash_list_all # hash everything before completion
|
||||||
|
setopt nocompletealiases # no complete alisases - no need for specific compdef for aliases
|
||||||
|
setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
|
||||||
|
setopt complete_in_word # allow completion from within a word/phrase
|
||||||
|
setopt nocorrect # spelling correction for commands
|
||||||
|
setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
|
||||||
|
setopt auto_cd # changing directories without cd
|
||||||
|
setopt nolisttypes
|
||||||
|
setopt listpacked
|
||||||
|
setopt automenu
|
||||||
|
setopt interactivecomments # allow # comments in command-line
|
||||||
|
setopt vi
|
||||||
|
|
||||||
|
[[ -n "${DBG}" ]] && echo "ZSH preped"
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
#
|
#
|
||||||
# ### Added by z-shell/zi's installer
|
# ### Added by z-shell/zi's installer
|
||||||
ZI_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zi/bin"
|
ZI_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zi"
|
||||||
mkdir -p "$(dirname "$ZI_HOME")"
|
mkdir -p "$(dirname "$ZI_HOME")"
|
||||||
|
|
||||||
|
typeset -gAH ZINIT=(HOME_DIR "${ZI_HOME}" COMPINIT_OPTS '-D -i -u -C -w')
|
||||||
|
|
||||||
if [[ ! -d "$ZI_HOME/.git" ]]; then
|
if [[ ! -d "$ZI_HOME/.git" ]]; then
|
||||||
print -P "%F{33}▓▒░ %F{160}Installing (%F{33}z-shell/zi%F{160})…%f"
|
print -P "%F{33}▓▒░ %F{160}Installing (%F{33}z-shell/zi%F{160})…%f"
|
||||||
command mkdir -p "$(dirname "$ZINIT_HOME")" \
|
command mkdir -p "$(dirname "$ZINIT_HOME")" \
|
||||||
|
@ -17,16 +20,15 @@ if [[ ! -d "$ZI_HOME/.git" ]]; then
|
||||||
|| print -P "%F{160}▓▒░ The clone has failed.%f%b"
|
|| print -P "%F{160}▓▒░ The clone has failed.%f%b"
|
||||||
fi
|
fi
|
||||||
source "${ZI_HOME}/zi.zsh"
|
source "${ZI_HOME}/zi.zsh"
|
||||||
autoload -Uz _zi
|
|
||||||
(( ${+_comps} )) && _comps[zi]=_zi
|
|
||||||
# examples here -> https://wiki.zshell.dev/ecosystem/category/-annexes
|
# examples here -> https://wiki.zshell.dev/ecosystem/category/-annexes
|
||||||
zicompinit # <- https://wiki.zshell.dev/docs/guides/commands
|
zicompinit # <- https://wiki.zshell.dev/docs/guides/commands
|
||||||
### End of z-shell/zi installer's chunk
|
### End of z-shell/zi installer's chunk
|
||||||
alias zinit=zi
|
alias zinit=zi
|
||||||
|
|
||||||
zinit ice depth=1
|
autoload -Uz _zi
|
||||||
zinit light jeffreytse/zsh-vi-mode
|
(( ${+_comps} )) && _comps[zi]=_zi
|
||||||
|
|
||||||
[[ -n "${DBG}" ]] && echo "zi ready"
|
[[ -n "${DBG}" ]] && echo "zinit/zi initialized"
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
zinit light 'marlonrichert/zsh-autocomplete'
|
||||||
|
zinit light 'zsh-users/zsh-autosuggestions'
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
zinit ice depth=1
|
||||||
|
zinit light jeffreytse/zsh-vi-mode
|
||||||
|
|
||||||
|
[[ -n "${DBG}" ]] && echo "jeffreytse/zsh-vi-mode loaded"
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
#
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
autoload -Uz _zi
|
||||||
|
(( ${+_comps} )) && _comps[zi]=_zi
|
||||||
|
|
||||||
|
autoload -Uz +X compinit bashcompinit && compinit && bashcompinit
|
||||||
|
[[ -n "${DBG}" ]] && echo "zinit/zi loaded available"
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
|
||||||
|
|
||||||
BASE_SHELL=${BASE_SHELL:-${SHELL##*/}}
|
|
||||||
|
|
||||||
if [[ "${BASE_SHELL}" == "zsh" ]]; then
|
|
||||||
|
|
||||||
[ -z "$ZSH_CACHE_DIR" ] && export ZSH_CACHE_DIR=$HOME/.cache/zsh
|
|
||||||
mkdir -p $ZSH_CACHE_DIR/completions
|
|
||||||
mkdir -p "$HOME/.local/share/zsh/completions"
|
|
||||||
|
|
||||||
# Remove duplicates from fpath, and add local completion dir
|
|
||||||
fpath=( $(
|
|
||||||
for d in $(
|
|
||||||
awk '!seen[$0]++' <(
|
|
||||||
echo "$HOME/.local/share/zsh/completions"
|
|
||||||
printf '%s\n' $fpath
|
|
||||||
)
|
|
||||||
); do
|
|
||||||
[ -d "$d" ] && echo "$d"
|
|
||||||
done
|
|
||||||
) )
|
|
||||||
|
|
||||||
skip_global_compinit=1
|
|
||||||
|
|
||||||
# # Jump to the bottom of the screen
|
|
||||||
# SZ_TPUT_END=$(tput cup 9999 0)
|
|
||||||
# echo $SZ_TPUT_END
|
|
||||||
|
|
||||||
PS1="$(zsh -c '. <([ -n "$(echo /etc/*-release(N))" ] && cat /etc/*-release(N) | uniq -u || NAME="$VENDOR" ); echo "$NAME $VERSION_ID "')| ZSH ${ZSH_VERSION} LOADING >"
|
|
||||||
|
|
||||||
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
#""" Shell Settings """
|
|
||||||
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
typeset -g HISTFILE="$HOME/.zsh_history"
|
|
||||||
typeset -g HISTSIZE=1000000
|
|
||||||
typeset -g SAVEHIST=$HISTSIZE
|
|
||||||
typeset -g COMPLETION_WAITING_DOTS="true"
|
|
||||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
|
||||||
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fix "+[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called" issue
|
|
||||||
|
|
||||||
#####################
|
|
||||||
# SETOPT #
|
|
||||||
#####################
|
|
||||||
setopt promptsubst
|
|
||||||
setopt extended_history # record timestamp of command in HISTFILE
|
|
||||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
|
||||||
setopt hist_ignore_all_dups # ignore duplicated commands history list
|
|
||||||
setopt hist_ignore_space # ignore commands that start with space
|
|
||||||
setopt hist_verify # show command with history expansion to user before running it
|
|
||||||
setopt inc_append_history # add commands to HISTFILE in order of execution
|
|
||||||
setopt share_history # share command history data
|
|
||||||
setopt always_to_end # cursor moved to the end in full completion
|
|
||||||
setopt hash_list_all # hash everything before completion
|
|
||||||
setopt nocompletealiases # no complete alisases - no need for specific compdef for aliases
|
|
||||||
setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
|
|
||||||
setopt complete_in_word # allow completion from within a word/phrase
|
|
||||||
setopt nocorrect # spelling correction for commands
|
|
||||||
setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
|
|
||||||
setopt auto_cd # changing directories without cd
|
|
||||||
setopt nolisttypes
|
|
||||||
setopt listpacked
|
|
||||||
setopt automenu
|
|
||||||
setopt interactivecomments # allow # comments in command-line
|
|
||||||
setopt vi
|
|
||||||
|
|
||||||
[[ -n "${DBG}" ]] && echo "ZSH preped"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
|
||||||
|
|
||||||
zinit load 'marlonrichert/zsh-autocomplete'
|
|
||||||
if false; then
|
|
||||||
autoload -Uz +X compinit bashcompinit && compinit && bashcompinit
|
|
||||||
|
|
||||||
zstyle ':completion:*' menu yes select
|
|
||||||
fi
|
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
|
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
if is_cmd broot; then
|
if is_cmd broot; then
|
||||||
source /mnt/szmedia/USERDATA/home/sz/.config/broot/launcher/bash/br
|
. <(broot --print-shell-function "${SHELL##*/}")
|
||||||
|
broot --set-install-state installed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -54,15 +54,15 @@ if is_sourced; then
|
||||||
"| sort' shell '{}' ';'" \
|
"| sort' shell '{}' ';'" \
|
||||||
"-exec sh -c '" \
|
"-exec sh -c '" \
|
||||||
'find "$1" -xdev -maxdepth 1 -type f' \
|
'find "$1" -xdev -maxdepth 1 -type f' \
|
||||||
'-name "PATH_*.env" -or -name "PATH_*.env.'"${BASE_SHELL}"\" \
|
'-name "???_PATH_*.env" -or -name "???_PATH_*.env.'"${BASE_SHELL}"\" \
|
||||||
"| sort' shell '{}' ';'" \
|
"| sort' shell '{}' ';'" \
|
||||||
"-exec sh -c '" \
|
"-exec sh -c '" \
|
||||||
'find "$1" -xdev -maxdepth 1 -type f' \
|
'find "$1" -xdev -maxdepth 1 -type f' \
|
||||||
'-name "*.env" -or -name "*.env.'"${BASE_SHELL}"\" \
|
'-name "*.env" -or -name "*.env.'"${BASE_SHELL}"\" \
|
||||||
'| grep -Ev "/(PATH|ID)_[^/]+$"' \
|
'| grep -Ev "/[[:digit:]]+_(PATH|ID)_[^/]+$"' \
|
||||||
"| sort' shell '{}' ';'" \
|
"| sort' shell '{}' ';'" \
|
||||||
"-exec sh -c '" \
|
"-exec sh -c '" \
|
||||||
'find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env"' \
|
'find "$1" -xdev -maxdepth 1 -type f -name "999_PATH_zz_cleanup.env"' \
|
||||||
"' shell '{}' ';'"
|
"' shell '{}' ';'"
|
||||||
)"
|
)"
|
||||||
ALL_ENV_FILES="$(
|
ALL_ENV_FILES="$(
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
if is_cmd lsd; then
|
if is_cmd lsd; then
|
||||||
|
|
||||||
alias _ls="$(command -v lsd) "
|
alias _ls="$(command -v lsd) --git "
|
||||||
alias lg="ll --git "
|
|
||||||
|
|
||||||
[[ -n "${DBG}" ]] && echo "assigned lsd as ls alias."
|
[[ -n "${DBG}" ]] && echo "assigned lsd as ls alias."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
if is_cmd eza; then
|
if is_cmd eza; then
|
||||||
|
|
||||||
alias _ls="$(command -v eza) --icons "
|
alias _ls="$(command -v eza) --icons --git --git-repos-no-status "
|
||||||
alias lg="ll --git --git-repos-no-status"
|
|
||||||
|
|
||||||
[[ -n "${DBG}" ]] && echo "assigned eza as ls alias."
|
[[ -n "${DBG}" ]] && echo "assigned eza as ls alias."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
if is_cmd zoxide; then
|
||||||
|
|
||||||
|
. <( zoxide init --cmd cd "${BASE_SHELL}" )
|
||||||
|
|
||||||
|
[[ -n "${DBG}" ]] && echo "zoxide loaded."
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
BASE_SHELL=${BASE_SHELL:-${SHELL##*/}}
|
|
||||||
|
|
||||||
if is_cmd atuin; then
|
if is_cmd atuin; then
|
||||||
if [[ "${BASE_SHELL}" == "bash" ]] && ! [[ -n "$SZ_ENV_BASH_LOAD_PREEXEC$BLE_VERSION" ]]; then
|
if ! [[ -n "$SZ_ENV_BASH_LOAD_PREEXEC$BLE_VERSION" ]]; then
|
||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
'atuin was found, but bash-preexec or ble.sh are not loaded,' \
|
'atuin was found, but bash-preexec or ble.sh are not loaded,' \
|
||||||
'to load atuin, first run update-ble.sh or update-bash-preexec ' \
|
'to load atuin, first run update-ble.sh or update-bash-preexec ' \
|
||||||
'then relaod (_r) the shell.'
|
'then relaod (_r) the shell.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. <( atuin init "${BASE_SHELL}" )
|
. <( atuin init bash )
|
||||||
. <( atuin gen-completions --shell ${BASE_SHELL} )
|
. <( atuin gen-completions --shell bash )
|
||||||
|
|
||||||
[[ -n "${DBG}" ]] && echo "atuin loaded."
|
[[ -n "${DBG}" ]] && echo "atuin loaded."
|
||||||
fi
|
fi
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
if is_cmd atuin; then
|
||||||
|
|
||||||
|
# . <( atuin init "${BASE_SHELL}" )
|
||||||
|
zinit light atuinsh/atuin
|
||||||
|
|
||||||
|
[[ -n "${DBG}" ]] && echo "atuin loaded."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
|
@ -40,6 +40,7 @@ if is_cmd 'chezmoi'; then
|
||||||
chezmoi edit "${EDITLIST[@]}" --apply --interactive
|
chezmoi edit "${EDITLIST[@]}" --apply --interactive
|
||||||
}
|
}
|
||||||
alias czx="CZ_EXTR=1 chezmoi "
|
alias czx="CZ_EXTR=1 chezmoi "
|
||||||
|
alias cz-reset-home="(czcd; cd ..; RESET=reset ./symclone.sh _home.macos; RESET=reset ./symclone.sh _home)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim: set ft=bash sw=4 sts=4 et:
|
# vim: set ft=sh sw=4 sts=4 et:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
alias _ls='command ls '
|
[[ "$(command -v _ls)" =~ alias ]] || alias _ls='command ls '
|
||||||
{{- if eq .chezmoi.os "darwin" }}
|
{{- if eq .chezmoi.os "darwin" }}
|
||||||
alias ls='_ls -hF --color=auto '
|
alias ls='_ls -hF --color=auto '
|
||||||
alias l='ls -la '
|
alias l='ls -la '
|
||||||
|
@ -36,3 +36,4 @@ alias nvimdiff='nvim -d '
|
||||||
alias vimdiff='nvimdiff '
|
alias vimdiff='nvimdiff '
|
||||||
|
|
||||||
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
|
||||||
|
|
||||||
|
zicompinit
|
||||||
|
|
||||||
|
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4:
|
||||||
|
|
Loading…
Reference in New Issue