forked from colonelpanic/dotfiles
Add iterm settings, tweak bootstrap, bump eamcs pointer.
Fix web_start. Add remote_clipboard server stuff. Bump .emacs.d pointer and add remote_os_copy alias. Way better get_cols Made git sui git suir move to same sha as yelp branch for .emacs.d Bump emacs pointer. simplified default code for remote_clipboard. Remove unused functions from .functions. Added things from yelp branch. yelpify Added field separator to get_cols. Lots of refactoring. Added .lib directory. Moved dotfiles that get symlinked to ~ into their own directory. Remove some vim configuration. Remove oh-my-zsh.
This commit is contained in:
parent
448eebed44
commit
6174990049
107
.aliases
107
.aliases
@ -1,107 +0,0 @@
|
|||||||
alias g="git"
|
|
||||||
alias h="history"
|
|
||||||
alias j="jobs"
|
|
||||||
alias emacs="emacsclient -t"
|
|
||||||
alias readlink="greadlink"
|
|
||||||
|
|
||||||
# Detect which `ls` flavor is in use
|
|
||||||
if ls --color > /dev/null 2>&1; then # GNU `ls`
|
|
||||||
colorflag="--color"
|
|
||||||
else # OS X `ls`
|
|
||||||
colorflag="-G"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Always use color output for `ls`
|
|
||||||
alias ls="command ls ${colorflag}"
|
|
||||||
export 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:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
|
|
||||||
|
|
||||||
# Enable aliases to be sudo’ed
|
|
||||||
alias sudo='sudo '
|
|
||||||
|
|
||||||
# Gzip-enabled `curl`
|
|
||||||
alias gurl="curl --compressed"
|
|
||||||
|
|
||||||
# IP addresses
|
|
||||||
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
|
||||||
alias localip="ipconfig getifaddr en1"
|
|
||||||
alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'"
|
|
||||||
|
|
||||||
# Enhanced WHOIS lookups
|
|
||||||
alias whois="whois -h whois-servers.net"
|
|
||||||
|
|
||||||
# Flush Directory Service cache
|
|
||||||
alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"
|
|
||||||
|
|
||||||
# Clean up LaunchServices to remove duplicates in the “Open With” menu
|
|
||||||
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
|
|
||||||
|
|
||||||
# View HTTP traffic
|
|
||||||
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
|
|
||||||
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
|
|
||||||
|
|
||||||
# Canonical hex dump; some systems have this symlinked
|
|
||||||
command -v hd > /dev/null || alias hd="hexdump -C"
|
|
||||||
|
|
||||||
# OS X has no `md5sum`, so use `md5` as a fallback
|
|
||||||
command -v md5sum > /dev/null || alias md5sum="md5"
|
|
||||||
|
|
||||||
# OS X has no `sha1sum`, so use `shasum` as a fallback
|
|
||||||
command -v sha1sum > /dev/null || alias sha1sum="shasum"
|
|
||||||
|
|
||||||
# Trim new lines and copy to clipboard
|
|
||||||
alias c="tr -d '\n' | pbcopy"
|
|
||||||
|
|
||||||
# Recursively delete `.DS_Store` files
|
|
||||||
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
|
|
||||||
|
|
||||||
# ROT13-encode text. Works for decoding, too! ;)
|
|
||||||
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
|
|
||||||
|
|
||||||
# Empty the Trash on all mounted volumes and the main HDD
|
|
||||||
# Also, clear Apple’s System Logs to improve shell startup speed
|
|
||||||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
|
||||||
|
|
||||||
# Show/hide hidden files in Finder
|
|
||||||
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
|
||||||
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
|
||||||
|
|
||||||
# Hide/show all desktop icons (useful when presenting)
|
|
||||||
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
|
|
||||||
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
|
|
||||||
|
|
||||||
# URL-encode strings
|
|
||||||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
|
|
||||||
|
|
||||||
# Merge PDF files
|
|
||||||
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
|
|
||||||
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
|
|
||||||
|
|
||||||
# Disable Spotlight
|
|
||||||
alias spotoff="sudo mdutil -a -i off"
|
|
||||||
# Enable Spotlight
|
|
||||||
alias spoton="sudo mdutil -a -i on"
|
|
||||||
|
|
||||||
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
|
|
||||||
alias plistbuddy="/usr/libexec/PlistBuddy"
|
|
||||||
|
|
||||||
# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon
|
|
||||||
# (useful when executing time-consuming commands)
|
|
||||||
alias badge="tput bel"
|
|
||||||
|
|
||||||
# Intuitive map function
|
|
||||||
# For example, to list all directories that contain a certain file:
|
|
||||||
# find . -name .gitattributes | map dirname
|
|
||||||
alias map="xargs -n1"
|
|
||||||
|
|
||||||
# One of @janmoesen’s ProTip™s
|
|
||||||
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
|
|
||||||
alias "$method"="lwp-request -m '$method'"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
|
|
||||||
alias stfu="osascript -e 'set volume output muted true'"
|
|
||||||
alias pumpitup="osascript -e 'set volume 7'"
|
|
||||||
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'"
|
|
||||||
|
|
||||||
alias tmux="tmux -2"
|
|
||||||
alias prj='cd ~/Dropbox/Projects'
|
|
1
.emacs.d
1
.emacs.d
@ -1 +0,0 @@
|
|||||||
Subproject commit 9935c9bdfd61f39f7fdab004a92f192908b9a931
|
|
215
.functions
215
.functions
@ -1,215 +0,0 @@
|
|||||||
function get_cols() {
|
|
||||||
# Usage: get_cols [file_name] [column_num]
|
|
||||||
column_list=""
|
|
||||||
for column_num in $@
|
|
||||||
do
|
|
||||||
[ -r $column_num ] && continue
|
|
||||||
|
|
||||||
if echo $column_num | grep '\-F' ; then
|
|
||||||
separator=$(echo $column_num | sed 's/-F//g' )
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ $column_num -lt '0' ] && column_num="(NF + 1 $column_num )" #Negative indices like python's array[-1]
|
|
||||||
|
|
||||||
[ -z $column_list ] && column_num="\$$column_num" || column_num=",\$$column_num" # Place commas appropriately.
|
|
||||||
|
|
||||||
column_list="$column_list$column_num"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Is the first parameter a file?
|
|
||||||
awk_string="BEGIN { FS = \"$separator\" } ; {print $column_list}"
|
|
||||||
|
|
||||||
if [ -r $1 ]; then
|
|
||||||
awk $awk_string $1
|
|
||||||
else
|
|
||||||
awk "$awk_string"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset column_list
|
|
||||||
unset awk_string
|
|
||||||
}
|
|
||||||
|
|
||||||
function note() {
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
(ym && exec $EDITOR $HOME/notes/$(git rev-parse --abbrev-ref HEAD)) ;
|
|
||||||
else
|
|
||||||
$EDITOR $HOME/notes/"$*" ;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function list_notes() {
|
|
||||||
ls -c $HOME/notes/ | grep "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_shas_that_touched() {
|
|
||||||
git log --oneline --reverse "$@" | get_col 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function echo_hash_if_exp_found_in_filename_diff() {
|
|
||||||
[ ! -z "$(git diff $1~1 $1 -- $2 | cat | grep $3)" ] && echo $1
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_shas_that_touched_with_grep() {
|
|
||||||
get_shas_that_touched $1 | xargs -I the_hash sh -c 'echo_hash_if_exp_found_in_filename_diff the_hash $1 $2'
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_interdiffs_matching_grep() {
|
|
||||||
get_shas_that_touched_with_grep $1 $2 | xargs -I hash sh -c 'git diff hash~1 hash -- $1'
|
|
||||||
}
|
|
||||||
|
|
||||||
function find_all_ssh_agent_sockets() {
|
|
||||||
find /tmp -type s -name agent.\* 2> /dev/null | grep '/tmp/ssh-.*/agent.*'
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_ssh_agent_socket() {
|
|
||||||
export SSH_AUTH_SOCK=$(find_all_ssh_agent_sockets | tail -n 1 | awk -F: '{print $1}')
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a new directory and enter it
|
|
||||||
function mkd() {
|
|
||||||
mkdir -p "$@" && cd "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determine size of a file or total size of a directory
|
|
||||||
function fs() {
|
|
||||||
if du -b /dev/null > /dev/null 2>&1; then
|
|
||||||
local arg=-sbh
|
|
||||||
else
|
|
||||||
local arg=-sh
|
|
||||||
fi
|
|
||||||
if [[ -n "$@" ]]; then
|
|
||||||
du $arg -- "$@"
|
|
||||||
else
|
|
||||||
du $arg .[^.]* *
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use Git’s colored diff when available
|
|
||||||
hash git &>/dev/null
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
function diff() {
|
|
||||||
git diff --no-index --color-words "$@"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a data URL from a file
|
|
||||||
function dataurl() {
|
|
||||||
local mimeType=$(file -b --mime-type "$1")
|
|
||||||
if [[ $mimeType == text/* ]]; then
|
|
||||||
mimeType="${mimeType};charset=utf-8"
|
|
||||||
fi
|
|
||||||
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start an HTTP server from a directory, optionally specifying the port
|
|
||||||
function server() {
|
|
||||||
local port="${1:-8000}"
|
|
||||||
sleep 1 && open "http://localhost:${port}/" &
|
|
||||||
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
|
||||||
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
|
||||||
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start a PHP server from a directory, optionally specifying the port
|
|
||||||
# (Requires PHP 5.4.0+.)
|
|
||||||
function phpserver() {
|
|
||||||
local port="${1:-4000}"
|
|
||||||
local ip=$(ipconfig getifaddr en1)
|
|
||||||
sleep 1 && open "http://${ip}:${port}/" &
|
|
||||||
php -S "${ip}:${port}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compare original and gzipped file size
|
|
||||||
function gz() {
|
|
||||||
local origsize=$(wc -c < "$1")
|
|
||||||
local gzipsize=$(gzip -c "$1" | wc -c)
|
|
||||||
local ratio=$(echo "$gzipsize * 100/ $origsize" | bc -l)
|
|
||||||
printf "orig: %d bytes\n" "$origsize"
|
|
||||||
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
|
|
||||||
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
|
|
||||||
function httpcompression() {
|
|
||||||
encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Syntax-highlight JSON strings or files
|
|
||||||
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
|
|
||||||
function json() {
|
|
||||||
if [ -t 0 ]; then # argument
|
|
||||||
python -mjson.tool <<< "$*" | pygmentize -l javascript
|
|
||||||
else # pipe
|
|
||||||
python -mjson.tool | pygmentize -l javascript
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# All the dig info
|
|
||||||
function digga() {
|
|
||||||
dig +nocmd "$1" any +multiline +noall +answer
|
|
||||||
}
|
|
||||||
|
|
||||||
# Escape UTF-8 characters into their 3-byte format
|
|
||||||
function escape() {
|
|
||||||
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
|
|
||||||
echo # newline
|
|
||||||
}
|
|
||||||
|
|
||||||
# Decode \x{ABCD}-style Unicode escape sequences
|
|
||||||
function unidecode() {
|
|
||||||
perl -e "binmode(STDOUT, ':utf8'); print \"$@\""
|
|
||||||
echo # newline
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get a character’s Unicode code point
|
|
||||||
function codepoint() {
|
|
||||||
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))"
|
|
||||||
echo # newline
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add note to Notes.app (OS X 10.8)
|
|
||||||
# Usage: `note 'foo'` or `echo 'foo' | note`
|
|
||||||
function note() {
|
|
||||||
local text
|
|
||||||
if [ -t 0 ]; then # argument
|
|
||||||
text="$1"
|
|
||||||
else # pipe
|
|
||||||
text=$(cat)
|
|
||||||
fi
|
|
||||||
body=$(echo "$text" | sed -E 's|$|<br>|g')
|
|
||||||
osascript >/dev/null <<EOF
|
|
||||||
tell application "Notes"
|
|
||||||
tell account "iCloud"
|
|
||||||
tell folder "Notes"
|
|
||||||
make new note with properties {name:"$text", body:"$body"}
|
|
||||||
end tell
|
|
||||||
end tell
|
|
||||||
end tell
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add reminder to Reminders.app (OS X 10.8)
|
|
||||||
# Usage: `remind 'foo'` or `echo 'foo' | remind`
|
|
||||||
function remind() {
|
|
||||||
local text
|
|
||||||
if [ -t 0 ]; then
|
|
||||||
text="$1" # argument
|
|
||||||
else
|
|
||||||
text=$(cat) # pipe
|
|
||||||
fi
|
|
||||||
osascript >/dev/null <<EOF
|
|
||||||
tell application "Reminders"
|
|
||||||
tell the default list
|
|
||||||
make new reminder with properties {name:"$text"}
|
|
||||||
end tell
|
|
||||||
end tell
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# Manually remove a downloaded app or file from the quarantine
|
|
||||||
function unquarantine() {
|
|
||||||
for attribute in com.apple.metadata:kMDItemDownloadedDate com.apple.metadata:kMDItemWhereFroms com.apple.quarantine; do
|
|
||||||
xattr -r -d "$attribute" "$@"
|
|
||||||
done
|
|
||||||
}
|
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -3,7 +3,4 @@
|
|||||||
url = git@github.com:IvanMalison/tmux-powerline.git
|
url = git@github.com:IvanMalison/tmux-powerline.git
|
||||||
[submodule ".emacs.d"]
|
[submodule ".emacs.d"]
|
||||||
path = .emacs.d
|
path = .emacs.d
|
||||||
url = git@github.com:IvanMalison/.emacs.d.git
|
url = git@github.com:IvanMalison/.emacs.d.git
|
||||||
[submodule "oh-my-zsh"]
|
|
||||||
path = oh-my-zsh
|
|
||||||
url = git@github.com:IvanMalison/oh-my-zsh.git
|
|
6
.gvimrc
6
.gvimrc
@ -1,6 +0,0 @@
|
|||||||
" Use the excellent Railscat theme by Jeff Kreeftmeijer (gVim-only)
|
|
||||||
colorscheme railscat
|
|
||||||
" Use 14pt Menlo
|
|
||||||
set guifont=Menlo:h14
|
|
||||||
" Better line-height
|
|
||||||
set linespace=8
|
|
@ -1,210 +0,0 @@
|
|||||||
" Vim color file
|
|
||||||
"
|
|
||||||
" Author: Tomas Restrepo <tomas@winterdom.com>
|
|
||||||
"
|
|
||||||
" Note: Based on the monokai theme for TextMate
|
|
||||||
" by Wimer Hazenberg and its darker variant
|
|
||||||
" by Hamish Stuart Macpherson
|
|
||||||
"
|
|
||||||
|
|
||||||
hi clear
|
|
||||||
|
|
||||||
set background=dark
|
|
||||||
if version > 580
|
|
||||||
" no guarantees for version 5.8 and below, but this makes it stop
|
|
||||||
" complaining
|
|
||||||
hi clear
|
|
||||||
if exists("syntax_on")
|
|
||||||
syntax reset
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let g:colors_name="molokai"
|
|
||||||
|
|
||||||
if exists("g:molokai_original")
|
|
||||||
let s:molokai_original = g:molokai_original
|
|
||||||
else
|
|
||||||
let s:molokai_original = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
hi Boolean guifg=#AE81FF
|
|
||||||
hi Character guifg=#E6DB74
|
|
||||||
hi Number guifg=#AE81FF
|
|
||||||
hi String guifg=#E6DB74
|
|
||||||
hi Conditional guifg=#F92672 gui=bold
|
|
||||||
hi Constant guifg=#AE81FF gui=bold
|
|
||||||
hi Cursor guifg=#000000 guibg=#F8F8F0
|
|
||||||
hi Debug guifg=#BCA3A3 gui=bold
|
|
||||||
hi Define guifg=#66D9EF
|
|
||||||
hi Delimiter guifg=#8F8F8F
|
|
||||||
hi DiffAdd guibg=#13354A
|
|
||||||
hi DiffChange guifg=#89807D guibg=#4C4745
|
|
||||||
hi DiffDelete guifg=#960050 guibg=#1E0010
|
|
||||||
hi DiffText guibg=#4C4745 gui=italic,bold
|
|
||||||
|
|
||||||
hi Directory guifg=#A6E22E gui=bold
|
|
||||||
hi Error guifg=#960050 guibg=#1E0010
|
|
||||||
hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
|
|
||||||
hi Exception guifg=#A6E22E gui=bold
|
|
||||||
hi Float guifg=#AE81FF
|
|
||||||
hi FoldColumn guifg=#465457 guibg=#000000
|
|
||||||
hi Folded guifg=#465457 guibg=#000000
|
|
||||||
hi Function guifg=#A6E22E
|
|
||||||
hi Identifier guifg=#FD971F
|
|
||||||
hi Ignore guifg=#808080 guibg=bg
|
|
||||||
hi IncSearch guifg=#C4BE89 guibg=#000000
|
|
||||||
|
|
||||||
hi Keyword guifg=#F92672 gui=bold
|
|
||||||
hi Label guifg=#E6DB74 gui=none
|
|
||||||
hi Macro guifg=#C4BE89 gui=italic
|
|
||||||
hi SpecialKey guifg=#66D9EF gui=italic
|
|
||||||
|
|
||||||
hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
|
|
||||||
hi ModeMsg guifg=#E6DB74
|
|
||||||
hi MoreMsg guifg=#E6DB74
|
|
||||||
hi Operator guifg=#F92672
|
|
||||||
|
|
||||||
" complete menu
|
|
||||||
hi Pmenu guifg=#66D9EF guibg=#000000
|
|
||||||
hi PmenuSel guibg=#808080
|
|
||||||
hi PmenuSbar guibg=#080808
|
|
||||||
hi PmenuThumb guifg=#66D9EF
|
|
||||||
|
|
||||||
hi PreCondit guifg=#A6E22E gui=bold
|
|
||||||
hi PreProc guifg=#A6E22E
|
|
||||||
hi Question guifg=#66D9EF
|
|
||||||
hi Repeat guifg=#F92672 gui=bold
|
|
||||||
hi Search guifg=#FFFFFF guibg=#455354
|
|
||||||
" marks column
|
|
||||||
hi SignColumn guifg=#A6E22E guibg=#232526
|
|
||||||
hi SpecialChar guifg=#F92672 gui=bold
|
|
||||||
hi SpecialComment guifg=#465457 gui=bold
|
|
||||||
hi Special guifg=#66D9EF guibg=bg gui=italic
|
|
||||||
hi SpecialKey guifg=#888A85 gui=italic
|
|
||||||
if has("spell")
|
|
||||||
hi SpellBad guisp=#FF0000 gui=undercurl
|
|
||||||
hi SpellCap guisp=#7070F0 gui=undercurl
|
|
||||||
hi SpellLocal guisp=#70F0F0 gui=undercurl
|
|
||||||
hi SpellRare guisp=#FFFFFF gui=undercurl
|
|
||||||
endif
|
|
||||||
hi Statement guifg=#F92672 gui=bold
|
|
||||||
hi StatusLine guifg=#455354 guibg=fg
|
|
||||||
hi StatusLineNC guifg=#808080 guibg=#080808
|
|
||||||
hi StorageClass guifg=#FD971F gui=italic
|
|
||||||
hi Structure guifg=#66D9EF
|
|
||||||
hi Tag guifg=#F92672 gui=italic
|
|
||||||
hi Title guifg=#ef5939
|
|
||||||
hi Todo guifg=#FFFFFF guibg=bg gui=bold
|
|
||||||
|
|
||||||
hi Typedef guifg=#66D9EF
|
|
||||||
hi Type guifg=#66D9EF gui=none
|
|
||||||
hi Underlined guifg=#808080 gui=underline
|
|
||||||
|
|
||||||
hi VertSplit guifg=#808080 guibg=#080808 gui=bold
|
|
||||||
hi VisualNOS guibg=#403D3D
|
|
||||||
hi Visual guibg=#403D3D
|
|
||||||
hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
|
|
||||||
hi WildMenu guifg=#66D9EF guibg=#000000
|
|
||||||
|
|
||||||
if s:molokai_original == 1
|
|
||||||
hi Normal guifg=#F8F8F2 guibg=#272822
|
|
||||||
hi Comment guifg=#75715E
|
|
||||||
hi CursorLine guibg=#3E3D32
|
|
||||||
hi CursorColumn guibg=#3E3D32
|
|
||||||
hi LineNr guifg=#BCBCBC guibg=#3B3A32
|
|
||||||
hi NonText guifg=#BCBCBC guibg=#3B3A32
|
|
||||||
else
|
|
||||||
hi Normal guifg=#F8F8F2 guibg=#1B1D1E
|
|
||||||
hi Comment guifg=#465457
|
|
||||||
hi CursorLine guibg=#293739
|
|
||||||
hi CursorColumn guibg=#293739
|
|
||||||
hi LineNr guifg=#BCBCBC guibg=#232526
|
|
||||||
hi NonText guifg=#BCBCBC guibg=#232526
|
|
||||||
end
|
|
||||||
|
|
||||||
"
|
|
||||||
" Support for 256-color terminal
|
|
||||||
"
|
|
||||||
if &t_Co > 255
|
|
||||||
hi Boolean ctermfg=135
|
|
||||||
hi Character ctermfg=144
|
|
||||||
hi Number ctermfg=135
|
|
||||||
hi String ctermfg=144
|
|
||||||
hi Conditional ctermfg=161 cterm=bold
|
|
||||||
hi Constant ctermfg=135 cterm=bold
|
|
||||||
hi Cursor ctermfg=16 ctermbg=253
|
|
||||||
hi Debug ctermfg=225 cterm=bold
|
|
||||||
hi Define ctermfg=81
|
|
||||||
hi Delimiter ctermfg=241
|
|
||||||
|
|
||||||
hi DiffAdd ctermbg=24
|
|
||||||
hi DiffChange ctermfg=181 ctermbg=239
|
|
||||||
hi DiffDelete ctermfg=162 ctermbg=53
|
|
||||||
hi DiffText ctermbg=102 cterm=bold
|
|
||||||
|
|
||||||
hi Directory ctermfg=118 cterm=bold
|
|
||||||
hi Error ctermfg=219 ctermbg=89
|
|
||||||
hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
|
|
||||||
hi Exception ctermfg=118 cterm=bold
|
|
||||||
hi Float ctermfg=135
|
|
||||||
hi FoldColumn ctermfg=67 ctermbg=16
|
|
||||||
hi Folded ctermfg=67 ctermbg=16
|
|
||||||
hi Function ctermfg=118
|
|
||||||
hi Identifier ctermfg=208
|
|
||||||
hi Ignore ctermfg=244 ctermbg=232
|
|
||||||
hi IncSearch ctermfg=193 ctermbg=16
|
|
||||||
|
|
||||||
hi Keyword ctermfg=161 cterm=bold
|
|
||||||
hi Label ctermfg=229 cterm=none
|
|
||||||
hi Macro ctermfg=193
|
|
||||||
hi SpecialKey ctermfg=81
|
|
||||||
|
|
||||||
hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
|
|
||||||
hi ModeMsg ctermfg=229
|
|
||||||
hi MoreMsg ctermfg=229
|
|
||||||
hi Operator ctermfg=161
|
|
||||||
|
|
||||||
" complete menu
|
|
||||||
hi Pmenu ctermfg=81 ctermbg=16
|
|
||||||
hi PmenuSel ctermbg=244
|
|
||||||
hi PmenuSbar ctermbg=232
|
|
||||||
hi PmenuThumb ctermfg=81
|
|
||||||
|
|
||||||
hi PreCondit ctermfg=118 cterm=bold
|
|
||||||
hi PreProc ctermfg=118
|
|
||||||
hi Question ctermfg=81
|
|
||||||
hi Repeat ctermfg=161 cterm=bold
|
|
||||||
hi Search ctermfg=253 ctermbg=66
|
|
||||||
|
|
||||||
" marks column
|
|
||||||
hi SignColumn ctermfg=118 ctermbg=235
|
|
||||||
hi SpecialChar ctermfg=161 cterm=bold
|
|
||||||
hi SpecialComment ctermfg=245 cterm=bold
|
|
||||||
hi Special ctermfg=81 ctermbg=232
|
|
||||||
hi SpecialKey ctermfg=245
|
|
||||||
|
|
||||||
hi Statement ctermfg=161 cterm=bold
|
|
||||||
hi StatusLine ctermfg=238 ctermbg=253
|
|
||||||
hi StatusLineNC ctermfg=244 ctermbg=232
|
|
||||||
hi StorageClass ctermfg=208
|
|
||||||
hi Structure ctermfg=81
|
|
||||||
hi Tag ctermfg=161
|
|
||||||
hi Title ctermfg=166
|
|
||||||
hi Todo ctermfg=231 ctermbg=232 cterm=bold
|
|
||||||
|
|
||||||
hi Typedef ctermfg=81
|
|
||||||
hi Type ctermfg=81 cterm=none
|
|
||||||
hi Underlined ctermfg=244 cterm=underline
|
|
||||||
|
|
||||||
hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
|
|
||||||
hi VisualNOS ctermbg=238
|
|
||||||
hi Visual ctermbg=235
|
|
||||||
hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
|
|
||||||
hi WildMenu ctermfg=81 ctermbg=16
|
|
||||||
|
|
||||||
hi Normal ctermfg=252 ctermbg=233
|
|
||||||
hi Comment ctermfg=59
|
|
||||||
hi CursorLine ctermbg=234 cterm=none
|
|
||||||
hi CursorColumn ctermbg=234
|
|
||||||
hi LineNr ctermfg=250 ctermbg=234
|
|
||||||
hi NonText ctermfg=250 ctermbg=234
|
|
||||||
end
|
|
@ -1,133 +0,0 @@
|
|||||||
" Vim color scheme
|
|
||||||
"
|
|
||||||
" Name: railscat.vim
|
|
||||||
" Maintainer: Jeff Kreeftmeijer
|
|
||||||
" License: public domain
|
|
||||||
" URL: https://gist.github.com/1523432
|
|
||||||
"
|
|
||||||
" A GUI only extended version of the Railscasts+ theme, that comes with
|
|
||||||
" Janus [1] and is, in turn, an extension to the original Railscasts theme
|
|
||||||
" [2], which is a port of the RailsCasts TextMate theme [3] to Vim.
|
|
||||||
"
|
|
||||||
" [1] https://github.com/carlhuda/janus
|
|
||||||
" [2] http://www.vim.org/scripts/script.php?script_id=2175
|
|
||||||
" [3] http://railscasts.com/about
|
|
||||||
|
|
||||||
set background=dark
|
|
||||||
hi clear
|
|
||||||
if exists("syntax_on")
|
|
||||||
syntax reset
|
|
||||||
endif
|
|
||||||
let g:colors_name = "railscat"
|
|
||||||
|
|
||||||
" Colors
|
|
||||||
" Brown #BC9458
|
|
||||||
" Dark Blue #6D9CBE
|
|
||||||
" Dark Green #519F50
|
|
||||||
" Dark Orange #CC7833
|
|
||||||
" Light Blue #D0D0FF
|
|
||||||
" Light Green #A5C261
|
|
||||||
" Tan #FFC66D
|
|
||||||
|
|
||||||
hi Normal guifg=#E6E1DC guibg=#2B2B2B
|
|
||||||
hi Cursor guibg=#FFFFFF
|
|
||||||
hi Search guibg=#5A647E
|
|
||||||
hi Visual guibg=#5A647E
|
|
||||||
|
|
||||||
" Folds
|
|
||||||
" -----
|
|
||||||
" line used for closed folds
|
|
||||||
hi Folded guifg=#F6F3E8 guibg=#444444 gui=NONE
|
|
||||||
|
|
||||||
" Misc
|
|
||||||
" ----
|
|
||||||
" directory names and other special names in listings
|
|
||||||
hi Directory guifg=#A5C261 gui=NONE
|
|
||||||
|
|
||||||
" Popup Menu
|
|
||||||
" ----------
|
|
||||||
" normal item in popup
|
|
||||||
hi Pmenu guifg=#F6F3E8 guibg=#444444 gui=NONE
|
|
||||||
" selected item in popup
|
|
||||||
hi PmenuSel guifg=#000000 guibg=#A5C261 gui=NONE
|
|
||||||
" scrollbar in popup
|
|
||||||
hi PMenuSbar guibg=#5A647E gui=NONE
|
|
||||||
" thumb of the scrollbar in the popup
|
|
||||||
hi PMenuThumb guibg=#AAAAAA gui=NONE
|
|
||||||
|
|
||||||
"rubyComment
|
|
||||||
hi Comment guifg=#BC9458 gui=italic
|
|
||||||
hi Todo guifg=#BC9458 guibg=NONE gui=italic
|
|
||||||
|
|
||||||
"rubyPseudoVariable
|
|
||||||
"nil, self, symbols, etc
|
|
||||||
hi Constant guifg=#6D9CBE
|
|
||||||
|
|
||||||
"rubyClass, rubyModule, rubyDefine
|
|
||||||
"def, end, include, etc
|
|
||||||
hi Define guifg=#CC7833
|
|
||||||
|
|
||||||
"rubyInterpolation
|
|
||||||
hi Delimiter guifg=#519F50
|
|
||||||
|
|
||||||
"rubyError, rubyInvalidVariable
|
|
||||||
hi Error guifg=#FFFFFF guibg=#990000
|
|
||||||
|
|
||||||
"rubyFunction
|
|
||||||
hi Function guifg=#FFC66D gui=NONE
|
|
||||||
|
|
||||||
"rubyIdentifier
|
|
||||||
"@var, @@var, $var, etc
|
|
||||||
hi Identifier guifg=#D0D0FF gui=NONE
|
|
||||||
|
|
||||||
"rubyInclude
|
|
||||||
"include, autoload, extend, load, require
|
|
||||||
hi Include guifg=#CC7833 gui=NONE
|
|
||||||
|
|
||||||
"rubyKeyword, rubyKeywordAsMethod
|
|
||||||
"alias, undef, super, yield, callcc, caller, lambda, proc
|
|
||||||
hi Keyword guifg=#CC7833
|
|
||||||
|
|
||||||
" same as define
|
|
||||||
hi Macro guifg=#CC7833 gui=NONE
|
|
||||||
|
|
||||||
"rubyInteger
|
|
||||||
hi Number guifg=#A5C261
|
|
||||||
|
|
||||||
" #if, #else, #endif
|
|
||||||
hi PreCondit guifg=#CC7833 gui=NONE
|
|
||||||
|
|
||||||
" generic preprocessor
|
|
||||||
hi PreProc guifg=#CC7833 gui=NONE
|
|
||||||
|
|
||||||
"rubyControl, rubyAccess, rubyEval
|
|
||||||
"case, begin, do, for, if unless, while, until else, etc.
|
|
||||||
hi Statement guifg=#CC7833 gui=NONE
|
|
||||||
|
|
||||||
"rubyString
|
|
||||||
hi String guifg=#A5C261
|
|
||||||
|
|
||||||
hi Title guifg=#FFFFFF
|
|
||||||
|
|
||||||
"rubyConstant
|
|
||||||
hi Type guifg=#DA4939 gui=NONE
|
|
||||||
|
|
||||||
hi DiffAdd guifg=#E6E1DC guibg=#144212
|
|
||||||
hi DiffDelete guifg=#E6E1DC guibg=#660000
|
|
||||||
|
|
||||||
hi link htmlTag xmlTag
|
|
||||||
hi link htmlTagName xmlTagName
|
|
||||||
hi link htmlEndTag xmlEndTag
|
|
||||||
|
|
||||||
hi xmlTag guifg=#E8BF6A
|
|
||||||
hi xmlTagName guifg=#E8BF6A
|
|
||||||
hi xmlEndTag guifg=#E8BF6A
|
|
||||||
|
|
||||||
hi StatusLine guibg=#cccccc guifg=#000000
|
|
||||||
hi StatusLineNC guibg=#666666 guifg=#333333
|
|
||||||
hi CursorLine guibg=#262626
|
|
||||||
hi VertSplit guifg=#262626
|
|
||||||
hi ColorColumn guibg=#262626
|
|
||||||
hi LineNr guifg=#666666 guibg=#333333
|
|
||||||
hi NonText guifg=#666666
|
|
||||||
hi SignColumn guibg=#666666
|
|
@ -1,74 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
" Language: JSON
|
|
||||||
" Maintainer: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
|
|
||||||
" Last Change: 2009-06-16
|
|
||||||
" Version: 0.4
|
|
||||||
" {{{1
|
|
||||||
|
|
||||||
" Syntax setup {{{2
|
|
||||||
" For version 5.x: Clear all syntax items
|
|
||||||
" For version 6.x: Quit when a syntax file was already loaded
|
|
||||||
|
|
||||||
if !exists("main_syntax")
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let main_syntax = 'json'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Syntax: Strings {{{2
|
|
||||||
syn region jsonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=jsonEscape
|
|
||||||
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
|
|
||||||
syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+
|
|
||||||
|
|
||||||
" Syntax: Escape sequences {{{3
|
|
||||||
syn match jsonEscape "\\["\\/bfnrt]" contained
|
|
||||||
syn match jsonEscape "\\u\x\{4}" contained
|
|
||||||
|
|
||||||
" Syntax: Strings should always be enclosed with quotes.
|
|
||||||
syn match jsonNoQuotes "\<\a\+\>"
|
|
||||||
|
|
||||||
" Syntax: Numbers {{{2
|
|
||||||
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"
|
|
||||||
|
|
||||||
" Syntax: An integer part of 0 followed by other digits is not allowed.
|
|
||||||
syn match jsonNumError "-\=\<0\d\.\d*\>"
|
|
||||||
|
|
||||||
" Syntax: Boolean {{{2
|
|
||||||
syn keyword jsonBoolean true false
|
|
||||||
|
|
||||||
" Syntax: Null {{{2
|
|
||||||
syn keyword jsonNull null
|
|
||||||
|
|
||||||
" Syntax: Braces {{{2
|
|
||||||
syn match jsonBraces "[{}\[\]]"
|
|
||||||
|
|
||||||
" Define the default highlighting. {{{1
|
|
||||||
" For version 5.7 and earlier: only when not done already
|
|
||||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
||||||
if version >= 508 || !exists("did_json_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_json_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsonString String
|
|
||||||
HiLink jsonEscape Special
|
|
||||||
HiLink jsonNumber Number
|
|
||||||
HiLink jsonBraces Operator
|
|
||||||
HiLink jsonNull Function
|
|
||||||
HiLink jsonBoolean Boolean
|
|
||||||
|
|
||||||
HiLink jsonNumError Error
|
|
||||||
HiLink jsonStringSQ Error
|
|
||||||
HiLink jsonNoQuotes Error
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:current_syntax = "json"
|
|
||||||
if main_syntax == 'json'
|
|
||||||
unlet main_syntax
|
|
||||||
endif
|
|
96
.vimrc
96
.vimrc
@ -1,96 +0,0 @@
|
|||||||
" Make Vim more useful
|
|
||||||
set nocompatible
|
|
||||||
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
|
|
||||||
set clipboard=unnamed
|
|
||||||
" Enhance command-line completion
|
|
||||||
set wildmenu
|
|
||||||
" Allow cursor keys in insert mode
|
|
||||||
set esckeys
|
|
||||||
" Allow backspace in insert mode
|
|
||||||
set backspace=indent,eol,start
|
|
||||||
" Optimize for fast terminal connections
|
|
||||||
set ttyfast
|
|
||||||
" Add the g flag to search/replace by default
|
|
||||||
set gdefault
|
|
||||||
" Use UTF-8 without BOM
|
|
||||||
set encoding=utf-8 nobomb
|
|
||||||
" Change mapleader
|
|
||||||
let mapleader=","
|
|
||||||
" Don’t add empty newlines at the end of files
|
|
||||||
set binary
|
|
||||||
set noeol
|
|
||||||
" Centralize backups, swapfiles and undo history
|
|
||||||
set backupdir=~/.vim/backups
|
|
||||||
set directory=~/.vim/swaps
|
|
||||||
if exists("&undodir")
|
|
||||||
set undodir=~/.vim/undo
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Respect modeline in files
|
|
||||||
set modeline
|
|
||||||
set modelines=4
|
|
||||||
" Enable per-directory .vimrc files and disable unsafe commands in them
|
|
||||||
set exrc
|
|
||||||
set secure
|
|
||||||
" Enable line numbers
|
|
||||||
set number
|
|
||||||
" Enable syntax highlighting
|
|
||||||
syntax on
|
|
||||||
" Highlight current line
|
|
||||||
set cursorline
|
|
||||||
" Make tabs as wide as two spaces
|
|
||||||
set tabstop=2
|
|
||||||
" Show “invisible” characters
|
|
||||||
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
|
|
||||||
set list
|
|
||||||
" Highlight searches
|
|
||||||
set hlsearch
|
|
||||||
" Ignore case of searches
|
|
||||||
set ignorecase
|
|
||||||
" Highlight dynamically as pattern is typed
|
|
||||||
set incsearch
|
|
||||||
" Always show status line
|
|
||||||
set laststatus=2
|
|
||||||
" Enable mouse in all modes
|
|
||||||
set mouse=a
|
|
||||||
" Disable error bells
|
|
||||||
set noerrorbells
|
|
||||||
" Don’t reset cursor to start of line when moving around.
|
|
||||||
set nostartofline
|
|
||||||
" Show the cursor position
|
|
||||||
set ruler
|
|
||||||
" Don’t show the intro message when starting Vim
|
|
||||||
set shortmess=atI
|
|
||||||
" Show the current mode
|
|
||||||
set showmode
|
|
||||||
" Show the filename in the window titlebar
|
|
||||||
set title
|
|
||||||
" Show the (partial) command as it’s being typed
|
|
||||||
set showcmd
|
|
||||||
" Use relative line numbers
|
|
||||||
if exists("&relativenumber")
|
|
||||||
set relativenumber
|
|
||||||
au BufReadPost * set relativenumber
|
|
||||||
endif
|
|
||||||
" Start scrolling three lines before the horizontal window border
|
|
||||||
set scrolloff=3
|
|
||||||
|
|
||||||
" Strip trailing whitespace (,ss)
|
|
||||||
function! StripWhitespace()
|
|
||||||
let save_cursor = getpos(".")
|
|
||||||
let old_query = getreg('/')
|
|
||||||
:%s/\s\+$//e
|
|
||||||
call setpos('.', save_cursor)
|
|
||||||
call setreg('/', old_query)
|
|
||||||
endfunction
|
|
||||||
noremap <leader>ss :call StripWhitespace()<CR>
|
|
||||||
" Save a file as root (,W)
|
|
||||||
noremap <leader>W :w !sudo tee % > /dev/null<CR>
|
|
||||||
|
|
||||||
" Automatic commands
|
|
||||||
if has("autocmd")
|
|
||||||
" Enable file type detection
|
|
||||||
filetype on
|
|
||||||
" Treat .json files as .js
|
|
||||||
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
|
|
||||||
endif
|
|
29
.zshrc
29
.zshrc
@ -1,29 +0,0 @@
|
|||||||
# Path to your oh-my-zsh configuration.
|
|
||||||
ZSH=$HOME/.oh-my-zsh
|
|
||||||
|
|
||||||
# Customize to your needs...
|
|
||||||
for file in ~/.{path,exports,prompt,aliases,functions,extra}; do
|
|
||||||
[ -r "$file" ] && source "$file"
|
|
||||||
done
|
|
||||||
|
|
||||||
ZSH_THEME="fino"
|
|
||||||
|
|
||||||
# Set to this to use case-sensitive completion
|
|
||||||
CASE_SENSITIVE="true"
|
|
||||||
|
|
||||||
# Comment this out to disable bi-weekly auto-update checks
|
|
||||||
DISABLE_AUTO_UPDATE="true"
|
|
||||||
|
|
||||||
plugins=(git github heroku)
|
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
|
|
||||||
unset file
|
|
||||||
|
|
||||||
# COMPLETION SETTINGS
|
|
||||||
# add custom completion scripts
|
|
||||||
fpath=(~/.completions $fpath)
|
|
||||||
|
|
||||||
# compsys initialization
|
|
||||||
autoload -U compinit
|
|
||||||
compinit
|
|
21
bootstrap.sh
21
bootstrap.sh
@ -7,21 +7,17 @@ case `uname` in
|
|||||||
readlink_command='readlink'
|
readlink_command='readlink'
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CURRENT_DIRECTORY="$(dirname "${BASH_SOURCE}" | xargs "${readlink_command}" -f)"
|
CURRENT_DIRECTORY="$(dirname "${BASH_SOURCE}" | xargs "${readlink_command}" -f)/dotfiles"
|
||||||
cd $CURRENT_DIRECTORY
|
cd $CURRENT_DIRECTORY
|
||||||
|
|
||||||
echo "Linking From $CURRENT_DIRECTORY"
|
echo "Linking From $CURRENT_DIRECTORY"
|
||||||
|
|
||||||
function doIt() {
|
function symlink_dotfiles() {
|
||||||
[[ -a ~/.dotfiles-backups ]] || mkdir ~/.dotfiles-backups
|
[[ -a ~/.dotfiles-backups ]] || mkdir ~/.dotfiles-backups
|
||||||
exclude_list="setup.sh Monaco-Powerline.otf web_start.sh oh-my-zsh tmux-powerline .git .gitmodules .DS_store bootstrap.sh README.md more_python.txt . .. requirements.txt"
|
for filename in *; do
|
||||||
|
local link_destination="$HOME/.$filename"
|
||||||
for i in .*; do
|
local absolute_path="$($readlink_command -f $filename)"
|
||||||
if ! [ -z ${i/*.swp/} ] && ! [[ $exclude_list =~ $i ]]
|
ln -si $absolute_path $link_destination
|
||||||
then
|
|
||||||
[[ -a ~/$i ]] && mv ~/$i ~/.dotfiles-backups/$i
|
|
||||||
ln -si $CURRENT_DIRECTORY/$i ~/$i
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,8 +27,7 @@ else
|
|||||||
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
|
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
doIt
|
symlink_dotfiles
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
unset doIt
|
unset symlink_dotfiles
|
||||||
source ~/.bash_profile
|
|
||||||
|
5145
com.googlecode.iterm2.plist
Normal file
5145
com.googlecode.iterm2.plist
Normal file
File diff suppressed because it is too large
Load Diff
2
dotfiles/bashrc
Normal file
2
dotfiles/bashrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
source ~/.lib/shellrc.sh
|
||||||
|
source ~/.lib/bash.sh
|
@ -7,8 +7,6 @@
|
|||||||
d = !"git diff-index --quiet HEAD -- || clear; git diff --patch-with-stat"
|
d = !"git diff-index --quiet HEAD -- || clear; git diff --patch-with-stat"
|
||||||
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
|
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
|
||||||
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
|
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
|
||||||
# Pull in remote changes for the current repository and all its submodules
|
|
||||||
p = !"git pull; git submodule foreach git pull origin master"
|
|
||||||
# Clone a repository including all submodules
|
# Clone a repository including all submodules
|
||||||
c = clone --recursive
|
c = clone --recursive
|
||||||
# Commit all changes
|
# Commit all changes
|
||||||
@ -23,9 +21,7 @@
|
|||||||
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
|
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
|
||||||
# Interactive rebase with the given number of latest commits
|
# Interactive rebase with the given number of latest commits
|
||||||
reb = "!r() { git rebase -i HEAD~$1; }; r"
|
reb = "!r() { git rebase -i HEAD~$1; }; r"
|
||||||
# Undo a `git push`
|
suir = submodule update --init --recursive
|
||||||
undopush = push -f origin HEAD^:master
|
|
||||||
sui = submodule update --init
|
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
# Use custom `.gitignore` and `.gitattributes`
|
# Use custom `.gitignore` and `.gitattributes`
|
||||||
@ -73,3 +69,5 @@
|
|||||||
[user]
|
[user]
|
||||||
email = IvanMalison@gmail.com
|
email = IvanMalison@gmail.com
|
||||||
name = Ivan Malison
|
name = Ivan Malison
|
||||||
|
[merge]
|
||||||
|
conflictstyle = diff3
|
@ -13,4 +13,11 @@ Thumbs.db
|
|||||||
.Spotlight-V100
|
.Spotlight-V100
|
||||||
.Trashes
|
.Trashes
|
||||||
|
|
||||||
.emacs.desktop
|
.emacs.desktop
|
||||||
|
|
||||||
|
.emacs*
|
||||||
|
|
||||||
|
# yelp
|
||||||
|
TAGS
|
||||||
|
run_tests.sh
|
||||||
|
untracked/
|
@ -1,5 +1,3 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Make sure we’re using the latest Homebrew
|
# Make sure we’re using the latest Homebrew
|
||||||
brew update
|
brew update
|
||||||
|
|
||||||
@ -29,6 +27,9 @@ brew install git
|
|||||||
brew install tmux
|
brew install tmux
|
||||||
brew install nmap
|
brew install nmap
|
||||||
brew install readline
|
brew install readline
|
||||||
|
brew install netcat
|
||||||
|
brew install reattach-to-user-namespace
|
||||||
|
brew install ngrep
|
||||||
|
|
||||||
# Remove outdated versions from the cellar
|
# Remove outdated versions from the cellar
|
||||||
brew cleanup
|
brew cleanup
|
@ -4,7 +4,7 @@ _testify() {
|
|||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
local context state line
|
local context state line
|
||||||
|
|
||||||
BASE_TEST_PATH='tests'
|
BASE_TEST_PATH='yelp.tests'
|
||||||
_arguments "1:testify_file:->file" "2:testify_:->test_case"
|
_arguments "1:testify_file:->file" "2:testify_:->test_case"
|
||||||
|
|
||||||
case $state in
|
case $state in
|
12
dotfiles/lib/get_cols.awk
Normal file
12
dotfiles/lib/get_cols.awk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env gawk -f
|
||||||
|
BEGIN{
|
||||||
|
column_count=split(cols,column_numbers," ");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
for(i=1; i<=column_count; i++)
|
||||||
|
if(column_numbers[i] < 0)
|
||||||
|
printf "%s%s", $(NF + 1 + column_numbers[i]), OFS
|
||||||
|
else
|
||||||
|
printf "%s%s", $column_numbers[i], OFS
|
||||||
|
printf "%s", ORS
|
||||||
|
}
|
3
dotfiles/lib/shellrc.sh
Normal file
3
dotfiles/lib/shellrc.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
for filename in ~/.lib/shellrc/*; do
|
||||||
|
source $filename
|
||||||
|
done
|
52
dotfiles/lib/shellrc/aliases.sh
Normal file
52
dotfiles/lib/shellrc/aliases.sh
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
alias script_abspath='$(dirname "${BASH_SOURCE}" | xargs "${readlink_command}" -f)'
|
||||||
|
|
||||||
|
alias emacs="emacsclient -t"
|
||||||
|
alias readlink="greadlink"
|
||||||
|
|
||||||
|
alias sudo='sudo '
|
||||||
|
|
||||||
|
# IP addresses
|
||||||
|
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||||
|
alias localip="ifconfig getifaddr en1"
|
||||||
|
|
||||||
|
alias whois="whois -h whois-servers.net"
|
||||||
|
|
||||||
|
# Clean up LaunchServices to remove duplicates in the “Open With” menu
|
||||||
|
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
|
||||||
|
|
||||||
|
# View HTTP traffic
|
||||||
|
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
|
||||||
|
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
|
||||||
|
|
||||||
|
# Canonical hex dump; some systems have this symlinked
|
||||||
|
command -v hd > /dev/null || alias hd="hexdump -C"
|
||||||
|
|
||||||
|
# OS X has no `md5sum`, so use `md5` as a fallback
|
||||||
|
command -v md5sum > /dev/null || alias md5sum="md5"
|
||||||
|
|
||||||
|
# OS X has no `sha1sum`, so use `shasum` as a fallback
|
||||||
|
command -v sha1sum > /dev/null || alias sha1sum="shasum"
|
||||||
|
|
||||||
|
# URL-encode strings
|
||||||
|
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
|
||||||
|
|
||||||
|
# Merge PDF files
|
||||||
|
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
|
||||||
|
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
|
||||||
|
|
||||||
|
# Disable Spotlight
|
||||||
|
alias spotoff="sudo mdutil -a -i off"
|
||||||
|
# Enable Spotlight
|
||||||
|
alias spoton="sudo mdutil -a -i on"
|
||||||
|
|
||||||
|
# One of @janmoesen’s ProTip™s
|
||||||
|
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
|
||||||
|
alias "$method"="lwp-request -m '$method'"
|
||||||
|
done
|
||||||
|
|
||||||
|
alias stfu="osascript -e 'set volume output muted true'"
|
||||||
|
alias pumpitup="osascript -e 'set volume 7'"
|
||||||
|
|
||||||
|
alias tmux="tmux -2"
|
||||||
|
alias remote_os_copy='linux_nc_paste_to_remote_clipboard'
|
||||||
|
alias timestamp='date +%s'
|
66
dotfiles/lib/shellrc/functions.sh
Normal file
66
dotfiles/lib/shellrc/functions.sh
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
function parse_git_branch() {
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
|
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
|
echo ${ref#refs/heads/}
|
||||||
|
}
|
||||||
|
|
||||||
|
function current_shell() {
|
||||||
|
ps -p $$ | tail -1 | awk '{print $NF}' | xargs which | xargs readlink -f
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_zsh() {
|
||||||
|
test -n "$(current_shell | grep -o zsh)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_cols() {
|
||||||
|
FS=' '
|
||||||
|
while getopts "F:" OPTCHAR; do
|
||||||
|
case $OPTCHAR in
|
||||||
|
F)
|
||||||
|
FS=$OPTARG
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
awk -f "$HOME/.lib/get_cols.awk" -v "cols=$*" -v "FS=$FS"
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_all_ssh_agent_sockets() {
|
||||||
|
find /tmp -type s -name agent.\* 2> /dev/null | grep '/tmp/ssh-.*/agent.*'
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_ssh_agent_socket() {
|
||||||
|
export SSH_AUTH_SOCK=$(find_all_ssh_agent_sockets | tail -n 1 | awk -F: '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine size of a file or total size of a directory
|
||||||
|
function fs() {
|
||||||
|
if du -b /dev/null > /dev/null 2>&1; then
|
||||||
|
local arg=-sbh
|
||||||
|
else
|
||||||
|
local arg=-sh
|
||||||
|
fi
|
||||||
|
if [[ -n "$@" ]]; then
|
||||||
|
du $arg -- "$@"
|
||||||
|
else
|
||||||
|
du $arg .[^.]* *
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start an HTTP server from a directory, optionally specifying the port
|
||||||
|
function server() {
|
||||||
|
local port="${1:-8000}"
|
||||||
|
sleep 1 && open "http://localhost:${port}/" &
|
||||||
|
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
||||||
|
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
||||||
|
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
||||||
|
}
|
||||||
|
|
||||||
|
# All the dig info
|
||||||
|
function digga() {
|
||||||
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
|
}
|
||||||
|
|
||||||
|
function shell_stats() {
|
||||||
|
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
|
||||||
|
}
|
20
dotfiles/lib/shellrc/remote_clipboard.sh
Normal file
20
dotfiles/lib/shellrc/remote_clipboard.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
REMOTE_CLIPBOARD_PORT='1234'
|
||||||
|
|
||||||
|
function remote_clipboard_server() {
|
||||||
|
while [ 1 ]
|
||||||
|
do
|
||||||
|
netcat -l -p ${1-$REMOTE_CLIPBOARD_PORT} -e "pbcopy"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function remote_clipboard_server_daemon() {
|
||||||
|
daemonize `which reattach-to-user-namespace` -l $SHELL -c "source ~/.zshrc; remote_clipboard_server"
|
||||||
|
}
|
||||||
|
|
||||||
|
function linux_nc_paste_to_remote_clipboard() {
|
||||||
|
nc localhost ${1-$REMOTE_CLIPBOARD_PORT} -q 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function osx_nc_paste_to_remote_clipboard() {
|
||||||
|
nc localhost ${1-$REMOTE_CLIPBOARD_PORT} -D
|
||||||
|
}
|
87
dotfiles/lib/shellrc/yelp.sh
Normal file
87
dotfiles/lib/shellrc/yelp.sh
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
alias i="ipython tools/interactive.py"
|
||||||
|
alias apperror="tools/scribereader -e prod -f apperror | tools/pretty_error_log"
|
||||||
|
alias environ=". ~/.pgconf-$USER/environ.sh"
|
||||||
|
alias ym="cd ~/pg/yelp-main"
|
||||||
|
alias live="cd /nail/live/yelp"
|
||||||
|
alias sb="sandbox -vv --minimal"
|
||||||
|
|
||||||
|
function fix_environment_script() {
|
||||||
|
sed -i 's/export YELP_CONFIG:yelp_conn:replication_delay_params.*$//' $YELP_SANDBOX_ROOT/environment.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sandbox_identifier() {
|
||||||
|
echo $YELP_SANDBOX_ROOT | gawk 'match($0, /pgconf-.*-(.*)/, matched) {print matched[1]}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_proddb() {
|
||||||
|
python 2>/dev/null - <<END
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
def is_proddb_from_topology_info(topology_info):
|
||||||
|
for cluster_info in topology_info['topology']:
|
||||||
|
if cluster_info['cluster'] == 'primary':
|
||||||
|
return cluster_info['entries'][0]['host'] != '127.0.0.1'
|
||||||
|
|
||||||
|
def is_proddb_from_topology_filename(topology_filename):
|
||||||
|
with open(topology_filename) as topology_file:
|
||||||
|
return is_proddb_from_topology_info(yaml.load(topology_file))
|
||||||
|
|
||||||
|
def is_proddb():
|
||||||
|
try:
|
||||||
|
topology_filename = os.environ.get('TOPOLOGY_FILE')
|
||||||
|
if topology_filename:
|
||||||
|
return is_proddb_from_topology_filename(topology_filename)
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
sys.exit(0 if is_proddb() else 1)
|
||||||
|
END
|
||||||
|
}
|
||||||
|
|
||||||
|
function sandbox_prompt_info() {
|
||||||
|
local sandbox_string=''
|
||||||
|
if is_proddb
|
||||||
|
then
|
||||||
|
sandbox_string="proddb "
|
||||||
|
fi
|
||||||
|
if [ "$YELP_IN_SANDBOX" ];
|
||||||
|
then
|
||||||
|
sandbox_string=$sandbox_string"sandbox-$(get_sandbox_identifier)"
|
||||||
|
else
|
||||||
|
sandbox_string="no sandbox"
|
||||||
|
fi
|
||||||
|
echo $sandbox_string
|
||||||
|
}
|
||||||
|
|
||||||
|
function bash_sandbox_color() {
|
||||||
|
if [ $YELP_IN_SANDBOX ]
|
||||||
|
then
|
||||||
|
sandbox_color='\e[0;33m'
|
||||||
|
else
|
||||||
|
sandbox_color='\e[0;31m'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function zsh_sandbox_color() {
|
||||||
|
if [ $YELP_IN_SANDBOX ]
|
||||||
|
then
|
||||||
|
sandbox_color="%{$FG[149]%}"
|
||||||
|
else
|
||||||
|
sandbox_color="%{$FG[001]%}"
|
||||||
|
fi
|
||||||
|
echo $sandbox_color
|
||||||
|
}
|
||||||
|
|
||||||
|
function colored_sandbox_string() {
|
||||||
|
if [ is_zsh ]
|
||||||
|
then
|
||||||
|
sandbox_color=$(zsh_sandbox_color)
|
||||||
|
else
|
||||||
|
sandbox_color=$(bash_sandbox_color)
|
||||||
|
fi
|
||||||
|
echo $sandbox_color$(sandbox_prompt_info)
|
||||||
|
}
|
30
dotfiles/lib/zsh.sh
Normal file
30
dotfiles/lib/zsh.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
for filename in ~/.lib/zsh/*; do
|
||||||
|
source $filename
|
||||||
|
done
|
||||||
|
|
||||||
|
CASE_SENSITIVE="true"
|
||||||
|
fpath=(~/.lib/completions $fpath)
|
||||||
|
autoload -U compinit
|
||||||
|
compinit
|
||||||
|
# Allow command line editing.
|
||||||
|
autoload -U edit-command-line
|
||||||
|
zle -N edit-command-line
|
||||||
|
bindkey '\C-x\C-e' edit-command-line
|
||||||
|
|
||||||
|
local
|
||||||
|
|
||||||
|
function current_directory() {
|
||||||
|
local PWD=$(pwd)
|
||||||
|
echo "${PWD/#$HOME/~}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_info () {
|
||||||
|
if test -z $(parse_git_branch);
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo " %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}$(parse_git_branch)%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT="%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(hostname -s)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}\$(current_directory)%{$reset_color%}\$(git_prompt_info) %{$FG[239]%}with \$(colored_sandbox_string)%{$FG[255]%} "
|
72
dotfiles/lib/zsh/completion.sh
Normal file
72
dotfiles/lib/zsh/completion.sh
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
## case-insensitive (all),partial-word and then substring completion
|
||||||
|
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
|
||||||
|
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||||
|
unset CASE_SENSITIVE
|
||||||
|
else
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||||
|
fi
|
||||||
|
|
||||||
|
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=(.)
|
||||||
|
|
||||||
|
# use /etc/hosts and known_hosts for hostname completion
|
||||||
|
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_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
|
||||||
|
|
||||||
|
# Use caching so that commands like apt and dpkg complete are useable
|
||||||
|
zstyle ':completion::complete:*' use-cache 1
|
||||||
|
zstyle ':completion::complete:*' cache-path $ZSH/cache/
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
|
||||||
|
expand-or-complete-with-dots() {
|
||||||
|
echo -n "\e[31m......\e[0m"
|
||||||
|
zle expand-or-complete
|
||||||
|
zle redisplay
|
||||||
|
}
|
||||||
|
zle -N expand-or-complete-with-dots
|
||||||
|
bindkey "^I" expand-or-complete-with-dots
|
||||||
|
fi
|
22
dotfiles/lib/zsh/history.sh
Normal file
22
dotfiles/lib/zsh/history.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
## Command history configuration
|
||||||
|
HISTFILE=$HOME/.zsh_history
|
||||||
|
HISTSIZE=100000
|
||||||
|
SAVEHIST=100000
|
||||||
|
|
||||||
|
setopt append_history
|
||||||
|
setopt extended_history
|
||||||
|
setopt hist_expire_dups_first
|
||||||
|
setopt hist_ignore_dups # ignore duplication command history list
|
||||||
|
setopt hist_ignore_space
|
||||||
|
setopt hist_verify
|
||||||
|
setopt inc_append_history
|
||||||
|
setopt share_history # share command history data
|
||||||
|
|
||||||
|
# TODO: Explain what some of this does..
|
||||||
|
|
||||||
|
bindkey -e
|
||||||
|
bindkey '\ew' kill-region
|
||||||
|
bindkey -s '\el' "ls\n"
|
||||||
|
bindkey '^r' history-incremental-search-backward
|
||||||
|
bindkey "^[[5~" up-line-or-history
|
||||||
|
bindkey "^[[6~" down-line-or-history
|
46
dotfiles/lib/zsh/key_bindings.sh
Normal file
46
dotfiles/lib/zsh/key_bindings.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
bindkey -e
|
||||||
|
bindkey '\ew' kill-region
|
||||||
|
bindkey -s '\el' "ls\n"
|
||||||
|
bindkey '^r' history-incremental-search-backward
|
||||||
|
bindkey "^[[5~" up-line-or-history
|
||||||
|
bindkey "^[[6~" down-line-or-history
|
||||||
|
|
||||||
|
# make search up and down work, so partially type and hit up/down to find relevant stuff
|
||||||
|
bindkey '^[[A' up-line-or-search
|
||||||
|
bindkey '^[[B' down-line-or-search
|
||||||
|
|
||||||
|
bindkey "^[[H" beginning-of-line
|
||||||
|
bindkey "^[[1~" beginning-of-line
|
||||||
|
bindkey "^[OH" beginning-of-line
|
||||||
|
bindkey "^[[F" end-of-line
|
||||||
|
bindkey "^[[4~" end-of-line
|
||||||
|
bindkey "^[OF" end-of-line
|
||||||
|
bindkey ' ' magic-space # also do history expansion on space
|
||||||
|
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
|
||||||
|
bindkey '^[[Z' reverse-menu-complete
|
||||||
|
|
||||||
|
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
|
||||||
|
bindkey '^?' backward-delete-char
|
||||||
|
bindkey "^[[3~" delete-char
|
||||||
|
bindkey "^[3;5~" delete-char
|
||||||
|
bindkey "\e[3~" delete-char
|
||||||
|
|
||||||
|
bindkey -e ## emacs key bindings
|
||||||
|
|
||||||
|
bindkey '^[[A' up-line-or-search
|
||||||
|
bindkey '^[[B' down-line-or-search
|
||||||
|
bindkey '^[^[[C' emacs-forward-word
|
||||||
|
bindkey '^[^[[D' emacs-backward-word
|
||||||
|
|
||||||
|
bindkey -s '^X^Z' '%-^M'
|
||||||
|
bindkey '^[e' expand-cmd-path
|
||||||
|
bindkey '^[^I' reverse-menu-complete
|
||||||
|
bindkey '^X^N' accept-and-infer-next-history
|
||||||
|
bindkey '^W' kill-region
|
||||||
|
bindkey '^I' complete-word
|
||||||
|
# Fix weird sequence that rxvt produces
|
||||||
|
bindkey -s '^[[Z' '\t'
|
||||||
|
|
28
dotfiles/lib/zsh/spectrum.sh
Normal file
28
dotfiles/lib/zsh/spectrum.sh
Normal file
@ -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 "%{[00m%}"
|
||||||
|
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||||
|
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||||
|
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||||
|
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||||
|
reverse "%{[07m%}" no-reverse "%{[27m%}"
|
||||||
|
)
|
||||||
|
|
||||||
|
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: %{$FG[$code]Test%f%}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
35
dotfiles/lib/zsh/term_support.sh
Normal file
35
dotfiles/lib/zsh/term_support.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
|
||||||
|
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||||
|
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
||||||
|
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
|
||||||
|
function title {
|
||||||
|
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ "$TERM" == screen* ]]; then
|
||||||
|
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||||
|
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||||
|
print -Pn "\e]2;$2:q\a" #set window name
|
||||||
|
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||||
|
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||||
|
|
||||||
|
#Appears when you have the prompt
|
||||||
|
function omz_termsupport_precmd {
|
||||||
|
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||||
|
}
|
||||||
|
|
||||||
|
#Appears at the beginning of (and during) of command execution
|
||||||
|
function omz_termsupport_preexec {
|
||||||
|
emulate -L zsh
|
||||||
|
setopt extended_glob
|
||||||
|
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||||
|
title "$CMD" "%100>...>${2:gs/%/%%}%<<"
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd omz_termsupport_precmd
|
||||||
|
add-zsh-hook preexec omz_termsupport_preexec
|
2
dotfiles/zshrc
Normal file
2
dotfiles/zshrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
source ~/.lib/shellrc.sh
|
||||||
|
source ~/.lib/zsh.sh
|
@ -1 +0,0 @@
|
|||||||
Subproject commit ac9588ba3c8b361b11ce969a676a737298a2295f
|
|
@ -12,7 +12,7 @@ function osx() {
|
|||||||
echo "gcc not found."
|
echo "gcc not found."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
hash brew &>/dev/null && echo "brew found" || ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
|
hash brew &>/dev/null && echo "brew found" || ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
|
||||||
brew update
|
brew update
|
||||||
brew install git
|
brew install git
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user