1
0
Fork 0

Initial commit

This commit is contained in:
Gregory Eremin 2013-01-19 17:18:29 +04:00
commit f3123a736d
29 changed files with 412 additions and 0 deletions

8
README.md Normal file
View File

@ -0,0 +1,8 @@
## .dotfiles
Installation:
```bash
git clone git@github.com:magnolia-fan/dotfiles.git ~/.dotfiles
~/.dotfiles/setup.sh
```

29
git/.gitconfig Normal file
View File

@ -0,0 +1,29 @@
[hub]
protocol = https
[user]
name = Gregory Eremin
email = magnolia_fan@me.com
[credential]
helper = osxkeychain
[alias]
co = checkout
br = checkout -b
st = status -sb
ci = commit -m
ca = commit -am
[color]
diff = auto
status = auto
branch = auto
ui = true
[core]
excludesfile = ~/.gitignore
editor = subl -n -w
[apply]
whitespace = nowarn
[mergetool]
keepBackup = false
[difftool]
prompt = false
[help]
autocorrect = 1

3
git/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
.bundle
.rake_tasks

4
ruby/.aprc Normal file
View File

@ -0,0 +1,4 @@
AwesomePrint.defaults = {
indent: -2,
index: false
}

1
ruby/.gemrc Normal file
View File

@ -0,0 +1 @@
gem: --no-ri --no-rdoc

3
ruby/config.zsh Normal file
View File

@ -0,0 +1,3 @@
export RUBYOPT="-Ku"
export RUBY_GC_MALLOC_LIMIT=60000000
export RUBY_FREE_MIN=200000

1
ruby/rbenv/init.zsh Normal file
View File

@ -0,0 +1 @@
eval "$(rbenv init -)"

5
ruby/rbenv/install.zsh Normal file
View File

@ -0,0 +1,5 @@
# if $(brew &>/dev/null)
# then
# brew install rbenv
# brew install ruby-build
# fi

14
setup.sh Executable file
View File

@ -0,0 +1,14 @@
cd ~
# Git
ln -s ~/.dotfiles/git/.gitconfig
ln -s ~/.dotfiles/git/.gitignore
# ZSH
ln -s ~/.dotfiles/zsh/.zshrc
# Ruby
ln -s ~/.dotfiles/ruby/.gemrc
ln -s ~/.dotfiles/ruby/.aprc
cd -

19
sublime/config-dark Normal file
View File

@ -0,0 +1,19 @@
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"default_line_ending": "unix",
"drag_text": false,
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_face": "Inconsolata",
"font_size": 16.0,
"highlight_line": true,
"ignored_packages": ["Vintage"],
"line_padding_bottom": 1,
"line_padding_top": 3,
"rulers": [120],
"tab_size": 2,
"theme": "Soda Dark.sublime-theme",
"translate_tabs_to_spaces": true,
"tree_animation_enabled": false,
"trim_trailing_white_space_on_save": true
}

19
sublime/config-light Normal file
View File

@ -0,0 +1,19 @@
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow.tmTheme",
"default_line_ending": "unix",
"drag_text": false,
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_face": "Inconsolata",
"font_size": 16.0,
"highlight_line": true,
"ignored_packages": ["Vintage"],
"line_padding_bottom": 1,
"line_padding_top": 3,
"rulers": [120],
"tab_size": 2,
"theme": "Soda Light.sublime-theme",
"translate_tabs_to_spaces": true,
"tree_animation_enabled": false,
"trim_trailing_white_space_on_save": true
}

22
zsh/.zshrc Normal file
View File

@ -0,0 +1,22 @@
# shortcut to this dotfiles path is $ZSH
export ZSH=$HOME/.dotfiles
# your project folder that we can `c [tab]` to
export PROJECTS=~/Code
# source every .zsh file in this rep
for config_file ($ZSH/**/*.zsh) source $config_file
# use .localrc for SUPER SECRET CRAP that you don't
# want in your public, versioned repo.
if [[ -a ~/.localrc ]]
then
source ~/.localrc
fi
# initialize autocomplete here, otherwise functions won't be loaded
autoload -U compinit
compinit
# load every completion after autocomplete loads
# for config_file ($ZSH/**/completion.sh) source $config_file

