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/`. 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. 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. 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] [alias]
a = add a = add
br = branch 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 #!/bin/bash
# this symlinks all the dotfiles (and .atom/) to ~/ # This symlinks all the dotfiles (and .atom/) to ~/
# it also symlinks ~/bin for easy updating # 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() { answer_is_yes() {
[[ "$REPLY" =~ ^[Yy]$ ]] \ [[ "$REPLY" =~ ^[Yy]$ ]] \
&& return 0 \ && return 0 \
@ -131,18 +130,18 @@ dir_backup=~/dotfiles_old # old dotfiles backup directory
export DOTFILES_DIR export DOTFILES_DIR
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 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 ~..." echo -n "Creating $dir_backup for backup of any existing dotfiles in ~..."
mkdir -p $dir_backup mkdir -p $dir_backup
echo "done" echo "done"
# change to the dotfiles directory # Change to the dotfiles directory
echo -n "Changing to the $dir directory..." echo -n "Changing to the $dir directory..."
cd $dir cd $dir
echo "done" 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 # 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 for i in ${FILES_TO_SYMLINK[@]}; do
echo "Moving any existing dotfiles from ~ to $dir_backup" echo "Moving any existing dotfiles from ~ to $dir_backup"
mv ~/.$i ~/dotfiles_old/ mv ~/.${i##*/} ~/dotfiles_old/
done 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` # Time to upgrade `ls`
# #
# Use coreutils `ls` if possible
hash gls >/dev/null 2>&1 || alias gls="ls"
# Always use color output for `ls` # Always use color output for `ls`
# Detect which `ls` flavor is in use # 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" colorflag="--color"
else # OS X `ls` else # OS X `ls`
colorflag="-G" colorflag="-G"
fi fi
# Use coreutils `ls` if possible… export CLICOLOR_FORCE=1
hash gls >/dev/null 2>&1 || alias gls="ls"
# List all files colorized in long format # 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 # 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 # List all files colorized in long format, including dot files
alias la="gls -la ${colorflag}" alias la="ls -la ${colorflag}"
# List only directories # List only directories
alias lsd='gls -l | grep "^d"' alias lsd='gls -l | grep "^d"'
@ -123,7 +125,7 @@ alias gc='git checkout'
alias gra='git remote add' alias gra='git remote add'
alias grr='git remote rm' alias grr='git remote rm'
alias gbt=git_list_branches alias gbt=git_list_branches
alias gpu='git pull' alias gpu='git pull origin HEAD --prune'
alias gcl='git clone' alias gcl='git clone'
alias gta='git tag -a -m' alias gta='git tag -a -m'
alias gf='git reflog' alias gf='git reflog'
@ -133,7 +135,6 @@ alias undopush="git push -f origin HEAD^:master"
# `cd` to Git repo root # `cd` to Git repo root
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' 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 # Gist
alias gist-paste="gist --private --copy --paste --filename" # gist-paste filename.ext -- create private Gist from the clipboard contents 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 fi
# Put any proprietary or private functions/values in ~/.private, and this will source them # Put any proprietary or private functions/values in ~/.private, and this will source them
if [ -f $HOME/.private ]; then [ -f $HOME/.private ] && source $HOME/.private
source $HOME/.private
fi # 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 source $ZSH/oh-my-zsh.sh

Loading…
Cancel
Save