diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..1c6628f --- /dev/null +++ b/zshrc @@ -0,0 +1,33 @@ +# Add an entry to PATH, iff it's not already there. +addpath() { + wanted_path=$1 + at_end=$2 + FOUND=$(echo $PATH | grep $wanted_path) + if [ $? -ne 0 ] ; then + if [ "$at_end" == "" ] ; then + export PATH=$wanted_path:$PATH + else + export PATH=$PATH:$wanted_path + fi + fi +} + +autoload -Uz compinit && compinit + +addpath $HOME/bin + +# Not version controlled, it's system specific. +if [ -r $HOME/.cargo/env ] ; then + source $HOME/.cargo/env +fi + +# Load any supplementary scripts +if [ -d "$HOME"/.zshrc.d ] ; then + for config in "$HOME"/.zshrc.d/*.zsh ; do + source "$config" + done + unset -v config +fi +if [ -f ${HOME}/.zsh.d/local/${HOSTNAME}.zsh ] ; then + source ${HOME}/.zsh.d/local/${HOSTNAME}.zsh +fi diff --git a/zshrc.d/aliases.zsh b/zshrc.d/aliases.zsh new file mode 100644 index 0000000..2af0637 --- /dev/null +++ b/zshrc.d/aliases.zsh @@ -0,0 +1,36 @@ +if [ -x /usr/bin/dircolors ]; then + alias ls='ls --color=auto' + alias grep='grep --color=auto' +fi + +# some more ls aliases +alias ll='ls -l' +alias la="ls -a" +alias lS="ls -lSr" +alias lm="ls -ltr $HOME/mail/ | tail" +alias ..="cd .." +alias install="apt-get install" +alias m='mutt' +alias s="slrn" +# alias irc="sc irc" +alias talker="tm talker" +alias db="dropbox.py" + +alias trunc="truncate -s0" + +# Misc +alias hgrep="history | grep" +alias hex="hexdump -Cv" + +# git shortcuts +alias br="git checkout" +alias brl="git branch" +alias gg="git grep" +alias st="git status" +alias gd="git diff" + +alias log='git log --color --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit' + +if [ -x /usr/bin/fdfind ] ; then + alias fd=fdfind +fi diff --git a/zshrc.d/fzf.zsh b/zshrc.d/fzf.zsh new file mode 100644 index 0000000..2d7316a --- /dev/null +++ b/zshrc.d/fzf.zsh @@ -0,0 +1,14 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */home/pw921828/.fzf/bin* ]]; then + export PATH="${PATH:+${PATH}:}/home/pw921828/.fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/home/pw921828/.fzf/shell/completion.zsh" 2> /dev/null + +# Key bindings +# ------------ +source "/home/pw921828/.fzf/shell/key-bindings.zsh" + diff --git a/zshrc.d/history.zsh b/zshrc.d/history.zsh new file mode 100644 index 0000000..1fb2125 --- /dev/null +++ b/zshrc.d/history.zsh @@ -0,0 +1,16 @@ +## History stuff +HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history +setopt EXTENDED_HISTORY +SAVEHIST=5000 +HISTSIZE=2000 +setopt SHARE_HISTORY +setopt APPEND_HISTORY +setopt INC_APPEND_HISTORY +# expire duplicates first +setopt HIST_EXPIRE_DUPS_FIRST +# do not store duplications +setopt HIST_IGNORE_DUPS +#ignore duplicates when searching +setopt HIST_FIND_NO_DUPS +# removes blank lines from history +setopt HIST_REDUCE_BLANKS diff --git a/zshrc.d/opts.zsh b/zshrc.d/opts.zsh new file mode 100644 index 0000000..faec27e --- /dev/null +++ b/zshrc.d/opts.zsh @@ -0,0 +1,4 @@ +setopt AUTO_CD + +# setopt CORRECT +# setopt CORRECT_ALL diff --git a/zshrc.d/prompt.zsh b/zshrc.d/prompt.zsh new file mode 100644 index 0000000..f25316f --- /dev/null +++ b/zshrc.d/prompt.zsh @@ -0,0 +1,11 @@ +autoload -Uz vcs_info +precmd_vcs_info() { vcs_info } +precmd_functions+=( precmd_vcs_info ) +setopt prompt_subst +zstyle ':vcs_info:git:*' formats '%F{240}(%b)%f' +zstyle ':vcs_info:*' enable git + +# PROMPT='%n@%m %(?.√.?%?) %F{green}%~%f %# ' +PROMPT='%n@%m:%F{green}%~%f %# ' +# RPROMPT='$vcs_info_msg_0_ %F{yellow}%*%f' +RPROMPT='$vcs_info_msg_0_ %F{yellow}%*%f'