This commit is contained in:
Paul Walker
2021-04-27 11:27:56 +01:00
parent d7ed05c35e
commit 730253d1fd
6 changed files with 114 additions and 0 deletions

33
zshrc Normal file
View File

@@ -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

36
zshrc.d/aliases.zsh Normal file
View File

@@ -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

14
zshrc.d/fzf.zsh Normal file
View File

@@ -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"

16
zshrc.d/history.zsh Normal file
View File

@@ -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

4
zshrc.d/opts.zsh Normal file
View File

@@ -0,0 +1,4 @@
setopt AUTO_CD
# setopt CORRECT
# setopt CORRECT_ALL

11
zshrc.d/prompt.zsh Normal file
View File

@@ -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'