Browse Source

A bunch of changes to dotfiles + terminal screenshot

master
Nick Plekhanov 9 years ago
parent
commit
becf960b82
  1. 2
      README.md
  2. 1
      git/gitconfig
  3. BIN
      iterm/nick-terminal.png
  4. 19
      setup.sh
  5. 17
      shell/shell_aliases
  6. 12
      shell/zshrc

2
README.md

@ -2,6 +2,8 @@
This is a collection of dotfiles and scripts I use for customizing OS X to my liking and setting up the software development tools I use on a day-to-day basis. They should be cloned to your home directory so that the path is `~/dotfiles/`. The included setup script creates symlinks from your home directory to the files which are located in `~/dotfiles/`.
![Terminal.app](https://raw.github.com/nick/dotfiles/master/iterm/nick-terminal.png)
The setup script is smart enough to back up your existing dotfiles into a `~/dotfiles_old/` directory if you already have any dotfiles of the same name as the dotfile symlinks being created in your home directory.
I also prefer `zsh` as my shell of choice. As such, the setup script will also clone the `oh-my-zsh` repository from my GitHub. It then checks to see if `zsh` is installed. If `zsh` is installed, and it is not already configured as the default shell, the setup script will execute a `chsh -s $(which zsh)` command. This changes the default shell to zsh, and takes effect as soon as a new zsh is spawned or on next login.

1
git/gitconfig

@ -1,3 +1,4 @@
# A good list of alises http://haacked.com/archive/2014/07/28/github-flow-aliases/
[alias]
a = add
br = branch

BIN
iterm/nick-terminal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

19
setup.sh

@ -1,16 +1,15 @@
#!/bin/bash
# this symlinks all the dotfiles (and .atom/) to ~/
# it also symlinks ~/bin for easy updating
# This symlinks all the dotfiles (and .atom/) to ~/
# It also symlinks ~/bin for easy updating
# this is safe to run multiple times and will prompt you about anything unclear
# This is safe to run multiple times and will prompt you about anything unclear
#
# utils !!!
# Utils
#
answer_is_yes() {
[[ "$REPLY" =~ ^[Yy]$ ]] \
&& return 0 \
@ -131,18 +130,18 @@ dir_backup=~/dotfiles_old # old dotfiles backup directory
export DOTFILES_DIR
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# create dotfiles_old in homedir
# Create dotfiles_old in homedir
echo -n "Creating $dir_backup for backup of any existing dotfiles in ~..."
mkdir -p $dir_backup
echo "done"
# change to the dotfiles directory
# Change to the dotfiles directory
echo -n "Changing to the $dir directory..."
cd $dir
echo "done"
#
# actual symlink stuff
# Actual symlink stuff
#
@ -176,11 +175,11 @@ declare -a FILES_TO_SYMLINK=(
# FILES_TO_SYMLINK="$FILES_TO_SYMLINK .vim bin" # add in vim and the binaries
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks from the homedir to any files in the ~/dotfiles directory specified in $files
# Move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks from the homedir to any files in the ~/dotfiles directory specified in $files
for i in ${FILES_TO_SYMLINK[@]}; do
echo "Moving any existing dotfiles from ~ to $dir_backup"
mv ~/.$i ~/dotfiles_old/
mv ~/.${i##*/} ~/dotfiles_old/
done
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

17
shell/shell_aliases

@ -54,25 +54,27 @@ alias hosts='sudo $EDITOR /etc/hosts' # yes I occasionally 127.0.0.1 twitter.c
# Time to upgrade `ls`
#
# Use coreutils `ls` if possible
hash gls >/dev/null 2>&1 || alias gls="ls"
# Always use color output for `ls`
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
if gls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
# Use coreutils `ls` if possible…
hash gls >/dev/null 2>&1 || alias gls="ls"
export CLICOLOR_FORCE=1
# List all files colorized in long format
alias l="gls -l ${colorflag}"
alias l="ls -lF ${colorflag}"
# ls options: A = include hidden (but not . or ..), F = put `/` after folders, h = byte unit suffixes
alias ls='gls -AFh ${colorflag} --group-directories-first'
alias ls='ls -AFh ${colorflag} --group-directories-first'
# List all files colorized in long format, including dot files
alias la="gls -la ${colorflag}"
alias la="ls -la ${colorflag}"
# List only directories
alias lsd='gls -l | grep "^d"'
@ -123,7 +125,7 @@ alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gbt=git_list_branches
alias gpu='git pull'
alias gpu='git pull origin HEAD --prune'
alias gcl='git clone'
alias gta='git tag -a -m'
alias gf='git reflog'
@ -133,7 +135,6 @@ alias undopush="git push -f origin HEAD^:master"
# `cd` to Git repo root
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`'
#alias gr='git rev-parse 2>/dev/null && cd "./$(git rev-parse --show-cdup)"'
# Gist
alias gist-paste="gist --private --copy --paste --filename" # gist-paste filename.ext -- create private Gist from the clipboard contents

12
shell/zshrc

@ -56,9 +56,15 @@ if [ -f `brew --prefix`/etc/bash_completion ]; then
fi
# Put any proprietary or private functions/values in ~/.private, and this will source them
if [ -f $HOME/.private ]; then
source $HOME/.private
fi
[ -f $HOME/.private ] && source $HOME/.private
# Automatically list directory contents on `cd`.
# auto-ls () {
# emulate -L zsh;
# # explicit sexy ls'ing as aliases arent honored in here.
# hash gls >/dev/null 2>&1 && CLICOLOR_FORCE=1 gls -aFh --color --group-directories-first || ls
# }
# chpwd_functions=( auto-ls $chpwd_functions )
source $ZSH/oh-my-zsh.sh

Loading…
Cancel
Save