Правка замечаний shellcheck

This commit is contained in:
Andrei Astafev 2022-12-18 18:58:00 +03:00
parent a8f767c95d
commit e09e731101
14 changed files with 78 additions and 32 deletions

31
.zshenv
View File

@ -1,9 +1,12 @@
# shellcheck shell=bash
# vim: ft=sh
# Запрет чтения настроек из системного каталога /etc # Запрет чтения настроек из системного каталога /etc
unsetopt GLOBAL_RCS unsetopt GLOBAL_RCS
# PATH {{{ # PATH {{{
# Ruby # Ruby
if which ruby >/dev/null && which gem >/dev/null; then if command -v ruby >/dev/null && command -v gem >/dev/null; then
path=("$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" $path) path=("$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" $path)
fi fi
@ -31,34 +34,38 @@ export ZSH_COMPDUMP="$ZSH_CACHE_DIR/zcompdump-${HOST/.*/}-$ZSH_VERSION"
# GnuPG # GnuPG
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
# ASKPASS {{{ # askpass # {{{
if [ -n ${DISPLAY+set} ]; then if [[ -n ${DISPLAY+set} ]]; then
if command -v /usr/lib/openssh/gnome-ssh-askpass 2>&1 >/dev/null; then if command -v /usr/lib/openssh/gnome-ssh-askpass >/dev/null 2>&1; then
# Gnome
export SSH_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass export SSH_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass
elif command -v /usr/bin/lxqt-openssh-askpass 2>&1 >/dev/null; then elif command -v /usr/bin/lxqt-openssh-askpass >/dev/null 2>&1; then
# LxQt
export SSH_ASKPASS=/usr/bin/lxqt-openssh-askpass export SSH_ASKPASS=/usr/bin/lxqt-openssh-askpass
elif command -v /usr/bin/ssh-askpass 2>&1 >/dev/null; then elif command -v /usr/bin/ssh-askpass >/dev/null 2>&1; then
# X11
export SSH_ASKPASS=/usr/bin/ssh-askpass export SSH_ASKPASS=/usr/bin/ssh-askpass
fi fi
fi fi
# }}} # }}}
# Настройка uncrustify # Uncrustify
export UNCRUSTIFY_CONFIG="${XDG_CONFIG_HOME}/uncrustify/uncrustify.cfg" export UNCRUSTIFY_CONFIG="${XDG_CONFIG_HOME}/uncrustify/uncrustify.cfg"
[ ! -r "${UNCRUSTIFY_CONFIG}" ] && unset UNCRUSTIFY_CONFIG [ ! -r "${UNCRUSTIFY_CONFIG}" ] && unset UNCRUSTIFY_CONFIG
# Настройка Intel Studio # Intel OneAPI #{{{
if [ -n ${ENABLE_INTEL_STUDIO+set} ]; then if [[ -n ${ENABLE_INTEL_STUDIO+set} ]]; then
#export COMPILERVARS_ARCHITECTURE=intel64 #export COMPILERVARS_ARCHITECTURE=intel64
#export COMPILERVARS_PLATFORM=linux #export COMPILERVARS_PLATFORM=linux
INTEL_VARS=( /opt/intel/oneapi/advisor/latest/advixe-vars.sh INTEL_VARS=( /opt/intel/oneapi/advisor/latest/advixe-vars.sh
/opt/intel/oneapi/compiler/latest/env/vars.sh /opt/intel/oneapi/compiler/latest/env/vars.sh
/opt/intel/vtune_profiler/vtune-vars.sh ) /opt/intel/oneapi/vtune/latest/vtune-vars.sh )
for f in ${INTEL_VARS[*]}; do for f in "${INTEL_VARS[@]}"; do
[ -r "$f" ] && source "$f" > /dev/null if [ -r "$f" ]; then source "$f" >/dev/null; fi
done done
fi fi
# }}}
[ -r "$ZDOTDIR/.zshenv.user" ] && source "$ZDOTDIR/.zshenv.user" [ -r "$ZDOTDIR/.zshenv.user" ] && source "$ZDOTDIR/.zshenv.user"

