Permalink
Browse files

split out shell configs

  • Loading branch information...
1 parent 1bf5535 commit bd6b2e3c0b6af426fae9460e520eb8cdf8d2ea01 @graysky2 committed Dec 15, 2012
Showing with 1,902 additions and 3 deletions.
  1. +4 −3 README.md
  2. +48 −0 shell/.aliases
  3. +20 −0 shell/.bashrc
  4. +8 −0 shell/.commonrc
  5. +13 −0 shell/.zsh/lib/appearance.zsh
  6. +49 −0 shell/.zsh/lib/completion.zsh
  7. +11 −0 shell/.zsh/lib/correction.zsh
  8. +14 −0 shell/.zsh/lib/directories.zsh
  9. +10 −0 shell/.zsh/lib/history.zsh
  10. +40 −0 shell/.zsh/lib/keys.zsh
  11. +28 −0 shell/.zsh/lib/spectrum.zsh
  12. +49 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/README.md
  13. +30 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/README.md
  14. +110 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh
  15. +38 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh
  16. +40 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh
  17. +35 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh
  18. +38 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh
  19. +37 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh
  20. +37 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh
  21. +24 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/cursor/README.md
  22. +45 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh
  23. +58 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/README.md
  24. +185 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh
  25. +35 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/assign.zsh
  26. +47 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh
  27. +36 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/path-space- .zsh
  28. +36 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh
  29. +38 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh
  30. +36 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/path.zsh
  31. +35 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/simple-command.zsh
  32. +39 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh
  33. +35 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/main/test-data/unknown-command.zsh
  34. +21 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/pattern/README.md
  35. +59 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh
  36. +24 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/root/README.md
  37. +45 −0 shell/.zsh/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh
  38. +20 −0 shell/.zsh/zsh-syntax-highlighting/tests/README.md
  39. +115 −0 shell/.zsh/zsh-syntax-highlighting/tests/test-highlighting.zsh
  40. +75 −0 shell/.zsh/zsh-syntax-highlighting/tests/test-perfs.zsh
  41. +218 −0 shell/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  42. +17 −0 shell/.zshrc
