Mercurial > hg > zsh-env
view zshrc @ 170:95e349996727
Add a script for setting up the shell environment on a naked home.
Use a global .hgrc that has a hook for local includes per machine.
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Sat, 04 Apr 2020 03:53:18 +0200 |
parents | 75e3f2d8368c |
children | 7d3c872681cb |
line wrap: on
line source
# # This is the main zshrc file. # if [ -d $HOME/.oh-my-zsh ]; then ZSH=$HOME/.oh-my-zsh . $HOME/.zsh-env/oh-my-zsh elif [ -d /var/lib/zsh/oh-my-zsh ]; then ZSH=/var/lib/zsh/oh-my-zsh . $HOME/.zsh-env/oh-my-zsh fi # get rid of some unwanted aliases from the oh-my-zsh env if [ "`alias | grep 'll='`" != "" ]; then unalias ll fi if [ "`alias | grep 'l='`" != "" ]; then unalias l fi if [ "`alias | grep 'lsa='`" != "" ]; then unalias lsa fi # enable zsh's fancy autocomplete fpath=(~/.zsh-env/completion $fpath) autoload -U compinit # -u avoids compinit complaining when running as root (see man zshcompsys) compinit -u # custom functions/aliases that should work on all platforms cd() { builtin cd "$@"; print -D $PWD; } ff() { find $2 -print0 | xargs -0 grep $1 } gve() { grep -ve '^#' $1 | uniq | less } hgrep() { history | grep $* } ll() { /usr/bin/env -u LC_ALL LANG=C ls -laFh "$@" | more } lr() { /usr/bin/env -u LC_ALL LANG=C ls -rtlh "$@" } mcd() { mkdir $1; cd $1 } psg() { ps auxww | grep -v grep | grep -i "$@" } alias gk="$HOME/.zsh-env/gk.sh" alias history="history 1" alias ny="nano -Y none" alias pd=pushd alias removeKernel="$HOME/.zsh-env/removeKernel" alias sl='screen -ls' alias sn='screen -S' alias sr='screen -r' alias suod=sudo alias ta="tmux attach -t" alias tl="tmux list-sessions" alias tn="tmux new -s" alias upload="rsync --partial --progress --rsh=ssh" # no history handling for now ... or find a better way to save history per shell not across all shells export HISTFILE= export HISTSIZE=500 # emulate tcsh's behaviour for forked processes: do not warn, do not kill when shell is closed setopt nohup setopt no_check_jobs # ignore duplicates in history setopt hist_ignore_all_dups # get rid of the silly "zsh: sure you want to delete all the files in ..." message unsetopt normstarsilent # turn off the "helpful" zsh feature of pushing each directory to the dir stack on cd unsetopt autopushd # turn off "helpful" auto correction unsetopt correct_all # utility function that is used by various other modules removeFromPath() { search_term="$1" split_path=(${(s/:/)PATH}) clean_path="" for element in ${split_path} do if [[ "${element}" =~ "${search_term}" ]]; then continue fi if [ ${#clean_path} -eq 0 ]; then clean_path="${element}" else clean_path="${clean_path}:${element}" fi done echo "${clean_path}" } # $HOST can either be just the host name or the FQDN. Standardize on the raw host name export HOST=`echo $HOST | awk -F '.' '{ print $1 }'` # include a zshrc per OS type local os_zshrc=$HOME/.zsh-env/zshrc-$OSTYPE if [ -f ${os_zshrc} ]; then . ${os_zshrc} fi # include a zshrc per host local host_zshrc=$HOME/.zsh-env/zshrc-${HOST} if [ -r ${host_zshrc} ]; then . ${host_zshrc} fi