mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-11 08:42:25 +00:00
[shell-common] Cleanup tabs vs spaces
This commit is contained in:
@@ -2,5 +2,3 @@
|
||||
if [ -f $HOME/.bashrc ]; then
|
||||
source $HOME/.bashrc
|
||||
fi
|
||||
|
||||
|
||||
|
||||
10
bash/.bashrc
10
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,16 +4,16 @@ urlencode() {
|
||||
# urlencode <string>
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
alias last="last | head"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
compdef _add-sshkey add-sshkey
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user