Clean up zsh/bash rcfiles
This commit is contained in:
parent
c216de9b26
commit
c61b2167d6
64
bash/aliases
64
bash/aliases
|
@ -3,6 +3,11 @@
|
|||
alias q='exit'
|
||||
alias clr='clear'
|
||||
alias catn='cat -n' # cat + line numbers
|
||||
# Allow sudo with aliases
|
||||
alias sudo='sudo '
|
||||
alias ls='ls -G'
|
||||
alias l='ls -o'
|
||||
alias la='ls -AGFoh'
|
||||
|
||||
# Command fixes
|
||||
alias ln="${aliases[ln]:-ln} -v" # verbose ln
|
||||
|
@ -10,8 +15,8 @@ alias wget='wget -c' # Resume download if possible
|
|||
alias rsyncd='rsync -va --delete' # Hard sync two directories
|
||||
|
||||
# Shortcut for git
|
||||
alias g=git
|
||||
is-callable 'hub' && alias git='hub'
|
||||
is-callable hub && alias git='hub'
|
||||
g() { [ $# -eq 0 ] && git status --short || git $* }
|
||||
|
||||
alias gi='git init'
|
||||
alias ga='git add'
|
||||
|
@ -45,51 +50,6 @@ if is-callable 'tmux'; then
|
|||
alias tn='tmux new-session -t "x"'
|
||||
fi
|
||||
|
||||
# OS-specific aliases
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
alias codekit='open -a CodeKit'
|
||||
alias br='brew'
|
||||
alias bru='brew update && brew upgrade'
|
||||
|
||||
function v {
|
||||
[ $# -eq 0 ] && vim . || vim $@
|
||||
}
|
||||
|
||||
unalias e # get rid of prezto's alias
|
||||
function e {
|
||||
[ -z "$@" ] && input="." || input=$@
|
||||
emacsclient -n $input
|
||||
}
|
||||
function et {
|
||||
[ -z "$@" ] && input="." || input=$@
|
||||
emacsclient -nw $input
|
||||
}
|
||||
|
||||
alias c11='clang++ -std=c++11 -stdlib=libc++'
|
||||
alias eclimd='/Applications/eclipse/eclimd'
|
||||
else
|
||||
alias ipt='sudo iptables'
|
||||
fi
|
||||
|
||||
# transmission-remote
|
||||
if is-callable 'transmission-remote'; then
|
||||
alias bt='transmission-remote server'
|
||||
|
||||
# pretty print torrent list on remote server
|
||||
function btl {
|
||||
results=`transmission-remote server -l | \
|
||||
awk 'NR > 1 { s = ""; for (i = 10; i <= NF; i++) s = s $i " "; print $9 " | " s }' | \
|
||||
sed '$d' | \
|
||||
perl -pe 's/\s\[[a-zA-Z0-9]+\]\s/ /g'`
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
echo "No torrents!"
|
||||
else
|
||||
echo $results
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
alias va='vagrant'
|
||||
alias rk='rake'
|
||||
alias rkg='rake -g'
|
||||
|
@ -104,13 +64,3 @@ alias bi='bundle install --path vendor'
|
|||
alias py='python'
|
||||
alias pye='pyenv'
|
||||
alias pyi='ipython'
|
||||
|
||||
# Bash-only aliases
|
||||
if [ -z "$ZSH_VERSION" ]; then
|
||||
# Allow sudo with aliases
|
||||
alias sudo='sudo '
|
||||
|
||||
alias ls='ls -G'
|
||||
alias l='ls -o'
|
||||
alias la='ls -AGFoh'
|
||||
fi
|
||||
|
|
47
zprofile
47
zprofile
|
@ -1,7 +1,7 @@
|
|||
# Executes commands at login pre-zshrc.
|
||||
|
||||
# Browser
|
||||
[[ "$OSTYPE" == darwin* ]] && export BROWSER='open'
|
||||
export BROWSER='open'
|
||||
|
||||
## Editors
|
||||
export EDITOR='vim'
|
||||
|
@ -19,30 +19,6 @@ if (( $+commands[lesspipe] )); then
|
|||
export LESSOPEN='| /usr/bin/env lesspipe %s 2>&-'
|
||||
fi
|
||||
|
||||
## Language
|
||||
if [[ -z "$LANG" ]]; then
|
||||
export LANG='en_US.UTF-8'
|
||||
fi
|
||||
|
||||
## Paths
|
||||
# Ensure path arrays do not contain duplicates.
|
||||
typeset -gU cdpath fpath mailpath path
|
||||
|
||||
# Set the list of directories that Zsh searches for programs.
|
||||
path=(
|
||||
$HOME/.{py,rb}env/bin
|
||||
$HOME/.dotfiles/bin
|
||||
/usr/local/{bin,sbin}
|
||||
/usr/{bin,sbin}
|
||||
/{bin,sbin}
|
||||
)
|
||||
[[ "$OSTYPE" == darwin* ]] && path+="/usr/X11/bin"
|
||||
|
||||
fpath=(
|
||||
$HOME/.zsh/functions
|
||||
$fpath
|
||||
)
|
||||
|
||||
# Temporary Files
|
||||
if [[ ! -d "$TMPDIR" ]]; then
|
||||
export TMPDIR="/tmp/$USER"
|
||||
|
@ -51,3 +27,24 @@ fi
|
|||
|
||||
TMPPREFIX="${TMPDIR%/}/zsh"
|
||||
[[ ! -d "$TMPPREFIX" ]] && mkdir -p "$TMPPREFIX"
|
||||
|
||||
## Language
|
||||
[[ -z "$LANG" ]] && export LANG='en_US.UTF-8'
|
||||
|
||||
## Paths
|
||||
# Ensure path arrays do not contain duplicates.
|
||||
typeset -gU cdpath fpath mailpath path
|
||||
|
||||
# Set the list of directories that Zsh searches for programs.
|
||||
path=(
|
||||
$HOME/.dotfiles/bin
|
||||
/usr/local/{bin,sbin}
|
||||
/usr/{bin,sbin}
|
||||
/{bin,sbin}
|
||||
)
|
||||
|
||||
fpath=(
|
||||
$HOME/.zsh/prompts
|
||||
$HOME/.zsh/completion
|
||||
$fpath
|
||||
)
|
||||
|
|
99
zsh/aliases
99
zsh/aliases
|
@ -1,16 +1,93 @@
|
|||
#!/bin/zsh
|
||||
# ZSH-specific aliases. Find the rest in ~/.bash/aliases
|
||||
|
||||
source ~/.bash/aliases
|
||||
|
||||
# GIT
|
||||
alias ag='nocorrect noglob ag'
|
||||
alias rk='noglob rake'
|
||||
alias rkg='noglob rake -g'
|
||||
alias rename='noglob rename'
|
||||
|
||||
export p=~/Dropbox/projects
|
||||
|
||||
zman() {
|
||||
PAGER="less -g -s '+/^ "$1"'" man zshall
|
||||
alias q=exit
|
||||
alias clr=clear
|
||||
alias sudo='sudo '
|
||||
|
||||
# Homebrew
|
||||
alias br='brew'
|
||||
alias bru='brew update'
|
||||
|
||||
# Tools
|
||||
alias codekit='open -a CodeKit'
|
||||
alias ag='nocorrect noglob ag'
|
||||
alias rk='noglob rake'
|
||||
alias rkg='noglob rake -g'
|
||||
alias ln="${aliases[ln]:-ln} -v" # Verbose ln
|
||||
alias wget='wget -c' # Resume dl if possible
|
||||
alias rsyncd='rsync -va --delete' # Hard sync two directories
|
||||
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
|
||||
|
||||
# transmission-remote
|
||||
if is-callable 'transmission-remote'; then
|
||||
alias bt='transmission-remote server'
|
||||
|
||||
# pretty print torrent list on remote server
|
||||
function btl {
|
||||
results=`transmission-remote server -l | \
|
||||
awk 'NR > 1 { s = ""; for (i = 10; i <= NF; i++) s = s $i " "; print $9 " | " s }' | \
|
||||
sed '$d' | \
|
||||
perl -pe 's/\s\[[a-zA-Z0-9]+\]\s/ /g'`
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
echo "No torrents!"
|
||||
else
|
||||
echo $results
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Editors
|
||||
unalias e
|
||||
v() { [ $# -eq 0 ] && vim . || vim $@ }
|
||||
e() { # emacs
|
||||
[ $# -eq 0 ] && input=$@
|
||||
emacsclient -n ${input:-.}
|
||||
}
|
||||
|
||||
# Compilers 'n interpretors
|
||||
alias va='vagrant'
|
||||
alias py='python'
|
||||
alias pye='pyenv'
|
||||
alias pip='sudo pip'
|
||||
alias rb='ruby'
|
||||
alias rbe='rbenv'
|
||||
alias b='bundle'
|
||||
alias be='bundle exec'
|
||||
alias bi='bundle install -path vendor'
|
||||
|
||||
alias c11='clang++ -std=c++11 -stdlib=libc++'
|
||||
alias eclimd='/Applications/eclipse/eclimd'
|
||||
|
||||
# GIT
|
||||
is-callable 'hub' && alias git='hub'
|
||||
g() { [ $# -eq 0 ] && git status --short || git $* }
|
||||
|
||||
alias gi='git init'
|
||||
alias gs='git status'
|
||||
alias gco='git checkout'
|
||||
alias gc='git commit'
|
||||
alias gcm='noglob git commit -m'
|
||||
alias gc='git diff'
|
||||
alias gp='git push'
|
||||
alias gl='git pull'
|
||||
alias ga='git add'
|
||||
alias gb='git branch'
|
||||
alias gap='git add --patch'
|
||||
alias gr='git reset "HEAD^"'
|
||||
|
||||
# Tmux
|
||||
if is-callable 'tmux'; then
|
||||
alias t='tmux'
|
||||
alias ts='tmux send-keys'
|
||||
alias tl='tmux ls'
|
||||
|
||||
# Start new session or create a grouped session so I'm not simply watching
|
||||
# the same session in both windows.
|
||||
alias ta='tmux new -s $(hostname) || tmux new -t $(hostname) -s $(hostname)-2 || tmux attach -t "io-2"'
|
||||
|
||||
# New instance attached to old session
|
||||
alias tn='tmux new-session -t $(hostname)'
|
||||
fi
|
||||
|
|
|
@ -3,8 +3,6 @@ export GIT_MERGE_AUTOEDIT=no
|
|||
# Disable autocorrect behavior, very annoying!
|
||||
unsetopt correct_all
|
||||
|
||||
autoload -Uz zmv
|
||||
|
||||
|
||||
#################
|
||||
# Keybindings #
|
||||
|
|
|
@ -48,7 +48,7 @@ function prompt_v0_setup {
|
|||
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
||||
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{red}$%f%b'
|
||||
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}♺%f'
|
||||
zstyle ':prezto:module:editor:info:keymap:alternate' format '%B%F{green}|%f%b'
|
||||
zstyle ':prezto:module:editor:info:keymap:alternate' format '%B%F{green}#%f%b'
|
||||
|
||||
# Add newline before prompt
|
||||
precmd() { print "" }
|
4
zshenv
4
zshenv
|
@ -3,6 +3,4 @@ if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
|
|||
source "${ZDOTDIR:-$HOME}/.zprofile"
|
||||
fi
|
||||
|
||||
if [[ -n "$EMACS" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zshrc"
|
||||
fi
|
||||
[[ -n "$EMACS" ]] && source "${ZDOTDIR:-$HOME}/.zshrc"
|
||||
|
|
18
zshrc
18
zshrc
|
@ -4,29 +4,23 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
else
|
||||
echo "Prezto isn't installed! Run ~/.dotfiles/install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source ~/.zsh/aliases
|
||||
|
||||
# Source component rcfiles
|
||||
if [[ -z "$EMACS" ]]; then
|
||||
source ~/.zsh/config
|
||||
is-callable 'fasd' && eval "$(fasd --init auto)"
|
||||
fi
|
||||
|
||||
source ~/.zsh/aliases
|
||||
|
||||
# Initialize rbenv and pyenv; rehashing slows down zsh startup, so we
|
||||
# disable it.
|
||||
if is-callable 'rbenv'; then
|
||||
export PATH=~/.rbenv/bin:$PATH
|
||||
eval "$(rbenv init - --no-rehash)"
|
||||
fi
|
||||
|
||||
if is-callable 'pyenv'; then
|
||||
export PATH=~/.pyenv/bin:~/.pyenv/shims:$PATH
|
||||
eval "$(pyenv init - --no-rehash)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
fi
|
||||
# if is-callable 'go'; then
|
||||
# export GOPATH="$HOME/Dropbox/Projects/dev/go"
|
||||
# export PATH="$GOPATH/bin:$PATH"
|
||||
# fi
|
||||
# if is-callable 'haxe'; then
|
||||
# export HAXE_STD_PATH="/usr/local/lib/haxe/std"
|
||||
# fi
|
||||
|
|
Loading…
Reference in a new issue