Skip to content

Commit

Permalink
Lots of cleanup and merge in some oh-my-zsh features
Browse files Browse the repository at this point in the history
  • Loading branch information
tclem committed Sep 26, 2011
1 parent d436a98 commit a2c4713
Show file tree
Hide file tree
Showing 33 changed files with 530 additions and 190 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion License
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) Zach Holman, http://zachholman.com
Copyright (c) Tim Clem, http://timclem.wordpress.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
95 changes: 17 additions & 78 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,84 +1,23 @@
# holman does dotfiles
# tclem and his dotfiles

## dotfiles
These are my dotfiles.

Your dotfiles are how you personalize your system. These are mine. The very
prejudiced mix: OS X, zsh, Ruby, Rails, git, homebrew, rvm, vim. If you
match up along most of those lines, you may dig my dotfiles.
## Install

I was a little tired of having long alias files and everything strewn about
(which is extremely common on other dotfiles projects, too). That led to this
project being much more topic-centric. I realized I could split a lot of things
up into the main areas I used (Ruby, git, system libraries, and so on), so I
structured the project accordingly.
``` sh
git clone git://github.com/tclem/dotfiles ~/.dotfiles
cd ~/.dotfiles
rake install
```

If you're interested in the philosophy behind why projects like these are
awesome, you might want to [read my post on the
subject](http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/).
A .zshrc is setup for you, but it will look for and source a .localrc
which is where you should put stuff you don't want checked into a public
repo.

## install
## Credit where credit is due

- `git clone git://github.com/holman/dotfiles ~/.dotfiles`
- `cd ~/.dotfiles`
- `rake install`

The install rake task will symlink the appropriate files in `.dotfiles` to your
home directory. Everything is configured and tweaked within `~/.dotfiles`,
though.

The main file you'll want to change right off the bat is `zsh/zshrc.symlink`,
which sets up a few paths that'll be different on your particular machine.

## topical

Everything's built around topic areas. If you're adding a new area to your
forked dotfiles — say, "Java" — you can simply add a `java` directory and put
files in there. Anything with an extension of `.zsh` will get automatically
included into your shell. Anything with an extension of `.symlink` will get
symlinked without extension into `$HOME` when you run `rake install`.

## what's inside