13
.zshrc
View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Profiling start # Profiling start
# zmodload zsh/zprof # zmodload zsh/zprof
@ -16,11 +19,11 @@ for S in \
95-finish 95-finish
do do
N="${S//[0-9\-]/}" N="${S//[0-9\-]/}"
[ -r "$ZDOTDIR/$S.pre.zsh" ] && source "$ZDOTDIR/$S.pre.zsh" || true if [[ -r "$ZDOTDIR/$S.pre.zsh" ]]; then source "$ZDOTDIR/$S.pre.zsh"; fi
[ -r "$ZDOTDIR/$S.zsh" ] && source "$ZDOTDIR/$S.zsh" || true if [[ -r "$ZDOTDIR/$S.zsh" ]]; then source "$ZDOTDIR/$S.zsh"; fi
[ -r "$ZDOTDIR/$S.user.zsh" ] && source "$ZDOTDIR/$S.user.zsh" || true if [[ -r "$ZDOTDIR/$S.user.zsh" ]]; then source "$ZDOTDIR/$S.user.zsh"; fi
[ -r "$ZDOTDIR/$N.user.zsh" ] && source "$ZDOTDIR/$N.user.zsh" || true if [[ -r "$ZDOTDIR/$N.user.zsh" ]]; then source "$ZDOTDIR/$N.user.zsh"; fi
[ -r "$ZDOTDIR/$S.post.zsh" ] && source "$ZDOTDIR/$S.post.zsh" || true if [[ -r "$ZDOTDIR/$S.post.zsh" ]]; then source "$ZDOTDIR/$S.post.zsh"; fi
done done
# zprof # zprof

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Enable Powerlevel10k instant prompt. # Enable Powerlevel10k instant prompt.
# Should stay close to the top of ~/.config/zsh/.zshrc. # Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input # Initialization code that may require console input

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
setopt AUTO_PUSHD # Push the current directory visited on the stack. setopt AUTO_PUSHD # Push the current directory visited on the stack.
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
@ -23,5 +26,5 @@ if [ -z ${DISABLE_MAGIC_FUNCTIONS+set} ]; then
fi fi
# Подсветка вывода основных команд # Подсветка вывода основных команд
[[ -r /etc/grc.zsh ]] && source /etc/grc.zsh if [[ -r /etc/grc.zsh ]]; then source /etc/grc.zsh; fi

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
HISTFILE="$ZSH_CACHE_DIR/history" HISTFILE="$ZSH_CACHE_DIR/history"
HISTSIZE=100000 HISTSIZE=100000
SAVEHIST=500000 SAVEHIST=500000

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
declare -A ZINIT declare -A ZINIT
ZINIT[HOME_DIR]="$ZSH_CACHE_DIR/zinit" ZINIT[HOME_DIR]="$ZSH_CACHE_DIR/zinit"
ZINIT[PLUGINS_DIR]="$ZSH_CACHE_DIR/plugins" ZINIT[PLUGINS_DIR]="$ZSH_CACHE_DIR/plugins"
@ -5,12 +8,12 @@ ZINIT[SNIPPETS_DIR]="$ZSH_CACHE_DIR/snippets"
ZINIT[ZCOMPDUMP_PATH]="$ZSH_CACHE_DIR/zcompdump" ZINIT[ZCOMPDUMP_PATH]="$ZSH_CACHE_DIR/zcompdump"
ZPFX="$ZSH_CACHE_DIR/polaris" ZPFX="$ZSH_CACHE_DIR/polaris"
if [ ! -d "$ZINIT[HOME_DIR]" ]; then if [ ! -d "${ZINIT}[HOME_DIR]" ]; then
git clone --depth 1 https://github.com/zdharma-continuum/zinit "$ZINIT[HOME_DIR]" git clone --depth 1 https://github.com/zdharma-continuum/zinit "${ZINIT}[HOME_DIR]"
zcompile "$ZINIT[HOME_DIR]/zinit.zsh" zcompile "${ZINIT}[HOME_DIR]/zinit.zsh"
fi fi
source "$ZINIT[HOME_DIR]/zinit.zsh" source "${ZINIT}[HOME_DIR]/zinit.zsh"
autoload -Uz _zinit autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit (( ${+_comps} )) && _comps[zinit]=_zinit

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
zinit load willghatch/zsh-saneopt zinit load willghatch/zsh-saneopt
zinit load mafredri/zsh-async zinit load mafredri/zsh-async
@ -6,7 +9,7 @@ export ZSHZ_DATA="${ZSH_CACHE_DIR}/z"
zinit ice wait'!0' depth'1' zinit ice wait'!0' depth'1'
zinit light agkozak/zsh-z zinit light agkozak/zsh-z
if [ "$(id -u)" != "0" ] && [ -n ${DISPLAY+set} ]; then if [ "$(id -u)" != "0" ] && [[ -n ${DISPLAY+set} ]]; then
zstyle ':notify:*' expire-time 5000 zstyle ':notify:*' expire-time 5000
zstyle ':notify:*' command-complete-timeout 20 zstyle ':notify:*' command-complete-timeout 20
zstyle ':notify:*' enable-on-ssh yes zstyle ':notify:*' enable-on-ssh yes

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Copy this file to 55-agents.user.zsh and modify to your needs # Copy this file to 55-agents.user.zsh and modify to your needs
## ##
@ -13,9 +16,9 @@
## ##
if command -v gpg-agent >/dev/null 2>&1; then if command -v gpg-agent >/dev/null 2>&1; then
zinit snippet OMZP::gpg-agent zinit snippet OMZP::gpg-agent
fi if command -v gpg-conf >/dev/null 2>&1; then
if command -v gpg-conf >/dev/null 2>&1; then gpgconf --create-socketdir
gpgconf --create-socketdir fi
fi fi
## ##

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Обновление конфигурации zsh, менеджера zinit и плагинов # Обновление конфигурации zsh, менеджера zinit и плагинов
zu() { zu() {
git -C "${ZDOTDIR}" pull && zinit update --parallel git -C "${ZDOTDIR}" pull && zinit update --parallel
@ -68,7 +71,7 @@ psgrep() {
# Kills any process that matches a regexp passed to it # Kills any process that matches a regexp passed to it
killit() { killit() {
ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill ps aux | grep -v grep | grep "$@" | awk '{print $2}' | xargs sudo kill
} }
# gather external ip address # gather external ip address

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Dotdrop # Dotdrop
alias dotdrop="$HOME/etc/dotdrop.sh" --cfg="$HOME/etc/config.yaml" alias dotdrop="$HOME/etc/dotdrop.sh" --cfg="$HOME/etc/config.yaml"
@ -37,7 +40,7 @@ fi
command -v feh > /dev/null 2>&1 && alias feh="feh --cache-size 256 --version-sort --sort filename --image-bg black" command -v feh > /dev/null 2>&1 && alias feh="feh --cache-size 256 --version-sort --sort filename --image-bg black"
# Замена шрифта у заголовка окна в i3 при использовании ssh или mosh # Замена шрифта у заголовка окна в i3 при использовании ssh или mosh
if [ -n ${DISPLAY+set} ] ; then if [ ! -z ${DISPLAY+set} ] ; then
if command -v i3-msg >/dev/null 2>&1 ; then if command -v i3-msg >/dev/null 2>&1 ; then
i3-mosh () { i3-mosh () {
i3-msg -q title_format "<span foreground='#AAAAFF' font-weight='bold'>%title</span>" i3-msg -q title_format "<span foreground='#AAAAFF' font-weight='bold'>%title</span>"

View File

@ -1,7 +1,10 @@
# shellcheck shell=bash
# vim: ft=sh
# Speed up autocomplete, force prefix mapping # Speed up autocomplete, force prefix mapping
zstyle ':completion:*' accept-exact '*(N)' zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR zstyle ':completion:*' cache-path "$ZSH_CACHE_DIR"
zstyle ':completion:*:processes' command 'ps -ax' zstyle ':completion:*:processes' command 'ps -ax'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
@ -33,10 +36,10 @@ zinit wait'!0' lucid light-mode depth'1' for \
atload"!_zsh_autosuggest_start" \ atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions zsh-users/zsh-autosuggestions
if [ -n ${ZSH_MC_SUBSHELL+set} ] && [ -n ${SSH_CONNECTION+set} ]; then if [[ -n ${ZSH_MC_SUBSHELL+set} ]] && [[ -n ${SSH_CONNECTION+set} ]]; then
zinit load zsh-users/zsh-history-substring-search zinit load zsh-users/zsh-history-substring-search
else else
zstyle ":history-search-multi-word" page-size "$(($LINES/2))" zstyle ":history-search-multi-word" page-size "$((LINES/2))"
zstyle ":plugin:history-search-multi-word" clear-on-cancel "yes" zstyle ":plugin:history-search-multi-word" clear-on-cancel "yes"
zinit wait'!0' lucid light-mode depth'1' for \ zinit wait'!0' lucid light-mode depth'1' for \
zdharma-continuum/history-search-multi-word \ zdharma-continuum/history-search-multi-word \

View File

@ -1,3 +1,6 @@
# shellcheck shell=bash
# vim: ft=sh
# Defined shortcut keys: [Esc] [Esc] # Defined shortcut keys: [Esc] [Esc]
bindkey '\e\e' send-break bindkey '\e\e' send-break

View File

@ -1,9 +1,12 @@
# shellcheck shell=bash
# vim: ft=sh
if is-at-least 5.3; then if is-at-least 5.3; then
zinit ice depth"1" # git clone depth zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k zinit light romkatv/powerlevel10k
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f $ZDOTDIR/.p10k.zsh ]] || source $ZDOTDIR/.p10k.zsh [[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh"
else else
zinit load agkozak/agkozak-zsh-prompt zinit load agkozak/agkozak-zsh-prompt
fi fi

View File

@ -0,0 +1,3 @@
# shellcheck shell=bash
# vim: ft=sh