From b3678f700f0eadc1e66f2f20d5159aa79711608d Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 15 Jul 2021 10:32:17 +0100 Subject: [PATCH] [shell-common] Cleanup tabs vs spaces --- bash/.bash_profile | 2 -- bash/.bashrc | 10 +++--- bash/.config/bash/completions.bash | 2 +- bin/bin/weather | 10 +++--- shell-common/.config/shell-common/aliases.sh | 8 ++--- shell-common/.config/shell-common/exports.sh | 34 +++++++++---------- .../.config/shell-common/functions.sh | 2 +- zsh/.config/zsh/completions.zsh | 16 ++++----- zsh/.zshrc | 8 ++--- 9 files changed, 45 insertions(+), 47 deletions(-) diff --git a/bash/.bash_profile b/bash/.bash_profile index 3e97415..0678957 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -2,5 +2,3 @@ if [ -f $HOME/.bashrc ]; then source $HOME/.bashrc fi - - diff --git a/bash/.bashrc b/bash/.bashrc index 5392d7f..bdc0162 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -2,15 +2,15 @@ # Source global definitions if [ -f /etc/bashrc ]; then - . /etc/bashrc + . /etc/bashrc fi # Source shell common -for f in ~/.config/shell-common/*.sh; do - source $f; +for f in ~/.config/shell-common/*.sh; do + source $f done # Source bash specific files -for f in ~/.config/bash/*.bash; do - source $f; +for f in ~/.config/bash/*.bash; do + source $f done diff --git a/bash/.config/bash/completions.bash b/bash/.config/bash/completions.bash index b1b6589..d8f5280 100644 --- a/bash/.config/bash/completions.bash +++ b/bash/.config/bash/completions.bash @@ -1,2 +1,2 @@ # SSH completion based on ssh config -[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config* | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; +[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config* | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh diff --git a/bin/bin/weather b/bin/bin/weather index 8a6d851..4236519 100755 --- a/bin/bin/weather +++ b/bin/bin/weather @@ -4,16 +4,16 @@ urlencode() { # urlencode old_lc_collate=$LC_COLLATE LC_COLLATE=C - + local length="${#1}" - for (( i = 0; i < length; i++ )); do + for ((i = 0; i < length; i++)); do local c="${1:i:1}" case $c in - [a-zA-Z0-9.~_-]) printf "$c" ;; - *) printf '%%%02X' "'$c" ;; + [a-zA-Z0-9.~_-]) printf "$c" ;; + *) printf '%%%02X' "'$c" ;; esac done - + LC_COLLATE=$old_lc_collate } diff --git a/shell-common/.config/shell-common/aliases.sh b/shell-common/.config/shell-common/aliases.sh index b3acaa9..4e754d9 100644 --- a/shell-common/.config/shell-common/aliases.sh +++ b/shell-common/.config/shell-common/aliases.sh @@ -1,12 +1,12 @@ # OSX aliases if [[ $(uname) == "Darwin" ]]; then - alias ls="ls -FG" - alias code="code-insiders" + alias ls="ls -FG" + alias code="code-insiders" alias flushdns="sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder" else - alias ls="ls -F --color=auto" + alias ls="ls -F --color=auto" fi alias t='(tmux has-session 2>/dev/null && tmux attach) || (tmux new-session)' alias tma="tmux attach" -alias last="last | head" \ No newline at end of file +alias last="last | head" diff --git a/shell-common/.config/shell-common/exports.sh b/shell-common/.config/shell-common/exports.sh index 38f67ea..21863ae 100644 --- a/shell-common/.config/shell-common/exports.sh +++ b/shell-common/.config/shell-common/exports.sh @@ -8,37 +8,37 @@ export LANG=en_GB.UTF-8 # Make a sensible editor choice if [ -x /usr/bin/nano ]; then - export EDITOR=nano - export VISUAL=nano + export EDITOR=nano + export VISUAL=nano else - export EDITOR=vi - export VISUAL=vi + export EDITOR=vi + export VISUAL=vi fi # Go stuff export GOPATH=$HOME/go/ export PATH=${GOPATH}bin:$PATH if [ -z ${GOROOT+x} ] && [ -d /usr/local/go ]; then - export GOROOT=/usr/local/go/ - export PATH=$PATH:$HOME/go/bin + export GOROOT=/usr/local/go/ + export PATH=$PATH:$HOME/go/bin fi # https://github.com/oz/tz if [ -f $HOME/go/bin/tz ]; then - export TZ_LIST="America/New_York,America/Los_Angeles,Europe/Paris" + export TZ_LIST="America/New_York,America/Los_Angeles,Europe/Paris" fi # OSX Specific envs if [[ $(uname) == "Darwin" ]]; then - # M1 specific hacks - if [[ $(uname -p) == "arm" ]]; then - # Stop golang progs having fun with Rosetta 2 (https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/) - export GODEBUG=asyncpreemptoff=1 - fi + # M1 specific hacks + if [[ $(uname -p) == "arm" ]]; then + # Stop golang progs having fun with Rosetta 2 (https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/) + export GODEBUG=asyncpreemptoff=1 + fi - # Python user bin folder - [ -d $HOME/Library/Python/3.9/bin ] && export PATH=$PATH:$HOME/Library/Python/3.9/bin - - # Homebrew - [ -d /opt/homebrew ] && eval $(/opt/homebrew/bin/brew shellenv) + # Python user bin folder + [ -d $HOME/Library/Python/3.9/bin ] && export PATH=$PATH:$HOME/Library/Python/3.9/bin + + # Homebrew + [ -d /opt/homebrew ] && eval $(/opt/homebrew/bin/brew shellenv) fi diff --git a/shell-common/.config/shell-common/functions.sh b/shell-common/.config/shell-common/functions.sh index ae50514..493443f 100644 --- a/shell-common/.config/shell-common/functions.sh +++ b/shell-common/.config/shell-common/functions.sh @@ -45,7 +45,7 @@ function commit-pkm() { if [ -d $HOME/Documents/pkm ]; then prevdir=$PWD cd ~/Documents/pkm - if [[ `git status --porcelain` ]]; then + if [[ $(git status --porcelain) ]]; then echo "Changes detected, commiting..." git add -A && git commit -a -m 'Manual savepoint' else diff --git a/zsh/.config/zsh/completions.zsh b/zsh/.config/zsh/completions.zsh index 34dd0cf..711fe09 100644 --- a/zsh/.config/zsh/completions.zsh +++ b/zsh/.config/zsh/completions.zsh @@ -1,18 +1,18 @@ autoload -Uz compinit compinit -function _add-sshkey(){ +function _add-sshkey() { local -a identities - # check for .ssh folder presence - if [[ ! -d $HOME/.ssh ]]; then - return - fi + # check for .ssh folder presence + if [[ ! -d $HOME/.ssh ]]; then + return + fi for id in $HOME/.ssh/id_ed25519_*; do - name=$(basename $id|cut -d'_' -f3|cut -d'.' -f1) + name=$(basename $id | cut -d'_' -f3 | cut -d'.' -f1) [[ ${id:-3} != 'pub' ]] && identities+=$name done - compadd $identities + compadd $identities } -compdef _add-sshkey add-sshkey \ No newline at end of file +compdef _add-sshkey add-sshkey diff --git a/zsh/.zshrc b/zsh/.zshrc index 35b4f98..e1224b5 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,9 +1,9 @@ # Source shell common -for f in ~/.config/shell-common/*.sh; do - source $f; +for f in ~/.config/shell-common/*.sh; do + source $f done # Source zsh specific files -for f in ~/.config/zsh/*.zsh; do - source $f; +for f in ~/.config/zsh/*.zsh; do + source $f done