Use GNU stow to manage symlinks
This commit is contained in:
parent
e395c6d49b
commit
4e5e48c64a
19 changed files with 13 additions and 30 deletions
100
zsh/.aliases
Normal file
100
zsh/.aliases
Normal file
|
@ -0,0 +1,100 @@
|
|||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias a="ls -l --human-readable --all --color=auto"
|
||||
alias agc="ag-count"
|
||||
alias agh="ag --hidden"
|
||||
alias awsp="aws-profile"
|
||||
alias b="bundle"
|
||||
alias be="bundle exec"
|
||||
alias bea="bundle exec rails"
|
||||
alias ber="bundle exec rake"
|
||||
alias bet="test-rails"
|
||||
alias betd="bundle exec rspec --format documentation"
|
||||
alias c="clear"
|
||||
alias dc="docker-compose"
|
||||
alias dft="docker run --rm --privileged alpine hwclock -s"
|
||||
alias g="g" # overwrite g alias in git plugin so function will work
|
||||
alias ga="git add"
|
||||
alias gaa="git add --all"
|
||||
alias gap="git add --patch"
|
||||
alias gb="git branch"
|
||||
alias gbc="git branch --merged master | grep -v master | xargs git branch -d"
|
||||
alias gbda="git branch | grep -v master | xargs git branch -D"
|
||||
alias gbdm='git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'
|
||||
alias gc="git commit"
|
||||
alias gca="git commit --amend"
|
||||
alias gcm="echo Do not specify message at command line. Use gc"
|
||||
alias gco="git checkout"
|
||||
alias gcp="git cherry-pick"
|
||||
alias gcs="git commit -m '¯\_(ツ)_/¯'"
|
||||
alias gct="git commit -m '( ͡° ͜ʖ ͡°)'"
|
||||
alias gd="git diff"
|
||||
alias gdc="git diff --cached"
|
||||
alias gds="git diff --stat"
|
||||
alias gdss="git diff --shortstat"
|
||||
alias gfa="git-date-added"
|
||||
alias gfl="git log --patch"
|
||||
alias gg="hub gist create --browse"
|
||||
alias gi="gitignore-io"
|
||||
alias gl="git fancy-graph"
|
||||
alias ghi="git hist"
|
||||
alias ghd="git hist-details"
|
||||
alias ght="git hist-tags"
|
||||
alias gmr="git most-recent-by-branch"
|
||||
alias gp="git push"
|
||||
alias gpf="git push --force"
|
||||
alias gpl="git pull"
|
||||
alias gpo="git push -u origin"
|
||||
alias gpu="git push -u upstream"
|
||||
alias gr="git reset"
|
||||
alias grb="git rebase"
|
||||
alias grba="git rebase --abort"
|
||||
alias grbc="git rebase --continue"
|
||||
alias grbi="git rebase --interactive"
|
||||
alias grc="git rm --cached"
|
||||
alias grh="git reset --hard"
|
||||
alias grm="git rm"
|
||||
alias gs="git status"
|
||||
alias gu="git undo"
|
||||
alias gup="git branch --merged | egrep -v '(^\*|master|dev)' | xargs git branch -d"
|
||||
alias gw="git diff --check"
|
||||
alias Grep='grep'
|
||||
alias h='heroku'
|
||||
alias hp='git push heroku master'
|
||||
alias hip='heroku logs -n 1500 | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" | sort | uniq'
|
||||
alias l="ls"
|
||||
alias ll="ls -lv --human-readable --color=auto"
|
||||
alias ls="ls --color=auto"
|
||||
alias m="more"
|
||||
alias md="cd ~/dotfiles > /dev/null 2>&1; make; cd -1 > /dev/null 2>&1"
|
||||
alias mf="mkdir"
|
||||
alias mh="tmux new-session -A -s home"
|
||||
alias mt="tmuxinator"
|
||||
alias mw="tmux new-session -A -s work"
|
||||
alias ne="npm-exec"
|
||||
alias pf="port-forward"
|
||||
alias pwdgen="password-generator"
|
||||
alias r="ssh"
|
||||
alias rc="bin/ctrl"
|
||||
alias rd="popd"
|
||||
alias s="cd ~/Source"
|
||||
alias sci="ssh-copy-id -i .ssh/id_rsa.pub"
|
||||
alias sd="pwd | pushd"
|
||||
alias sw="stopwatch"
|
||||
alias sz="source ~/.zshrc"
|
||||
alias pf="port-forward"
|
||||
alias t="tmux new-session -A -s"
|
||||
alias tf="terraform"
|
||||
alias tls="tmux list-sessions"
|
||||
alias ts="tmuxinator start"
|
||||
alias v="$EDITOR"
|
||||
alias w="ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'"
|
||||
alias wo="curl 'http://wttr.in/48823'"
|
||||
alias y="yarn"
|
||||
alias ya="yarn add"
|
||||
alias yad="yarn add --dev"
|
||||
alias ye="yarn-exec"
|
||||
alias yi="yarn-install-like-bundle"
|
||||
alias x="exit"
|
3
zsh/.aliases-mac
Normal file
3
zsh/.aliases-mac
Normal file
|
@ -0,0 +1,3 @@
|
|||
alias google-chrome="open -a Google\ Chrome"
|
||||
alias fixbar="killall ControlStrip"
|
||||
alias subl="reattach-to-user-namespace subl"
|
140
zsh/.functions
Normal file
140
zsh/.functions
Normal file
|
@ -0,0 +1,140 @@
|
|||
function aws-profile {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current AWS Profile: $AWS_DEFAULT_PROFILE
|
||||
else
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
fi
|
||||
}
|
||||
|
||||
function aet-bin-exec {
|
||||
local readonly script=$1; shift
|
||||
|
||||
./aet-bin/$script $@
|
||||
}
|
||||
|
||||
function fix-permissions {
|
||||
find . -type d -print0 | xargs -0 chmod 0755
|
||||
find . -type f -print0 | xargs -0 chmod 0644
|
||||
}
|
||||
|
||||
function g {
|
||||
if [[ $# > 0 ]]; then
|
||||
git $@
|
||||
else
|
||||
git status
|
||||
fi
|
||||
}
|
||||
|
||||
function insert-sudo {
|
||||
zle beginning-of-line
|
||||
zle -U "sudo "
|
||||
}
|
||||
|
||||
function true-colors {
|
||||
awk 'BEGIN{
|
||||
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
|
||||
for (colnum = 0; colnum<77; colnum++) {
|
||||
r = 255-(colnum*255/76);
|
||||
g = (colnum*510/76);
|
||||
b = (colnum*255/76);
|
||||
if (g>255) g = 510-g;
|
||||
printf "\033[48;2;%d;%d;%dm", r,g,b;
|
||||
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
|
||||
printf "%s\033[0m", substr(s,colnum+1,1);
|
||||
}
|
||||
printf "\n";
|
||||
}'
|
||||
}
|
||||
|
||||
function port-forward {
|
||||
if [ $# -lt 2 ]; then
|
||||
echo Usage: port-forward HOST LOCAL_PORT \[REMOTE_PORT\]
|
||||
else
|
||||
ssh $1 -R ${3:-$2}":localhost:"$2 -g
|
||||
fi
|
||||
}
|
||||
|
||||
function gitignore-io {
|
||||
curl https://www.gitignore.io/api/$@
|
||||
}
|
||||
|
||||
function git-date-added {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Usage: git-date-added FILENAME
|
||||
else
|
||||
git log --format=%aD $1 | tail -1
|
||||
fi
|
||||
}
|
||||
|
||||
function run {
|
||||
if [ $# -lt 2 ]; then
|
||||
echo Usage: run NUMBER COMMAND
|
||||
else
|
||||
number=$1; shift
|
||||
|
||||
for i in `seq $number`; do
|
||||
eval "$@"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function npm-exec {
|
||||
(PATH=$(npm bin):$PATH; eval $@;)
|
||||
}
|
||||
|
||||
function password-generator {
|
||||
if [ -x "$(command -v openssl)" ]; then
|
||||
password=$(
|
||||
openssl rand -base64 32 \
|
||||
| head -c 32
|
||||
)
|
||||
else
|
||||
password=$(
|
||||
date +%s \
|
||||
| sha256sum \
|
||||
| base64 \
|
||||
| head -c 32
|
||||
)
|
||||
fi
|
||||
|
||||
echo $password
|
||||
}
|
||||
|
||||
function stopwatch {
|
||||
date1=`date +%s`
|
||||
while true; do
|
||||
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r"
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
function test-rails {
|
||||
if bundle exec rspec --help > /dev/null 2>&1; then
|
||||
bundle exec rspec $@
|
||||
else
|
||||
bundle exec rails test $@
|
||||
fi
|
||||
}
|
||||
|
||||
function yarn-exec {
|
||||
(PATH=$(yarn bin):$PATH; eval $@;)
|
||||
}
|
||||
|
||||
function yarn-install-like-bundle {
|
||||
if [ -f yarn.lock ]; then
|
||||
yarn install --pure-lockfile
|
||||
else
|
||||
yarn install
|
||||
fi
|
||||
}
|
||||
|
||||
function ag-count {
|
||||
if [ $# -lt 1 ]; then
|
||||
echo Usage: ag-count SEARCHTERM
|
||||
else
|
||||
searchterm=$1; shift
|
||||
|
||||
ag --stats $searchterm | tail -n5
|
||||
fi
|
||||
}
|
17
zsh/.zsh-completions/_comma
Normal file
17
zsh/.zsh-completions/_comma
Normal file
|
@ -0,0 +1,17 @@
|
|||
#compdef ,
|
||||
local bin_dir="aet-bin"
|
||||
local found_bin_dir=""
|
||||
|
||||
current_dir=$(pwd)
|
||||
found_bin_dir=$current_dir/$bin_dir
|
||||
while [ ! -d $found_bin_dir ]; do
|
||||
if [[ $current_dir == $HOME ]]; then
|
||||
found_bin_dir=$HOME/bin
|
||||
break
|
||||
fi
|
||||
|
||||
current_dir=$(realpath "$current_dir/..")
|
||||
found_bin_dir=$current_dir/$bin_dir
|
||||
done
|
||||
|
||||
_files -g "^," -W $found_bin_dir
|
45
zsh/.zshenv
Normal file
45
zsh/.zshenv
Normal file
|
@ -0,0 +1,45 @@
|
|||
LOCAL_SBIN_PATH="/usr/local/sbin"
|
||||
PERSONAL_BIN_PATH="$HOME/bin"
|
||||
LOCAL_HOME_BIN_PATH="$HOME/.local/bin"
|
||||
RBENV_PATH="$HOME/.rbenv/bin"
|
||||
GNU_TOOLS_PATH="/usr/local/opt/coreutils/libexec/gnubin"
|
||||
GNU_TOOLS_MAN_PATH="/usr/local/opt/coreutils/libexec/gnuman"
|
||||
APACHE_MAVEN_PATH="$HOME/bin/apache-maven-3.3.9/bin"
|
||||
GO_HOME_PATH="$HOME/go-workspace/bin"
|
||||
NODENV_PATH="$HOME/.nodenv/bin"
|
||||
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
GO_DIR="/usr/local/opt/go/libexec"
|
||||
else
|
||||
GO_DIR="/usr/local/go/bin"
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
NVM_DIR="/usr/local/opt/nvm"
|
||||
else
|
||||
NVM_DIR="/home/atomaka/.nvm"
|
||||
fi
|
||||
|
||||
# BIN
|
||||
[[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH"
|
||||
[[ -d "$RBENV_PATH" ]] && PATH="$RBENV_PATH:$PATH"
|
||||
[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH"
|
||||
[[ -d "$APACHE_MAVEN_PATH" ]] && PATH="$APACHE_MAVEN_PATH:$PATH"
|
||||
[[ -d "$GO_DIR" ]] && PATH="$GO_DIR:$PATH"
|
||||
[[ -d "$LOCAL_SBIN_PATH" ]] && PATH="$LOCAL_SBIN_PATH:$PATH"
|
||||
[[ -d "$GO_HOME_PATH" ]] && PATH="$GO_HOME_PATH:$PATH"
|
||||
[[ -d "$LOCAL_HOME_BIN_PATH" ]] && PATH="$LOCAL_HOME_BIN_PATH:$PATH"
|
||||
[[ -d "$NODENV_PATH" ]] && PATH="$NODENV_PATH:$PATH"
|
||||
|
||||
# MAN
|
||||
[[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH"
|
||||
|
||||
# EDITOR
|
||||
if [[ -x "$(command -v nvim)" ]]; then
|
||||
export {EDITOR,GIT_EDITOR}=nvim
|
||||
else
|
||||
export {EDITOR,GIT_EDITOR}=vim
|
||||
fi
|
||||
|
||||
|
||||
export GOPATH="$HOME/go-workspace/"
|
70
zsh/.zshrc
Normal file
70
zsh/.zshrc
Normal file
|
@ -0,0 +1,70 @@
|
|||
[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH"
|
||||
[[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH"
|
||||
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
|
||||
# clean up duplicate paths
|
||||
typeset -U PATH
|
||||
|
||||
# Larger history
|
||||
HISTSIZE=20000
|
||||
HISTFILE=~/.zsh_history
|
||||
SAVEHIST=20000
|
||||
|
||||
# Make sure C-s works in vim
|
||||
stty start undef
|
||||
stty stop undef
|
||||
|
||||
# Aliases/Functions files
|
||||
source $HOME/.aliases
|
||||
source $HOME/.functions
|
||||
|
||||
source $HOME/.zsh/prompt
|
||||
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
source $HOME/.aliases-mac
|
||||
fi
|
||||
|
||||
# Bind insert_sudo function
|
||||
zle -N insert-sudo
|
||||
bindkey "^z" insert-sudo
|
||||
|
||||
# init rbenv
|
||||
if which rbenv > /dev/null; then
|
||||
eval "$(rbenv init --no-rehash -)"
|
||||
(rbenv rehash &) 2> /dev/null
|
||||
fi
|
||||
|
||||
# # init nodenv
|
||||
if which nodenv > /dev/null; then
|
||||
eval "$(nodenv init --no-rehash -)"
|
||||
(nodenv rehash &) 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ -d $HOME/.asdf ]; then
|
||||
source $HOME/.asdf/asdf.sh
|
||||
fi
|
||||
. ~/.asdf/plugins/java/set-java-home.zsh
|
||||
|
||||
# init direnv
|
||||
if which direnv > /dev/null; then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
|
||||
# completion
|
||||
fpath=($HOME/.zsh-completions $fpath)
|
||||
autoload -U compinit
|
||||
autoload bashcompinit && bashcompinit
|
||||
compinit
|
||||
setopt completeinword
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
||||
|
||||
# directory
|
||||
setopt auto_cd
|
||||
|
||||
# better word definition
|
||||
autoload -U select-word-style
|
||||
select-word-style bash
|
||||
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
Loading…
Add table
Add a link
Reference in a new issue