View
@@ -1,7 +1,8 @@
##Config Files
###Workstation
-* dotfiles/ Useful dotfiles from ~ on my workstation.
-* etc/ Select system files of interest on my workstation.
+* dotfiles/ Useful dotfiles from ~ on my workstation.
+* dotfiles/shell/ Bash and Zsh specific config files
+* etc/ Select system files of interest on my workstation.
###Intel Atom
-* IONITX-A-U/ Both dotfiles and system files unique to a Zotac IONITX-A-U mobo.
+* IONITX-A-U/ Both dotfiles and system files unique to a Zotac IONITX-A-U mobo.
View
@@ -0,0 +1,48 @@
+alias v="vim"
+alias vd="vimdiff"
+alias xx="exit"
+alias wget="wget -c"
+alias dogain="mp3gain -a -k -p *.mp3"
+alias aur="aurploader -r -l ~/.aurploader"
+alias bb="sudo bleachbit --clean system.cache system.localizations system.trash && sudo cacheclean 2"
+alias gitc="git commit -av ; git push -u origin master"
+alias pacman="pacman-color"
+alias pp="sudo pacman-color -Syu"
+alias upp='reflector -c "United States" -a 1 -f 3 --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist && sudo pacman-color -Syyu'
+alias fpp="echo 'Server = http://mirror.us.leaseweb.net/archlinux/\$repo/os/\$arch' > /etc/pacman.d/mirrorlist && pp"
+alias vup="vbox-headless-daemon start"
+alias vdo="vbox-headless-daemon stop"
+
+alias grep="grep --color=auto"
+alias zgrep="zgrep --color=auto"
+alias ma="cd /home/stuff/my_pkgbuild_files"
+alias ls="ls --group-directories-first --color"
+alias ll="ls -lh"
+alias la="ls -lha"
+alias lt="ls -lhtr"
+alias lta="ls -lhatr"
+
+alias mv="mv -i"
+alias ..="cd .."
+alias ...="cd ../.."
+alias ....="cd ../../.."
+alias hddtemp="sudo hddtemp"
+alias nets="sudo netstat -nlptu"
+alias nets2="sudo lsof -i"
+alias memrss='while read command percent rss; do if [[ "${command}" != "COMMAND" ]]; then rss="$(bc <<< "scale=2;${rss}/1024")"; fi; printf "%-26s%-8s%s\n" "${command}" "${percent}" "${rss}"; done < <(ps -A --sort -rss -o comm,pmem,rss | head -n 20)'
+alias pg='echo "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND" && ps aux | grep --color=auto'
+alias dmesg="dmesg | sed '/UFW/d'"
+
+# ssh shortcuts
+alias sa="$HOME/bin/s a"
+alias sl="$HOME/bin/s l"
+alias sj="$HOME/bin/s j"
+alias sj2="$HOME/bin/s j2 "
+alias sn="$HOME/bin/s n"
+alias sm="$HOME/bin/s m"
+alias smom="$HOME/bin/s mom"
+alias sr="$HOME/bin/s r"
+alias srepo="$HOME/bin/s repo"
+alias sw="$HOME/bin/s w"
+alias sx="$HOME/bin/s x"
+alias sxx="$HOME/bin/s xx"
View
@@ -0,0 +1,20 @@
+[[ -f $HOME/.bashrc2 ]] && . $HOME/.bashrc2
+[[ -f $HOME/.functions ]] && . $HOME/.functions
+[[ -f $HOME/.commonrc ]] && . $HOME/.commonrc
+[[ -f $HOME/.aliases ]] && . $HOME/.aliases
+
+export CHROOT=/scratch/chroot64
+export EDITOR=vim
+export VISUAL=vim
+set -o vi
+
+PS1='[\u@\h \W]\$ '
+
+# uncomment if using laptop
+#PS1="[\$(~/bin/battery_status] ] \u@\h:\w \$ "
+
+# make multiple shells share the same history file
+shopt -s histappend
+export PROMPT_COMMAND="history -a ; ${PROMPT_COMMAND:-:}"
+export HISTCONTROL=erasedups
+export HISTSIZE=10000
View
@@ -0,0 +1,8 @@
+echo -e "\x1B]2;$(whoami)@$(uname -n)\x07"; # set terminal title
+[[ -z "$PS1" ]] && return
+[[ -f /etc/profile ]] && . /etc/profile
+
+PATH=$PATH:$HOME/bin:$HOME/bin/browsers:$HOME/bin/makepkg:$HOME/bin/mounts:$HOME/bin/repo:$HOME/bin/benchmarking
+archey
+
+TERM=xterm-256color
@@ -0,0 +1,13 @@
+# ls colors
+autoload colors; colors;
+export LSCOLORS="Gxfxcxdxbxegedabagacad"
+
+setopt auto_cd
+setopt multios
+setopt cdablevarS
+
+# Apply theming defaults
+PS1="%n@%m:%~%# "
+
+# Setup the prompt with pretty colors
+setopt prompt_subst
@@ -0,0 +1,49 @@
+# fixme - the load process here seems a bit bizarre
+
+unsetopt menu_complete # do not autoselect the first completion entry
+unsetopt flowcontrol
+setopt auto_menu # show completion menu on succesive tab press
+setopt complete_in_word
+setopt always_to_end
+
+WORDCHARS=''
+
+zmodload -i zsh/complist
+
+zstyle ':completion:*' list-colors ''
+
+# should this be in keybindings?
+bindkey -M menuselect '^o' accept-and-infer-next-history
+
+zstyle ':completion:*:*:*:*:*' menu select
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
+
+# disable named-directories autocompletion
+zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
+cdpath=(.)
+
+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
+[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
+#[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
+hosts=(
+ "$_global_ssh_hosts[@]"
+ "$_ssh_hosts[@]"
+# "$_etc_hosts[@]"
+ "$HOST"
+ localhost
+)
+zstyle ':completion:*:hosts' hosts $hosts
+
+# Don't complete uninteresting users
+zstyle ':completion:*:*:*:users' ignored-patterns \
+ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
+ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
+ hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
+ mailman mailnull mldonkey mysql nagios \
+ named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
+ operator pcap postfix postgres privoxy pulse pvm quagga radvd \
+ rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
+
+# ... unless we really want to.
+zstyle '*' single-ignored show
@@ -0,0 +1,11 @@
+setopt correct_all
+
+alias man='nocorrect man'
+alias mv='nocorrect mv'
+alias mysql='nocorrect mysql'
+alias mkdir='nocorrect mkdir'
+alias gist='nocorrect gist'
+alias heroku='nocorrect heroku'
+alias ebuild='nocorrect ebuild'
+alias hpodder='nocorrect hpodder'
+alias sudo='nocorrect sudo'
@@ -0,0 +1,14 @@
+# Changing/making/removing directory
+setopt auto_name_dirs
+setopt auto_pushd
+setopt pushd_ignore_dups
+
+alias 1='cd -'
+alias 2='cd +2'
+alias 3='cd +3'
+alias 4='cd +4'
+alias 5='cd +5'
+alias 6='cd +6'
+alias 7='cd +7'
+alias 8='cd +8'
+alias 9='cd +9'
View
@@ -0,0 +1,10 @@
+## Command history configuration
+HISTFILE=$HOME/.zsh_history
+HISTSIZE=100000
+SAVEHIST=100000
+
+setopt append_history
+setopt hist_expire_dups_first
+setopt hist_ignore_space
+setopt inc_append_history
+setopt share_history # share command history data
View
@@ -0,0 +1,40 @@
+autoload up-line-or-beginning-search
+autoload down-line-or-beginning-search
+zle -N up-line-or-beginning-search
+zle -N down-line-or-beginning-search
+
+bindkey -v # set vim bindings
+# http://zshwiki.org/home/zle/bindkeys
+
+typeset -A key
+
+key[Home]=${terminfo[khome]}
+key[End]=${terminfo[kend]}
+key[Insert]=${terminfo[kich1]}
+key[Delete]=${terminfo[kdch1]}
+key[Up]=${terminfo[kcuu1]}
+key[Down]=${terminfo[kcud1]}
+key[Left]=${terminfo[kcub1]}
+key[Right]=${terminfo[kcuf1]}
+key[PageUp]=${terminfo[kpp]}
+key[PageDown]=${terminfo[knp]}
+key[Enter]=${terminfo[kent]}
+
+# setup key accordingly
+[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
+[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
+[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
+[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
+[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-beginning-search
+[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-beginning-search
+[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
+[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
+[[ -n "${key[Enter]}" ]] && bindkey "${key[Enter]}" enter
+
+# Finally, make sure the terminal is in application mode, when zle is
+# active. Only then are the values from $terminfo valid.
+zle-line-init () { echoti smkx }
+zle-line-finish () { echoti rmkx }
+
+zle -N zle-line-init
+zle -N zle-line-finish
@@ -0,0 +1,28 @@
+#!/bin/zsh
+# A script to make using 256 colors in zsh less painful.
+# P.C. Shyamshankar <sykora@lucentbeing.com>
+# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
+
+typeset -Ag FX FG BG
+
+FX=(
+ reset "%{%}"
+ bold "%{%}" no-bold "%{%}"
+ italic "%{%}" no-italic "%{%}"
+ underline "%{%}" no-underline "%{%}"
+ blink "%{%}" no-blink "%{%}"
+ reverse "%{%}" no-reverse "%{%}"
+)
+
+for color in {000..255}; do
+ FG[$color]="%{[38;5;${color}m%}"
+ BG[$color]="%{[48;5;${color}m%}"
+done
+
+# Show all 256 colors with color number
+function spectrum_ls() {
+ for code in {000..255}; do
+ print -P -- "$code: %F{$code}Test%f"
+ done
+}
+
@@ -0,0 +1,49 @@
+zsh-syntax-highlighting / highlighters
+======================================
+
+Syntax highlighting is done by pluggable highlighters:
+
+* [***main***](highlighters/main) - the base highlighter, and the only one active by default.
+* [***brackets***](highlighters/brackets) - matches brackets and parenthesis.
+* [***pattern***](highlighters/pattern) - matches user-defined patterns.
+* [***cursor***](highlighters/cursor) - matches the cursor position.
+* [***root***](highlighters/root) - triggered if the current user is root.
+
+
+How to activate highlighters
+----------------------------
+
+To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array in `~/.zshrc`, for example:
+
+ ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
+
+
+How to tweak highlighters
+-------------------------
+
+Highlighters look up styles from the `ZSH_HIGHLIGHT_STYLES` array. Navigate into each highlighter directory to see what styles it defines and how to configure it.
+
+
+How to implement a new highlighter
+----------------------------------
+
+To create your own ***myhighlighter*** highlighter:
+
+* Create your script at **highlighters/*myhighlighter*/*myhighlighter*-highlighter.zsh**.
+* Implement the `_zsh_highlight_myhighlighter_highlighter_predicate` function. This function must return 0 when the highlighter needs to be called, for example:
+
+ _zsh_highlight_myhighlighter_highlighter_predicate() {
+ # Call this highlighter in SVN repositories
+ [[ -d .svn ]]
+ }
+
+* Implement the `_zsh_highlight_myhighlighter_highlighter` function. This function does the actual syntax highlighting, by modifying `region_highlight`, for example:
+
+ _zsh_highlight_myhighlighter_highlighter() {
+ # Colorize the whole buffer with blue background
+ region_highlight+=(0 $#BUFFER bg=blue)
+ }
+
+* Activate your highlighter in `~/.zshrc`:
+
+ ZSH_HIGHLIGHT_HIGHLIGHTERS+=(myhighlighter)
@@ -0,0 +1,30 @@
+zsh-syntax-highlighting / highlighters / brackets
+=================================================
+
+This is the ***brackets*** highlighter, that highlights brackets, parenthesis and matches them.
+
+
+How to activate it
+------------------
+To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`:
+
+ ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] brackets)
+
+
+How to tweak it
+---------------
+This highlighter defines the following styles:
+
+* `bracket-error` - unmatched brackets
+* `bracket-level-N` - brackets with nest level N
+* `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket
+
+To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`:
+
+ # To define styles for nested brackets up to level 4
+ ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
+ ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
+ ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
+ ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
+
+The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135).
Oops, something went wrong.

0 comments on commit bd6b2e3

Please sign in to comment.