Sunteți pe pagina 1din 5

# Customize to your needs...

export PATH=/home/sindhu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin:/usr/games:/home/sindhu/bin:/var/lib/gems/1.8/bin:/home/sindhu/.gem/ru
by/1.8/bin
#Set the auto completion on
autoload -Uz compinit
compinit -Uz
# man zshoptions
# Pushes rprompt out of the way while taking input
setopt TRANSIENT_RPROMPT
#resolve symlinks to their true vlues
setopt chase_links
# Report the status of background jobs immediately, rather than waiting until ju
st before printing a prompt.
setopt notify
# Try to correct the spelling of commands. Note that, when the HASH_LIST_ALL op
tion is not set or when some directories in the path are not readable, this m
ay falsely report spelling errors the first time some commands are used.
setopt correct
# Try to correct the spelling of all arguments in a line.
setopt correct_all
# In completion, recognize exact matches even if they are ambiguous.
setopt recexact
# List jobs in the long format by default.
setopt long_list_jobs
# Treat single word simple commands without redirection as candidates for resump
tion of an existing job.
setopt auto_resume
# Do not enter command lines into the history list if they are duplicates of the
previous event.
setopt hist_ignore_dups
#
setopt no_clobber
# Make cd push the old directory onto the directory stack.
setopt autopushd
# Treat the `#', `~' and `^' characters as part of patterns for filename generat
ion, etc. (An initial unquoted `~' always produces named directory expansion.)
setopt extendedglob
# Prevents aliases on the command line from being internally substituted before
completion is attempted. The effect is to make the alias a distinct command for
completion purposes.
setopt complete_aliases
# If this is set, zsh sessions will append their history list to the history
file, rather than replace it. Thus, multiple parallel zsh sessions will all hav
e the new entries from their history lists added to the history file, in t
he order that they exit. The file will still be periodically re-written to trim
it when the number of lines grows 20% beyond the value specified by $SAVEHIS
T
setopt append_history
# If a command is issued that can't be executed as a normal command, and the com
mand is the name of a directory , perform the cd command to that directory.
setopt autocd
# Run all background jobs at a lower priority. This option is set by default.
setopt bgnice
# Perform implicit tees or cats when multiple redirections are attempted (see th
e section `Redirection').
setopt multios
# Automatically list choices on an ambiguous completion.
setopt autolist
# Automatically use menu completion after the second consecutive request for com
pletion, for example by pressing the tab key repeatedly
setopt AUTO_MENU
# If set, parameter expansion, command substitution and arithmetic expansion are
performed in prompts. Substitutions within prompts do not affect the command s
tatus.
setopt prompt_subst
# Show history
alias history='fc -l 1'
# List direcory contents
alias ll='ls -lr'
alias ls='ls --color'
alias lt='ls -ltFh'
#Miscellaneous
alias msgs='tail -f /var/log/messages'
alias cl='clear'
alias find='find . -name $*'
alias mv='mv -i -v'
alias cp='cp -i -v'
alias rm='rm -i -v'
alias du='du -h'
alias df='df -h'
alias chmodx="chmod +x"
#other aliases
alias code='~/code'
alias kill-pyds="pkill -f 'python manage.py runserver'"
alias add2log="echo >> ~/mylog.txt `date`"
# Apt
alias install='sudo apt-get install'
alias remove='sudo apt-get remove'
alias purge='sudo apt-get purge'
alias update='sudo apt-get update'
alias search='aptitude search'
alias cleanup='sudo apt-get autoremove'
#
HISTFILE=~/.zsh-histfile
HISTSIZE=1000
SAVEHIST=1000
#nocorrect
alias man='nocorrect man'
#zstyles
# General completion technique
zstyle ':completion:*' completer _expand _complete _correct _approximate _ignore
d
#menu related
# show the default prompt while scrolling during menu selection
zstyle ':completion:*:*:*:*:*' menu yes select
zstyle ':completion:*:default' menu
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character
to insert%s'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p
%s
zstyle ':completion:*' max-errors 3 numeric
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' verbose yes
zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
zstyle ':completion:history-words:*:history-words' stop yes
zstyle ':completion:history-words:*' remove-all-dups yes
zstyle ':completion:history-words:*' menu yes
zstyle ':completion:*:history-words' list false
zstyle ':completion:*' file-sort access
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' '+m:{a-z}={A-Z}' 'r:|[._-]=** r:|=**' 'l:
|=* r:|=*'
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' completer _complete _prefix
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:predict:*' completer _complete # Completion caching
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
#let's make our completions faster
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
# If you end up using a directory as argument, this will remove the trailing sla
sh (usefull in ln)
zstyle ':completion:*' squeeze-slashes 'yes'
#give it some color!
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
#killing processes
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=37=31"
#Git
# get the name of the branch we are on
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THE
ME_GIT_PROMPT_SUFFIX"
}
parse_git_dirty () {
if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working d
irectory clean)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
#Automatic ls after cd
chpwd() {
ls
}
#Show battery charge
function battery_charge {
acpi | awk '{print $4,$5}'
# acpi | sed -e 's/.* \([0-9][0-9]\)%, \([^ ]*\) until charged/\1 \2/'
}
#cd () {
# if [[ "x$*" == "x..." ]]; then
# cd ../..
# elif [[ "x$*" == "x...." ]]; then
# cd ../../..
# elif [[ "x$*" == "x....." ]]; then
# cd ../../..
# elif [[ "x$*" == "x......" ]]; then
# cd ../../../..
# else
# builtin cd "$@"
# fi
#}
#even better way to change directories if you like seeing ../..
#rationalise-dot()
#{
#if [[ $LBUFFER = *.. ]]; then
#LBUFFER+=/..
#else
#LBUFFER+=.
#fi
#}
#zle -N rationalise-dot
#bindkey . rationalise-dot
#cd, because typing the backslash is ALOT of work!!
alias .='cd ../'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'
# ls colors
autoload colors; colors;
export LSCOLORS="Gxfxcxdxbxegedabagacad"
#export LS_COLORS
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or B
SD
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls
-G'
fi
if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
fi
# Apply theming defaults
PS1="%n@%m:%~%# "
RPROMPT='$(battery_charge)'
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of th
e prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is d
irty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c
lean
#theme source
source /home/sindhu/.zsh/themes/robbyrussell.zsh-theme

S-ar putea să vă placă și