A lot of what's inside is just aliases: `gs` for `git status`, `gl` for `git
pull --rebase --prune`, for example. You can browse the `aliases.zsh` files in
each topic directory. There's also a collection of scripts in `bin` you can
browse. A few notable ones:

###rails
- `s` pings your system for any running Rails apps, and `deathss` will then
kill all of them indiscriminately. `ss` starts up a new Rails server on the
next available port- if 3000 is taken, it'll spin up your server on 3001.

###system
- `c` is an autocomplete shortcut to your projects directory. For example, `c
git` and then hitting tab will autocomplete to `github`, and then it simply
changes to my `github` directory.
- `check [filename]` is a quick script that tells you whether a domain is
available to register.
- `smartextract [filename]` will extract about a billion different
compressed/uncompressed/whatever files and you'll never have to remember the
syntax.
- `backup` is a quick hook into `rsync` to backup a selection of files. Check
out the comments for more details.

###fun
- `cloudapp` uploads any file to [CloudApp](http://getcloudapp.com).
- `gifme` is a command-line animated GIF generator. It's also amazing.

##moar custom
There are a few things I use to make my life awesome. They're not a required
dependency, but if you make it happen, THEY'LL MAKE **YOU** HAPPEN.

- If you want some more colors for things like `ls`, install grc: `brew install
grc`.
- If you install the excellent [rvm](http://rvm.beginrescueend.com) to manage
multiple rubies, your current branch will show up in the prompt. Bonus.

## thanks

I forked [Ryan Bates](http://github.com/ryanb)' excellent
[dotfiles](http://github.com/ryanb/dotfiles) for a couple years before the
weight of my changes and tweaks inspired me to finally roll my own. But Ryan's
dotfiles were an easy way to get into bash customization, and then to jump ship
to zsh a bit later. A decent amount of the code in these dotfiles stem or are
inspired from Ryan's original project.
The original version of these came from [Zach
Holman](https://github.com/holman/dotfiles), but I have ripped and torn
them beyond recognition. Many of my zsh tricks come from
[oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) which is well
worth checking out in it's own right.
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ require 'rake'

desc "Hook our dotfiles into system-standard positions."
task :install do
linkables = Dir.glob('*/**{.symlink}')
linkables = Dir.glob('*/**/**{.symlink}')
puts linkables

skip_all = false
overwrite_all = false
Expand Down
5 changes: 0 additions & 5 deletions bin/git-all

This file was deleted.

5 changes: 0 additions & 5 deletions bin/git-amend

This file was deleted.

25 changes: 25 additions & 0 deletions bin/issue-to-pull
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
#/ Usage: issue-to-pull <user/repo> <issue_id>
#/ Converts an issue into a pull request

# show usage
[ $# -eq 0 -o "$1" = "--help" ] && {
grep '^#/'< "$0" |
cut -c4-
exit 2
}

# grab the current branch
branch=$(git symbolic-ref HEAD | sed 's/^refs\/heads\///')
[ -z "$branch" ] && {
echo "could not determine current branch" 1>&2
false
}

echo "This will turn issue $2 on $1 into a pull request for branch '$branch'"
read -s -p "GitHub Password: " pwd

curl -u "tclem:$pwd" https://api.github.com/repos/$1/pulls \
-d '{"issue":'$2', "head":"'$branch'", "base":"master"}'

echo
10 changes: 10 additions & 0 deletions bin/lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#!/bin/sh
#/ Usage: lock
#/ Lock your screen. This utility only works on OS X.

# show usage
[ "$1" = "--help" ] && {
grep '^#/'< "$0" |
cut -c4-
exit 2
}

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession \
-suspend
3 changes: 0 additions & 3 deletions cas/aliases.zsh

This file was deleted.

1 change: 0 additions & 1 deletion ec2/aliases.zsh

This file was deleted.

21 changes: 0 additions & 21 deletions git/aliases.zsh

This file was deleted.

23 changes: 0 additions & 23 deletions git/gitconfig.sample

This file was deleted.

1 change: 0 additions & 1 deletion ruby/rvm.zsh

This file was deleted.

10 changes: 0 additions & 10 deletions system/aliases.zsh

This file was deleted.

1 change: 0 additions & 1 deletion system/env.zsh

This file was deleted.

5 changes: 0 additions & 5 deletions system/grc.zsh

This file was deleted.

6 changes: 0 additions & 6 deletions system/keys.zsh

This file was deleted.

1 change: 0 additions & 1 deletion vagrant/aliases.zsh

This file was deleted.

11 changes: 11 additions & 0 deletions zsh/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ alias be='bundle exec'

alias reload!='. ~/.zshrc'
alias v=mvim

alias pu='pushd'
alias po='popd'
alias ...='cd ../..'
alias -- -='cd -'
alias history='fc -l 1'

alias lsa='ls -lah'
alias l='ls -la'
alias ll='ls -l'

24 changes: 24 additions & 0 deletions zsh/appearance.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ls colors
autoload colors; colors;
export LSCOLORS="Gxfxcxdxbxegedabagacad"
#export LS_COLORS

# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi

#setopt no_beep
setopt auto_cd
setopt multios
setopt cdablevarS

if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
fi

82 changes: 77 additions & 5 deletions zsh/completion.zsh
Original file line number Diff line number Diff line change
@@ -1,11 +1,83 @@
# Old settings
# matches case insensitive for lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# pasting with tabs doesn't perform completion
zstyle ':completion:*' insert-tab pending
# zstyle ':completion:*' insert-tab pending

# tab completion colors
# zstyle ':completion:*' list-colors ''


# New for oh-my-zsh
# 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 ''
# zstyle ':completion:*' list-colors ${(s.:.)LSCOLORS}
# zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

# 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 ~/.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=(
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
`hostname`
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 ~/.oh-my-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

Loading

0 comments on commit a2c4713

Please sign in to comment.