Dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
2.3 KiB

11 years ago
#
# Executes commands at the start of an interactive session.
#
#
#
9 years ago
# Set the list of directories that Zsh searches for programs.
#
9 years ago
fpath=(
$DOTFILES/zsh/functions
$fpath
)
typeset -gU fpath
#
# Use zplug
#
export ZPLUG_HOME=$DOTFILES/zsh/zplug
if (( $+commands[termux-info] )); then
rm $ZPLUG_HOME/zcompdump # Broken in Termux
fi
if [[ -s "$ZPLUG_HOME/init.zsh" ]]; then
source "$ZPLUG_HOME/init.zsh"
zplug "sorin-ionescu/prezto", as:plugin, use:init.zsh
zplug "nojhan/liquidprompt", as:plugin
zplug check || zplug install
zplug load
11 years ago
fi
#
# Git
#
# Revive old gst alias from OMZ/git
alias gst="git status"
# git update fork
# Merge upstream
function gupf {
(
set -e
9 years ago
local LBRANCH=`git symbolic-ref --short HEAD`
3 years ago
local ORIGIN=${1-`git config --get branch.$LBRANCH.remote`}
local UPSTREAM=${2-upstream}
9 years ago
local OBRANCH=${3-$LBRANCH}
local UBRANCH=${4-$OBRANCH}
git fetch $ORIGIN
git fetch $UPSTREAM
3 years ago
git checkout -b merge $ORIGIN/$OBRANCH
9 years ago
git merge $UPSTREAM/$UBRANCH -m "merge upstream from `git ls-remote --get-url $UPSTREAM`"
git checkout $LBRANCH
git rebase merge
git branch -d merge
)
}
#
# pacman/makepkg
#
alias mksrcinfo="makepkg --printsrcinfo >! .SRCINFO"
#
# rsync
#
alias rsync="command rsync -e ssh -aXSPzs -vih8"
alias termux-rsync="command rsync -e 'ssh -p 8022' -rltXSPzzs -vih8"
8 years ago
#
# NeoVim
#
if (( $+commands[nvim] )); then
alias vim=nvim
fi
#
# tmux
#
function tmux {
if [ $# -gt 0 ]; then
command tmux "$@"
else
command tmux new -As default
fi
}
#
# BusyBox
#
# Kill fancy aliases on BusyBox, since not all GNU options are supported
if (( $+commands[busybox] )); then
for cmd in `busybox --list`; do
if (( $+aliases[$cmd] )); then
__whence="`builtin whence -p $cmd`"
if [ -L "$__whence" ] && command readlink "$__whence" | command grep -q busybox; then
unalias $cmd
fi
fi
unset __whence
done
fi
#
# Konsole scroll buffer
#
function clearbuf {
echo -en "\e[3J"
}
#
# Misc.
#
alias lns="ln -sr"
3 years ago
#
# Please
#
function please {
if [ -z "$*" ]; then
sudo $(fc -ln -1)
else
sudo "$@"
fi
}
#
# Local overrides
#
10 years ago
[[ -e "$DOTFILES/zsh/zshrc.local" ]] && source "$DOTFILES/zsh/zshrc.local"