同胞们晒晒.bashrc
先开个头。没有找到shell的code排版,只好借python的一用.
- Python code
1 ######################################################### 2 # Wed Jul 13 20:38:23 CST 2011 # 3 # by Lanceil@NKU # 4 ######################################################### 5 6 # Check for an interactive session 7 [ -z "$PS1" ] && return 8 9 ######################################################### 10 # SETTINGS & ALIAS # 11 cd ~/tmp 12 set -o vi 13 set -o ignoreeof 14 setterm -blength 0 15 16 PATH=$PATH:/usr/local/bin:~/bin 17 alias ls='ls --color=auto' 18 alias ll='ls -l --color=auto' 19 alias hd='hexdump -C' 20 alias grep='grep --color' 21 # # 22 ######################################################### 23 24 25 ######################################################### 26 # ENVIRONMENT VARIABLES # 27 28 PS1="\[\e[34m\][\u@\h\[\e[36m\]\w\[\e[0m\]\[\e[34;m\]]\`if [ \$? = 0 ];\ 29 then echo -e '\e[32;1m:)'; else echo -e '\e[31;1m:('; fi\`\[\e[0m\]" 30 LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:\ 31 cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:\ 32 ex=32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:\ 33 *.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:\ 34 *.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:\ 35 *.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:\ 36 *.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:\ 37 *.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:\ 38 *.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:" 39 TERM=xterm-color 40 export PS1 LS_COLORS TERM 41 export LESS_TERMCAP_mb=$'\E[01;36m' # begin blinking 42 export LESS_TERMCAP_md=$'\E[01;34m' # begin bold 43 export LESS_TERMCAP_me=$'\E[0m' # end mode 44 export LESS_TERMCAP_se=$'\E[0m' # end standout-mode 45 export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-odeinfobox 46 export LESS_TERMCAP_ue=$'\E[0m' # end underline 47 export LESS_TERMCAP_us=$'\E[36m' # begin underline 48 # # 49 ######################################################### 50 51 52 ######################################################### 53 # functions # 54 55 rm() 56 { 57 if [ $# -lt 1 ]; then 58 echo "trash: missing file operand" 59 return 1 60 fi 61 mkdir ~/.trash/ 2>&- 62 mv -f "$@" ~/.trash/ 63 } 64 um() 65 { 66 if [ $# -lt 1 ]; then 67 echo "untrash: missing file operand" 68 return 1 69 fi 70 LASTPWD=$(pwd) 71 72 ( cd ~/.trash 73 mv "$@" $LASTPWD ) 74 } 75 lm() 76 { #( 77 ls -al ~/.trash 78 } #) 79 cm() 80 { 81 /bin/rm -rf ~/.trash/* 82 } 83 # # 84 #########################################################[解决办法]
zsh党表示路过
- Python code
# Created by freetstar at 20101226 #########################First Section######################## # History Setting{{{ export HISTFILE=~/.histfile export HISTSIZE=5000 export SAVEHIST=5000 # setopt INC_APPEND_HISTORY #忽略重复的历史命令 setopt HIST_IGNORE_DUPS setopt EXTENDED_HISTORY setopt bang_hist #启用cd命令的历史记录,cd -[TAB]进入历史路径 setopt AUTO_PUSHD #相同的历史路径只保留一个 setopt PUSHD_IGNORE_DUPS #在命令前添加空格,不将此命令添加到记录文件中 setopt HIST_IGNORE_SPACE #}}} ############################################################## ###################Second Section############################# #others{{{ #允许在交互模式中试用注释 #cmd #这是注释 setopt INTERACTIVE_COMMENTS #启动自动cd ,输入目录名则进入目录 setopt AUTO_CD #如果cd后跟的不是一个目录,然后会用~来替代====failure #setopt CDABLE_VARS #扩展路径 #/v/c/p/p => /var/cache/pacman/pkg setopt complete_in_word #禁用core dumps limit coredumpsize 0 #自动补全功能 setopt AUTO_LIST setopt AUTO_MENU #开启此选项,补全时会直接选中菜单项 setopt MENU_COMPLETE #如果你开启了一个进程,之后你忘记了开启另外一个进程,那么本选项会默认使用之前开启的进程 setopt AUTO_RESUME autoload -Uz compinit compinit #}}} ############################################################## ################Promote setting############################### #Prompt setup autoload -U promptinit promptinit #开启prompts的大多数扩展===failure #prompt_subst prompt elite2 red ############################################################## ################auto completion############################### zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path ~/.zsh/cache zstyle ':completion:*:cd:*' ignore-parents parent pwd zstyle ':completion:*' verbose yes zstyle ':completion:*' menu select zstyle ':completion:*:*:default' force-list always zstyle ':completion:*' select-prompt '%SSelect: lines: %L matches: %M [%p]' zstyle ':completion:*:match:*' original only zstyle ':completion::prefix-1:*' completer _complete zstyle ':completion:predict:*' completer _complete zstyle ':completion:incremental:*' completer _complete_correct zstyle ':completion:*' completer _complete _prefix _correct _prefix _match _approximate #路径补全 zstyle ':completion:*' expand 'yes' #如果是用路径作为参数,则把\给去掉,ln时比较有用 zstyle ':completion:*' squeeze-slashes 'yes' zstyle ':completion::completion:*' '\\' #彩色补全菜单 eval $(dircolors -b) export ZLSCOLORS="${LS_COLORS}" zmodload zsh/complist zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)* =0=01;31' #补全ssh scp sftp等等 zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' #修正大小写 zstyle ':completion:*' matcher-list '' 'm:(a-zA-Z)=(A-Za-z)' #错误矫正 zstyle ':completion:*' completer _complete _math _approximate zstyle ':completion:*:match:*' original only zstyle ':completion:*:approximate:*' max-errors 1 numeric #kill命令补全 compdef pkill=killall zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:*:*:*:processes' fore-list always zstyle ':completion:*:processes' command 'ps -au$USER' #命令补全 zstyle ':completion:*:matches' group 'yes' zstyle ':completion:*' group-name '' zstyle ':completion:*:options' description 'yes' zstyle ':completion:*:options' auto-description '%d' zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m ' zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m' zstyle ':completion:*:warings' format $'\e[01;31m -- No Match Found -- \e[0m' zstyle ':completion:*:corrections' format $'\e[01;32m -- %d(errors: %e) -- \e[0m' #忽略补全函数补全没有的命令 zstyle ':completion:*:functions' ignored-patterns '_*' #cd ~补全顺序 zstyle ':completion:*:-tilde-:*' group-order 'name-directories' 'path-directories' 'users' 'expand' #补全ping zstyle ':completion:*:ping:*' hosts 192.168.1.{1,4,11,101} www.baidu.com #}}} ############################################################## ################################add sudo####################### sudo-command-line(){ [[ -z $BUFFER ]] && zle up-history [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" #插入光表后,光表移动到行末尾 } zle -N sudo-command-line #Esc Esc 在命令前插入sudo bindkey "\e\e" sudo-command-line ############################################################### ###################associate the file with applications####### autoload -U zsh-mime-setup zsh-mime-setup alias -s png=eog alias -s c=vim alias -s cpp=vim alias -s png=eog alias -s html=$BROWSER alias -s jpg=eog alias -s gif=eog alias -s doc=libreoffice alias -s gz=tar -xzvf alias -s bz2=tar -xjvf alias -s pdf=evince alias -s glade=glade ############################################################ ####################alias configuration###################### #alias 别名设置 alias grep='grep --color=auto' alias ll='ls -l' alias hm="history|grep" alias history='history -fi' alias ls='ls --color=auto' alias top10='print -l $((o)history%% *)|uniq -c|sort -nr|head -n 10' alias sshproxy1='ssh -qtfnN -D 1080 freetstar@vps2.wowubuntu.com' alias killzom='ps -ef | grep defunct | grep -v grep | awk '{print "kill -9" $2,$3}'' alias killssh="kill $(ps aux|grep "ssh -q"|awk -F" " '{print $2}')" alias p='pacman' alias y='yaourt' alias agi="apt-get install" alias apa="apt-get autoremove" alias apu="apt-get update" alias apg="apt-get upgrade" #全局alias alias -g ...="../.." alias -g ....="../../.." alias -g .....="../../../.." alias -g L="|less" alias -g C="|wc -l" #hash hash -d www="/var/www" #####zstyle zstyle :compinstall filename '/home/lgx/.zshrc' #We set some options here #setopt extended_glob setopt correctall export HISTTIMEFORMAT='%F %T ' #less 语法高亮需要安装source-highlight PAGER='less -X -M' export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" export LESS=' -R '#让cat命令也语法高亮hlcat(){ less $*|cat }alias tom='hlcat'##########zsh有一个奇怪的现象,就是新安装完一个软件之后#无法tab出来,也就是无法通过tab试用,只能全命令打出#有答案说是zsh是先生成哈席表,故需要rehash一下...#