Advertisement
turlando

.zshrc

Jul 17th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.43 KB | None | 0 0
  1. #!/bin/zsh
  2.  
  3. # Orgasmic Zshell configuration file made by
  4. # Quel Gran Figo Di Tancredi Orlando.
  5. # Code provided under the WTFPL (→ http://sam.zoy.org/wtfpl/)
  6. # © 2011 Quel Gran Figo Di Tancredi Orlando.
  7. # Always in development: please don't break my ballz.
  8.  
  9. # Settings
  10. # ========
  11.  
  12. # Colors variables
  13. # ----------------
  14. grey="%{$(echo -n '\e[1;30m')%}"
  15. red="%{$(echo -n '\e[1;31m')%}"
  16. green="%{$(echo -n '\e[1;32m')%}"
  17. yellow="%{$(echo -n '\e[1;33m')%}"
  18. blue="%{$(echo -n '\e[1;34m')%}"
  19. magenta="%{$(echo -n '\e[1;35m')%}"
  20. cyan="%{$(echo -n '\e[1;36m')%}"
  21. white="%{$(echo -n '\e[1;37m')%}"
  22. lightred="%{$(echo -n '\e[0;31m')%}"
  23. lightgreen="%{$(echo -n '\e[0;32m')%}"
  24. lightyellow="%{$(echo -n '\e[0;33m')%}"
  25. lightblue="%{$(echo -n '\e[0;34m')%}"
  26. lightmagenta="%{$(echo -n '\e[0;34m')%}"
  27. lightcyan="%{$(echo -n '\e[0;35m')%}"
  28. lightwhite="%{$(echo -n '\e[0;37m')%}"n/zsh
  29.  
  30. # Autocompletion
  31. # --------------
  32. autoload -U compinit
  33. compinit
  34. zstyle ':completion:*' completer _complete _ignored _match _approximate
  35. zstyle ':completion:*' format 'Completing %d'
  36. zstyle ':completion:*' group-name ''
  37. zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
  38. zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*'
  39. zstyle ':completion:*' use-cache on
  40. zstyle ':completion:*' cache-path $HOME/.zsh/cache
  41. zstyle ':completion:*:match:*' original only
  42. zstyle ':completion:*:approximate:*' max-errors 1 numeric
  43. zstyle ':completion:*:functions' ignored-patterns '_*'
  44.  
  45. # Autocorrect
  46. # -----------
  47. setopt correct
  48.  
  49. # Prompt
  50. # ------
  51. autoload -U promptinit
  52. promptinit
  53. PS1=$'%n@%m:%~%# '
  54.  
  55. # Keybinding
  56. # ----------
  57. bindkey -e
  58. bindkey  "\eOH"     beginning-of-line
  59. bindkey  "\eOF"     end-of-line
  60. bindkey  "\e[2~"    overwrite-mode
  61. bindkey  "\e[3~"    delete-char
  62. bindkey  "^[[A"     up-line-or-history
  63. bindkey  "^[[B"     down-line-or-history
  64. bindkey  "\e\e[C"   backward-char
  65. bindkey  "\e\e[D"   forward-char
  66. bindkey  "\e[5~"    beginning-of-history
  67. bindkey  "\e[6~"    end-of-history
  68.  
  69. # History
  70. # -------
  71. HISTFILE=~/.history
  72. HISTSIZE=1000
  73. SAVEHIST=1000
  74.  
  75. # Enviroment variables
  76. # --------------------
  77. export EDITOR="/usr/bin/vim"
  78. export BROWSER="/usr/bin/google-chrome"
  79. export TERMINAL="/usr/bin/urxvt"
  80.  
  81.  
  82. # Aliases
  83. # =======
  84.  
  85. # Coloured output for grep and ls
  86. # -------------------------------
  87. alias ls='ls --color=auto'
  88. alias grep='grep --color=auto'
  89.  
  90. # Right way to run some programs
  91. # ------------------------------
  92. alias irssi='screen irssi'
  93. alias weechat='weechat-curses'
  94. alias scrota='scrot -c -d 10 ~/Images/Screenshots/Screenshot\ %d-%m-%Y\ %H\:%M.png'
  95.  
  96. # VI-style commands
  97. # -----------------
  98. alias :q='exit'
  99.  
  100.  
  101. # Functions
  102. # =========
  103.  
  104. # Compress
  105. # --------
  106. compress () { # compress archive.tar folder
  107.     if [ -d $2 ] ; then
  108.         case $1 in
  109.             *.tar.bz2)   tar vcjf $1 $2;;
  110.             *.tar.gz)    tar vczf $1 $2;;
  111.             *.bz2)       bunzip2 $1 $2;;
  112.             *.gz)        gzip $1 $2;;
  113.             *.tar)       tar vcf $1 $2;;
  114.             *.tbz2)      tar vcjf $1 $2;;
  115.             *.tgz)       tar vczf $1 $2;;
  116.             *.zip)       zip -r $1 $2;;
  117.             *.Z)         compress $1 $2;;
  118.             *.7z)        7z a -t7z $1 $2;;
  119.             *)           echo "Non riesco a comprimere $2.";;
  120.        esac
  121.    else
  122.        echo "$2 non è un archivio valido."
  123.    fi
  124. }
  125.  
  126. # Extract
  127. # -------
  128. extract () { # extract archive.tar
  129.     if [ -f $1 ] ; then
  130.         case $1 in
  131.             *.ar.bz2)   tar vxjf $1;;
  132.             *.ar.gz)    tar vxzf $1;;
  133.             *.bz2)      bunzip2 $1;;
  134.             *.rar)      unrar x $1;;
  135.             *.gz)           gunzip $1;;
  136.             *.tar)      tar vxf $1;;
  137.             *.tbz2)     tar vxjf $1;;
  138.             *.tgz)      tar vxzf $1;;
  139.             *.zip)      unzip $1;;
  140.             *.Z)            uncompress $1;;
  141.             *.7z)           7z x $1;;
  142.       *)           echo "Non riesco a estrarre $1.";;
  143.        esac
  144.    else
  145.        echo "$1 non è un archivio valido."
  146.    fi
  147. }
  148.  
  149. # Open config files
  150. # -----------------
  151. config () {
  152.     case $1 in
  153.         rc)     $EDITOR /etc/rc.conf;;
  154.         vim)        $EDITOR ~/.vimrc;;
  155.         zsh)        $EDITOR ~/.zshrc;;
  156.         xorg)       $EDITOR /etc/X11/xorg.conf;;
  157.         fstab)      $EDITOR /etc/fstab;;
  158.         tint2)      $EDITOR ~/.config/tint2/tint2rc;;
  159.         xdefs)      $EDITOR ~/.Xdefaults;;
  160.         xinit)      $EDITOR ~/.xinitrc;;
  161.         pacman)     $EDITOR /etc/pacman.conf;;
  162.         inittab)    $EDITOR /etc/inittab;;
  163.         mplayer)    $EDITOR ~/.mplayer/config;;
  164.         *)              if [ -f "$1" ]; then
  165.                                 if [ -w "$1" ]; then
  166.                                     $EDITOR "$1"
  167.                                 else
  168.                                     $EDITOR "$1"
  169.                                 fi
  170.                             else
  171.                                 echo "Invalid option."
  172.                             fi;;
  173.     esac
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement