Added various functions to zshrc
This commit is contained in:
79
zshrc
79
zshrc
@@ -11,14 +11,18 @@ compinit
|
|||||||
HISTFILE=~/.zsh_history
|
HISTFILE=~/.zsh_history
|
||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
SAVEHIST=1000
|
SAVEHIST=1000
|
||||||
setopt appendhistory autocd extendedglob nomatch notify
|
setopt appendhistory autocd extendedglob nomatch notify histignoredups noclobber
|
||||||
bindkey -e
|
bindkey -e
|
||||||
# End of lines configured by zsh-newuser-install
|
# End of lines configured by zsh-newuser-install
|
||||||
|
|
||||||
|
setopt auto_cd multios auto_pushd pushd_minus pushd_silent pushd_to_home rm_star_wait
|
||||||
|
|
||||||
|
export EDITOR="vim"
|
||||||
export PATH=$PATH:/opt/local/bin:/usr/local/lib/io:~/.cabal/bin
|
export PATH=$PATH:/opt/local/bin:/usr/local/lib/io:~/.cabal/bin
|
||||||
export MANPATH=$MANPATH:/opt/local/share/man
|
export MANPATH=$MANPATH:/opt/local/share/man
|
||||||
export INFOPATH=$INFOPATH:/opt/local/share/info
|
export INFOPATH=$INFOPATH:/opt/local/share/info
|
||||||
export PYTHONSTARTUP=~/.pythonrc
|
export PYTHONSTARTUP=~/.pythonrc
|
||||||
|
export RI="--format ansi"
|
||||||
export TERM=rxvt
|
export TERM=rxvt
|
||||||
alias gcc="gcc-mp-4.9"
|
alias gcc="gcc-mp-4.9"
|
||||||
alias g++="g++-mp-4.9"
|
alias g++="g++-mp-4.9"
|
||||||
@@ -34,13 +38,62 @@ alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo
|
|||||||
alias dud="du -d 1"
|
alias dud="du -d 1"
|
||||||
alias loc="cloc *"
|
alias loc="cloc *"
|
||||||
alias ls="ls -a"
|
alias ls="ls -a"
|
||||||
PROMPT="[%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg_no_bold[yellow]%}%1~%{$reset_color%}]\$"
|
|
||||||
|
|
||||||
expand-or-complete-with-dots(){
|
host_color=cyan
|
||||||
echo -n "e[31m.....\e[0m"
|
history_color=yellow
|
||||||
zle expand-or-complete
|
user_color=green
|
||||||
zle redisplay
|
root_color=red
|
||||||
}
|
directory_color=magenta
|
||||||
|
error_color=red
|
||||||
|
jobs_color=green
|
||||||
|
|
||||||
|
host_prompt="%{$fg_bold[$host_color]%}%m%{$reset_color%}"
|
||||||
|
|
||||||
|
jobs_prompt1="%{$fg_bold[$jobs_color]%}(%{$reset_color%}"
|
||||||
|
|
||||||
|
jobs_prompt2="%{$fg[$jobs_color]%}%j%{$reset_color%}"
|
||||||
|
|
||||||
|
jobs_prompt3="%{$fg_bold[$jobs_color]%})%{$reset_color%}"
|
||||||
|
|
||||||
|
jobs_total="%(1j.${jobs_prompt1}${jobs_prompt2}${jobs_prompt3} .)"
|
||||||
|
|
||||||
|
history_prompt1="%{$fg_bold[$history_color]%}[%{$reset_color%}"
|
||||||
|
|
||||||
|
history_prompt2="%{$fg[$history_color]%}%h%{$reset_color%}"
|
||||||
|
|
||||||
|
history_prompt3="%{$fg_bold[$history_color]%}]%{$reset_color%}"
|
||||||
|
|
||||||
|
history_total="${history_prompt1}${history_prompt2}${history_prompt3}"
|
||||||
|
|
||||||
|
error_prompt1="%{$fg_bold[$error_color]%}<%{$reset_color%}"
|
||||||
|
|
||||||
|
error_prompt2="%{$fg[$error_color]%}%?%{$reset_color%}"
|
||||||
|
|
||||||
|
error_prompt3="%{$fg_bold[$error_color]%}>%{$reset_color%}"
|
||||||
|
|
||||||
|
error_total="%(?..${error_prompt1}${error_prompt2}${error_prompt3} )"
|
||||||
|
|
||||||
|
case "$TERM" in
|
||||||
|
(screen)
|
||||||
|
function precmd() { print -Pn "\033]0;S $TTY:t{%100<...<%~%<<}\007" }
|
||||||
|
;;
|
||||||
|
(xterm)
|
||||||
|
directory_prompt=""
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
directory_prompt="%{$fg[$directory_color]%}%~%{$reset_color%} "
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $USER == root ]]; then
|
||||||
|
post_prompt="%{$fg_bold[$root_color]%}%#%{$reset_color%}"
|
||||||
|
else
|
||||||
|
post_prompt="%{$fg_bold[$user_color]%}%#%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1="${host_prompt} ${jobs_total}${history_total} ${directory_prompt}${error_total}${post_prompt} "
|
||||||
|
|
||||||
|
|
||||||
zle -N expand-or-complete-with-dots
|
zle -N expand-or-complete-with-dots
|
||||||
bindkey "Î" expand-or-complete-with-dots
|
bindkey "Î" expand-or-complete-with-dots
|
||||||
|
|
||||||
@@ -50,6 +103,9 @@ insert_sudo () {
|
|||||||
zle -N insert-sudo insert_sudo
|
zle -N insert-sudo insert_sudo
|
||||||
bindkey "^[s" insert-sudo
|
bindkey "^[s" insert-sudo
|
||||||
|
|
||||||
|
[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
|
||||||
|
[[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line
|
||||||
|
|
||||||
case $TERM in
|
case $TERM in
|
||||||
xterm*)
|
xterm*)
|
||||||
precmd(){print -Pn "\e]0;%m: %~\a"}
|
precmd(){print -Pn "\e]0;%m: %~\a"}
|
||||||
@@ -136,3 +192,12 @@ save_dotfiles(){
|
|||||||
cp ~/.vimrc ~/Documents/Code/Github/.dotfiles/vimrc
|
cp ~/.vimrc ~/Documents/Code/Github/.dotfiles/vimrc
|
||||||
cp ~/.zshrc ~/Documents/Code/Github/.dotfiles/zshrc
|
cp ~/.zshrc ~/Documents/Code/Github/.dotfiles/zshrc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
term_title_base='@%l: %1~'
|
||||||
|
preexec () {
|
||||||
|
print -nr $'\e]2;'"${(%)term_title_base} $*"'$\a'
|
||||||
|
}
|
||||||
|
precmd () {
|
||||||
|
print -nr $'\e]2;'"${(%)term_title_base} ($?)"'$\a'
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user