From a406bb543cf574e03105add1a194b77668305af5 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sun, 18 Sep 2022 22:13:36 +0200 Subject: [PATCH] Even even faster --- zsh/.config/zsh/.zlogout | 4 ++-- zsh/.config/zsh/.zshenv | 6 +++--- zsh/.config/zsh/.zshrc | 3 ++- zsh/.config/zsh/aliases.zsh | 10 +++++----- zsh/.config/zsh/functions.zsh | 29 +++++++++++++---------------- zsh/.config/zsh/gpg.zsh | 2 +- 6 files changed, 26 insertions(+), 28 deletions(-) diff --git a/zsh/.config/zsh/.zlogout b/zsh/.config/zsh/.zlogout index 8c724ea..917fcb2 100644 --- a/zsh/.config/zsh/.zlogout +++ b/zsh/.config/zsh/.zlogout @@ -8,6 +8,6 @@ kill_services() { pkill "^pipewire$" } -[[ $(lsb_release -si) == "Artix" ]] && [[ $(tty) == "/dev/tty1" ]] \ - && kill_services >/dev/null +[[ $(lsb_release -si) == "Artix" ]] && [[ $(tty) == "/dev/tty1" ]] && + kill_services >/dev/null unfunction kill_services diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 62a01d4..31dafa1 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -3,9 +3,9 @@ export PATH="$HOME/.local/bin:$PATH" (( ${+commands[go]} )) && export PATH="$(go env GOPATH)/bin:$PATH" # Essentials -[[ $(lsb_release -si) != "Debian" ]] && [[ $(lsb_release -si) != "Ubuntu" ]] \ - && export LANG="en_DK.UTF-8" \ - || { export LANG="en_US.UTF-8"; export TERM="xterm-256color"; } +[[ $(lsb_release -si) =~ "^Debian|Ubuntu$" ]] && + export LANG="en_DK.UTF-8" || + { export LANG="en_US.UTF-8"; export TERM="xterm-256color"; } export PAGER="less" export EDITOR="nano" (( ${+commands[vim]} )) && export EDITOR="vim" diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index f8b0deb..2b94cc4 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -17,7 +17,8 @@ static_file="$ZDOTDIR/.zsh_plugins.zsh" # Clone antidote if necessary and generate a static plugin file if [[ ! $static_file -nt $plugins_txt ]]; then - [[ -e $antidote_dir ]] || git clone --depth=1 https://github.com/mattmc3/antidote.git $antidote_dir + [[ -e $antidote_dir ]] || + git clone --depth=1 https://github.com/mattmc3/antidote.git $antidote_dir ( source $antidote_dir/antidote.zsh antidote bundle <$plugins_txt >$static_file diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh index 0a0e937..f1cdfab 100644 --- a/zsh/.config/zsh/aliases.zsh +++ b/zsh/.config/zsh/aliases.zsh @@ -37,10 +37,10 @@ alias unlock="udisksctl unlock -b" alias unmount="udisksctl unmount -b" # Misc. -(( ${+commands[tmux]} )) \ - && alias tmux="tmux -2u" -(( ${+commands[dotnet]} )) \ - && alias dnup="dotnet tool list --global | tail -n +3 | awk '{print \$1}' | xargs -l dotnet tool update --global" +(( ${+commands[tmux]} )) && + alias tmux="tmux -2u" +(( ${+commands[dotnet]} )) && + alias dnup="dotnet tool list --global | tail -n +3 | awk '{print \$1}' | xargs -l dotnet tool update --global" alias cl="clear" alias -g e="\$EDITOR" alias grep="grep --color=always" @@ -69,7 +69,7 @@ elif [[ $(lsb_release -si) == "Fedora" ]]; then alias dnfrm="sudo dnf remove" alias dnfsi="sudo dnf info" alias dnfss="sudo dnf search" -elif [[ $(lsb_release -si) == "Debian" ]] || [[ $(lsb_release -si) == "Ubuntu" ]]; then +elif [[ $(lsb_release -si) =~ "^Debian|Ubuntu$" ]]; then alias aptin="sudo apt install" alias aptqi="dpkg -s" alias aptqs="dpkg -l" diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index 6896063..d0c008f 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -2,13 +2,13 @@ bt() { (( ${+commands[bluetoothctl]} )) || return 2 if [[ $1 == on ]]; then - (( ${+commands[connmanctl]} )) \ - && connmanctl enable bluetooth \ - || bluetoothctl power on + (( ${+commands[connmanctl]} )) && + connmanctl enable bluetooth || + bluetoothctl power on elif [[ $1 == off ]]; then - (( ${+commands[connmanctl]} )) \ - && connmanctl disable bluetooth \ - || bluetoothctl power off + (( ${+commands[connmanctl]} )) && + connmanctl disable bluetooth || + bluetoothctl power off else bluetoothctl "$@" fi @@ -19,13 +19,12 @@ doasedit() { [[ $# -eq 0 ]] || return 1 doas -L - doas -u root sh -c \ - "cp /etc/doas.conf /tmp/doas.conf \ - && rvim -n /tmp/doas.conf \ - && doas -C /tmp/doas.conf \ - && mv /tmp/doas.conf /etc/doas.conf \ - && echo 'ok' \ - || echo >&2 'error'" + doas -u root sh -c "cp /etc/doas.conf /tmp/doas.conf && + rvim -n /tmp/doas.conf && + doas -C /tmp/doas.conf && + mv /tmp/doas.conf /etc/doas.conf && + echo 'ok' || + echo >&2 'error'" local STATUS=$? doas -L @@ -36,9 +35,7 @@ get_ip() { (( ${+commands[curl]} )) || return 2 while [[ $# -gt 0 ]]; do - [[ $1 == --ip ]] \ - && local IP="?ip=$2" && shift \ - || local ARGS+=("$1") + [[ $1 == --ip ]] && local IP="?ip=$2" && shift || local ARGS+=("$1") shift done diff --git a/zsh/.config/zsh/gpg.zsh b/zsh/.config/zsh/gpg.zsh index cf196e2..294ae00 100644 --- a/zsh/.config/zsh/gpg.zsh +++ b/zsh/.config/zsh/gpg.zsh @@ -1,4 +1,4 @@ -if [[ $(lsb_release -si) != "Debian" ]] && [[ $(lsb_release -si) != "Ubuntu" ]]; then +if [[ $(lsb_release -si) =~ "^Debian|Ubuntu$" ]]; then export GPG_TTY="$TTY" export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent