[shell-common] Cleanup tabs vs spaces

This commit is contained in:
2021-07-15 10:32:17 +01:00
parent 10e33d3133
commit b3678f700f
9 changed files with 45 additions and 47 deletions

View File

@@ -2,5 +2,3 @@
if [ -f $HOME/.bashrc ]; then if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc source $HOME/.bashrc
fi fi

View File

@@ -2,15 +2,15 @@
# Source global definitions # Source global definitions
if [ -f /etc/bashrc ]; then if [ -f /etc/bashrc ]; then
. /etc/bashrc . /etc/bashrc
fi fi
# Source shell common # Source shell common
for f in ~/.config/shell-common/*.sh; do for f in ~/.config/shell-common/*.sh; do
source $f; source $f
done done
# Source bash specific files # Source bash specific files
for f in ~/.config/bash/*.bash; do for f in ~/.config/bash/*.bash; do
source $f; source $f
done done

View File

@@ -1,2 +1,2 @@
# SSH completion based on ssh config # 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

View File

@@ -6,11 +6,11 @@ urlencode() {
LC_COLLATE=C LC_COLLATE=C
local length="${#1}" local length="${#1}"
for (( i = 0; i < length; i++ )); do for ((i = 0; i < length; i++)); do
local c="${1:i:1}" local c="${1:i:1}"
case $c in case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;; [a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c" ;; *) printf '%%%02X' "'$c" ;;
esac esac
done done

View File

@@ -1,10 +1,10 @@
# OSX aliases # OSX aliases
if [[ $(uname) == "Darwin" ]]; then if [[ $(uname) == "Darwin" ]]; then
alias ls="ls -FG" alias ls="ls -FG"
alias code="code-insiders" alias code="code-insiders"
alias flushdns="sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder" alias flushdns="sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder"
else else
alias ls="ls -F --color=auto" alias ls="ls -F --color=auto"
fi fi
alias t='(tmux has-session 2>/dev/null && tmux attach) || (tmux new-session)' alias t='(tmux has-session 2>/dev/null && tmux attach) || (tmux new-session)'

View File

@@ -8,37 +8,37 @@ export LANG=en_GB.UTF-8
# Make a sensible editor choice # Make a sensible editor choice
if [ -x /usr/bin/nano ]; then if [ -x /usr/bin/nano ]; then
export EDITOR=nano export EDITOR=nano
export VISUAL=nano export VISUAL=nano
else else
export EDITOR=vi export EDITOR=vi
export VISUAL=vi export VISUAL=vi
fi fi
# Go stuff # Go stuff
export GOPATH=$HOME/go/ export GOPATH=$HOME/go/
export PATH=${GOPATH}bin:$PATH export PATH=${GOPATH}bin:$PATH
if [ -z ${GOROOT+x} ] && [ -d /usr/local/go ]; then if [ -z ${GOROOT+x} ] && [ -d /usr/local/go ]; then
export GOROOT=/usr/local/go/ export GOROOT=/usr/local/go/
export PATH=$PATH:$HOME/go/bin export PATH=$PATH:$HOME/go/bin
fi fi
# https://github.com/oz/tz # https://github.com/oz/tz
if [ -f $HOME/go/bin/tz ]; then 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 fi
# OSX Specific envs # OSX Specific envs
if [[ $(uname) == "Darwin" ]]; then if [[ $(uname) == "Darwin" ]]; then
# M1 specific hacks # M1 specific hacks
if [[ $(uname -p) == "arm" ]]; then 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/) # 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 export GODEBUG=asyncpreemptoff=1
fi fi
# Python user bin folder # Python user bin folder
[ -d $HOME/Library/Python/3.9/bin ] && export PATH=$PATH:$HOME/Library/Python/3.9/bin [ -d $HOME/Library/Python/3.9/bin ] && export PATH=$PATH:$HOME/Library/Python/3.9/bin
# Homebrew # Homebrew
[ -d /opt/homebrew ] && eval $(/opt/homebrew/bin/brew shellenv) [ -d /opt/homebrew ] && eval $(/opt/homebrew/bin/brew shellenv)
fi fi

View File

@@ -45,7 +45,7 @@ function commit-pkm() {
if [ -d $HOME/Documents/pkm ]; then if [ -d $HOME/Documents/pkm ]; then
prevdir=$PWD prevdir=$PWD
cd ~/Documents/pkm cd ~/Documents/pkm
if [[ `git status --porcelain` ]]; then if [[ $(git status --porcelain) ]]; then
echo "Changes detected, commiting..." echo "Changes detected, commiting..."
git add -A && git commit -a -m 'Manual savepoint' git add -A && git commit -a -m 'Manual savepoint'
else else

View File

@@ -1,15 +1,15 @@
autoload -Uz compinit autoload -Uz compinit
compinit compinit
function _add-sshkey(){ function _add-sshkey() {
local -a identities local -a identities
# check for .ssh folder presence # check for .ssh folder presence
if [[ ! -d $HOME/.ssh ]]; then if [[ ! -d $HOME/.ssh ]]; then
return return
fi fi
for id in $HOME/.ssh/id_ed25519_*; do 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 [[ ${id:-3} != 'pub' ]] && identities+=$name
done done

View File

@@ -1,9 +1,9 @@
# Source shell common # Source shell common
for f in ~/.config/shell-common/*.sh; do for f in ~/.config/shell-common/*.sh; do
source $f; source $f
done done
# Source zsh specific files # Source zsh specific files
for f in ~/.config/zsh/*.zsh; do for f in ~/.config/zsh/*.zsh; do
source $f; source $f
done done