13
zsh/aliases.zsh Normal file
View File

@ -0,0 +1,13 @@
alias reload!='. ~/.zshrc'
alias b='bundle exec'
alias please='sudo'
# Services start-ups and shut-downs
alias mysql-start="mysql.server start"
alias mysql-stop="mysql.server stop"
alias mysql-restart="mysql.server restart"
alias redis-start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist"
alias redis-stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist"
alias redis-restart="redis-stop && redis-start"

5
zsh/completion.zsh Normal file
View File

@ -0,0 +1,5 @@
# matches case insensitive for lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# pasting with tabs doesn't perform completion
zstyle ':completion:*' insert-tab pending

48
zsh/config.zsh Normal file
View File

@ -0,0 +1,48 @@
if [[ -n $SSH_CONNECTION ]]; then
export PS1='%m:%3~$(git_info_for_prompt)%# '
else
export PS1='%3~$(git_info_for_prompt)%# '
fi
export LSCOLORS="exfxcxdxbxegedabagacad"
export CLICOLOR=true
fpath=($ZSH/zsh/functions $fpath)
autoload -U $ZSH/zsh/functions/*(:t)
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt NO_BG_NICE # don't nice background tasks
setopt NO_HUP
setopt NO_LIST_BEEP
setopt LOCAL_OPTIONS # allow functions to have local options
setopt LOCAL_TRAPS # allow functions to have local traps
setopt HIST_VERIFY
setopt SHARE_HISTORY # share history between sessions ???
setopt EXTENDED_HISTORY # add timestamps to history
setopt PROMPT_SUBST
setopt CORRECT
setopt COMPLETE_IN_WORD
setopt IGNORE_EOF
setopt APPEND_HISTORY # adds history
setopt INC_APPEND_HISTORY SHARE_HISTORY # adds history incrementally and share it across sessions
setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history
setopt HIST_REDUCE_BLANKS
# don't expand aliases _before_ completion has finished
# like: git comm-[tab]
setopt complete_aliases
zle -N newtab
bindkey '^[^[[D' backward-word
bindkey '^[^[[C' forward-word
bindkey '^[[5D' beginning-of-line
bindkey '^[[5C' end-of-line
bindkey '^[[3~' delete-char
bindkey '^[^N' newtab
bindkey '^?' backward-delete-char

66
zsh/functions/_brew Normal file
View File

@ -0,0 +1,66 @@
#compdef brew
# Brew ZSH completion function
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
# and rename it _brew
#
# altered from _fink
_brew_all_formulae() {
formulae=(`brew search`)
}
_brew_installed_formulae() {
installed_formulae=(`brew list`)
}
local -a _1st_arguments
_1st_arguments=(
'install:install a formula'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'list:list files in a formula or not-installed formulae'
'link:link a formula'
'unlink:unlink a formula'
'home:visit the homepage of a formula or the brew project'
'info:information about a formula'
'prune:remove dead links'
'update:freshen up links'
'upgrade:upgrade outdated packages'
'log:git commit log for a formula'
'create:create a new formula'
'edit:edit a formula'
)
local expl
local -a formula installed_formulae
_arguments \
'(-v --verbose)'{-v,--verbose}'[verbose]' \
'(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "brew subcommand" _1st_arguments
return
fi
case "$words[1]" in
list)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_installed_formulae
_requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
install|home|log|info)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|edit|xo)
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
esac

2
zsh/functions/_c Normal file
View File

@ -0,0 +1,2 @@
#compdef c
_files -W $PROJECTS -/

2
zsh/functions/_h Normal file
View File

@ -0,0 +1,2 @@
#compdef h
_files -W ~ -/

8
zsh/functions/_rake Normal file
View File

@ -0,0 +1,8 @@
#compdef rake
if [ -f Rakefile ]; then
recent=`last_modified .rake_tasks~ Rakefile **/*.rake`
if [[ $recent != '.rake_tasks~' ]]; then
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
fi
compadd `cat .rake_tasks~`
fi

1
zsh/functions/c Normal file
View File

@ -0,0 +1 @@
cd $PROJECTS/$1;

27
zsh/functions/extract Normal file
View File

@ -0,0 +1,27 @@
# credit: http://nparikh.org/notes/zshrc.txt
# Usage: smartextract <file>
# Description: extracts archived files / mounts disk images
# Note: .dmg/hdiutil is Mac OS X-specific.
extract () {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar -jxvf $1 ;;
*.tar.gz) tar -zxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.dmg) hdiutil mount $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar -xvf $1 ;;
*.tbz2) tar -jxvf $1 ;;
*.tgz) tar -zxvf $1 ;;
*.zip) unzip $1 ;;
*.ZIP) unzip $1 ;;
*.pax) cat $1 | pax -r ;;
*.pax.Z) uncompress $1 --stdout | pax -r ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted/mounted via smartextract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

1
zsh/functions/h Normal file
View File

@ -0,0 +1 @@
cd ~/$1;

View File

@ -0,0 +1 @@
ls -t $* 2> /dev/null | head -n 1

12
zsh/functions/theme Normal file
View File

@ -0,0 +1,12 @@
local sublime_conf_location=~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/Preferences.sublime-settings
local theme="$1"
case $theme in
light|dark)
local sublime_conf_file="$ZSH/sublime/config-$theme" ;;
*)
local sublime_conf_file="$ZSH/sublime/config-dark" ;;
esac
rm $sublime_conf_location
cp $sublime_conf_file $sublime_conf_location

View File

@ -0,0 +1,5 @@
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''

1
zsh/paths.zsh Normal file
View File

@ -0,0 +1 @@
export PATH=~/.ssh_tunneler/bin:$PATH

68
zsh/prompt.zsh Normal file
View File

@ -0,0 +1,68 @@
autoload colors && colors
# cheers, @ehrenmurdick
# http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh
git_branch() {
echo $(/usr/bin/git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
}
git_dirty() {
st=$(/usr/bin/git status 2>/dev/null | tail -n 1)
if [[ $st == "" ]]
then
echo ""
else
if [[ $st == "nothing to commit (working directory clean)" ]]
then
echo " %{$fg_bold[green]%}($(git_prompt_info))%{$reset_color%}"
else
echo " %{$fg_bold[red]%}($(git_prompt_info))%{$reset_color%}"
fi
fi
}
git_prompt_info () {
ref=$(/usr/bin/git symbolic-ref HEAD 2>/dev/null) || return
# echo "(%{\e[0;33m%}${ref#refs/heads/}%{\e[0m%})"
echo "${ref#refs/heads/}"
}
unpushed () {
/usr/bin/git cherry -v @{upstream} 2>/dev/null
}
need_push () {
if [[ $(unpushed) == "" ]]
then
echo ""
else
echo " %{$fg_bold[magenta]%}➠%{$reset_color%}"
fi
}
rb_prompt(){
if $(which rbenv &> /dev/null)
then
echo "%{$fg_bold[cyan]%}$(rbenv version | awk '{print $1}')%{$reset_color%}"
else
echo ""
fi
}
current_time(){
echo 'date +"%d.%m.%Y %H:%M:%S"'
}
directory_name(){
echo "%{$fg_bold[blue]%}%1/%\%{$reset_color%}"
}
export PROMPT=$'\n$(directory_name)$(git_dirty)$(need_push) '
set_prompt () {
export RPROMPT="$(rb_prompt)"
}
precmd() {
title "zsh" "%m" "%55<...<%~"
set_prompt
}

6
zsh/ssh.zsh Normal file
View File

@ -0,0 +1,6 @@
# SSH Agent
result=$(ssh-add -L 2>/dev/null | tail -n 1)
if [[ $result == "The agent has no identities." ]]
then
ssh-add ~/.ssh/id_rsa 2>/dev/null
fi

18
zsh/window.zsh Normal file
View File

@ -0,0 +1,18 @@
# From http://dotfiles.org/~_why/.zshrc
# Sets the window title nicely no matter where you are
function title() {
# escape '%' chars in $1, make nonprintables visible
a=${(V)1//\%/\%\%}
# Truncate command, and join lines.
a=$(print -Pn "%40>...>$a" | tr -d "\n")
case $TERM in
screen)
print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
;;
xterm*|rxvt)
print -Pn "\e]2;$2\a" # plain xterm title ($3 for pwd)
;;
esac
}