Completely reset dotfiles (#2)
This commit is contained in:
parent
4abd1a6ffc
commit
bf26003ab3
38 changed files with 305 additions and 1101 deletions
32
zsh/.config/zsh/.zshrc
Normal file
32
zsh/.config/zsh/.zshrc
Normal file
|
@ -0,0 +1,32 @@
|
|||
typeset -U PATH
|
||||
|
||||
source $ZDOTDIR/aliases
|
||||
source $ZDOTDIR/functions
|
||||
|
||||
source $ZDOTDIR/prompt
|
||||
|
||||
# Larger history
|
||||
HISTSIZE=20000
|
||||
HISTFILE=~/.zsh_history
|
||||
SAVEHIST=20000
|
||||
|
||||
# be like vim
|
||||
bindkey -v
|
||||
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
||||
|
||||
setopt auto_cd
|
||||
|
||||
if which direnv > /dev/null; then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
|
||||
if which rbenv > /dev/null; then
|
||||
eval "$(rbenv init --no-rehash -)"
|
||||
(rbenv rehash &) 2> /dev/null
|
||||
fi
|
||||
|
||||
if which nodenv > /dev/null; then
|
||||
eval "$(nodenv init --no-rehash -)"
|
||||
(nodenv rehash &) 2> /dev/null
|
||||
fi
|
67
zsh/.config/zsh/aliases
Normal file
67
zsh/.config/zsh/aliases
Normal file
|
@ -0,0 +1,67 @@
|
|||
alias ..="cd .."
|
||||
alias a="ls -l --human-readable --all --color=auto"
|
||||
alias agc="ag-count"
|
||||
alias agh="ag --hidden"
|
||||
alias awsi="aws sts get-caller-identity"
|
||||
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 c="clear"
|
||||
alias cs="toggle-color-mode"
|
||||
alias dc="docker-compose-call"
|
||||
alias g="g" # overwrite g alias
|
||||
alias ga="git add"
|
||||
alias gaa="git add --all"
|
||||
alias gap="git add --patch"
|
||||
alias gb="git branch"
|
||||
alias gc="git commit"
|
||||
alias gca="git commit --amend"
|
||||
alias gcn="git commit --allow-empty --message 'noop'"
|
||||
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 gfa="git-date-added"
|
||||
alias gl="git fancy-graph"
|
||||
alias ghi="git hist"
|
||||
alias ghd="git hist-details"
|
||||
alias ght="git hist-tags"
|
||||
alias gm="git merge"
|
||||
alias gma="git merge --abort"
|
||||
alias gmc="git merge --continue"
|
||||
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 gup="git-branch-delete-merged"
|
||||
alias Grep='grep'
|
||||
alias l="ls"
|
||||
alias ll="ls -lv --human-readable --color=auto"
|
||||
alias ls="ls --color=auto"
|
||||
alias m="more"
|
||||
alias mf="mkdir"
|
||||
alias mw="tmux attach || tmux -f $HOME/.config/tmux/tmux.conf"
|
||||
alias pwdgen="password-generator"
|
||||
alias s="cd ~/Source"
|
||||
alias sz="source $ZDOTDIR/.zshrc"
|
||||
alias tf="terraform"
|
||||
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 x="exit"
|
78
zsh/.config/zsh/functions
Normal file
78
zsh/.config/zsh/functions
Normal file
|
@ -0,0 +1,78 @@
|
|||
function ag-count {
|
||||
if [ $# -lt 1 ]; then
|
||||
echo Usage: ag-count SEARCHTERM
|
||||
else
|
||||
searchterm=$1; shift
|
||||
|
||||
ag --stats $searchterm | tail -n5
|
||||
fi
|
||||
}
|
||||
|
||||
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 docker-compose-call {
|
||||
if docker compose > /dev/null 2>&1; then
|
||||
docker compose $@
|
||||
else
|
||||
docker-compose $@
|
||||
fi
|
||||
}
|
||||
|
||||
function g {
|
||||
if [[ $# > 0 ]]; then
|
||||
git $@
|
||||
else
|
||||
git status
|
||||
fi
|
||||
}
|
||||
|
||||
function git-date-added {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Usage: git-date-added FILENAME
|
||||
else
|
||||
git log --format=%aD $1 | tail -1
|
||||
fi
|
||||
}
|
||||
|
||||
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 test-rails {
|
||||
if bundle exec rspec --help > /dev/null 2>&1; then
|
||||
if [ -d spec ]; then
|
||||
bundle exec rspec $@
|
||||
else
|
||||
ruby *_test.rb
|
||||
fi
|
||||
elif bundle exec rails version > /dev/null 2>&1; then
|
||||
bundle exec rails test $@
|
||||
else
|
||||
if [[ $# > 0 ]]; then
|
||||
ruby $@
|
||||
else
|
||||
ruby *_test.rb
|
||||
fi
|
||||
fi
|
||||
}
|
4
zsh/.config/zsh/prompt
Normal file
4
zsh/.config/zsh/prompt
Normal file
|
@ -0,0 +1,4 @@
|
|||
local current_dir='%~%f'
|
||||
local result="%B%(?.%F{green}✓%b.%F{red}✗)%b%f"
|
||||
|
||||
PROMPT="${current_dir} ${result} "
|
Loading…
Add table
Add a link
Reference in a new issue