Skip to content

Commit

Permalink
Initial commit of files
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Nov 18, 2014
1 parent de66836 commit 2ac6e51
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 0 deletions.
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2014 Brian Cain

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
124 changes: 124 additions & 0 deletions install.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#! /bin/bash

# Author: Brian Cain
# Installs your dotfiles

# Function to determine package manager
function os_type() {
which yum > /dev/null && {
echo "yum"
export OSPACKMAN="yum"
return;
}
which apt-get > /dev/null && {
echo "apt-get"
export OSPACKMAN="aptget"
return;
}
which brew > /dev/null && {
echo "homebrew"
export OSPACKMAN="homebrew"
return;
}
}

function setup_bash() {

}

function setup_zsh() {
echo 'Adding oh-my-zsh to dotfiles...'
git clone https://www.github.com/robbyrussell/oh-my-zsh.git
}

function determine_shell() {
echo 'Please pick your favorite shell:'
echo '(1) Bash'
echo '(2) Zsh'
read -p 'Enter a number: ' SHELL_CHOICE
if [[ $SHELL_CHOICE == '1' ]] ; then
export LOGIN_SHELL="bash"
elif [[ $SHELL_CHOICE == '2' ]] ; then
export LOGIN_SHELL="zsh"
else
echo 'Could not determine choice.'
exit 1
fi
}

function setup_vim() {
echo "Setting up vim..."
vim +BundleInstall +qall
}

function setup_git() {
echo 'Setting up git config...'
read -p 'Enter username: ' GIT_USER
git config --global user.name "$GIT_USER"
read -p 'Enter email: ' GIT_EMAIL
git config --global user.email $GIT_EMAIL
read -p 'Enter Github account: ' GIT_EMAIL
git config --global github.user $GITHUB_USER
git config --global core.editor vim
git config --global color.ui true
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
}

function symlink_files() {
ln -s vimrc ~/.vimrc
ln -s zshrc ~/.zshrc
}

set -e
(
# general package array
declare -a packages=('vim' 'git' 'tree' 'htop' 'wget' 'curl')

determine_shell
if [[ $LOGIN_SHELL == 'bash' ]] ; then
setup_bash
packages+='bash'
elif [[ $LOGIN_SHELL == 'zsh' ]] ; then
setup_zsh
packages+='zsh'
fi

if [[ $OSPACKMAN == "homebrew" ]]; then
echo "You are running homebrew."
echo "Using Homebrew to install packages..."
brew update
declare -a macpackages=('findutils' 'macvim' 'the_silver_searcher')
brew install "${packages[@]}" "${macpackages[@]}"
brew cleanup
elif [[ "$OSPACKMAN" == "yum" ]]; then
echo "You are running yum."
echo "Using apt-get to install packages...."
sudo yum update
sudo yum install "${packages[@]}"
elif [[ "$OSPACKMAN" == "aptget" ]]; then
echo "You are running apt-get"
echo "Using apt-get to install packages...."
sudo apt-get update
sudo apt-get install "${packages[@]}"
else
echo "Could not determine OS. Exiting..."
exit 1
fi

setup_git
setup_vim
symlink_files

if [[ $LOGIN_SHELL == 'bash' ]] ; then
elif [[ $LOGIN_SHELL == 'zsh' ]] ; then
echo "Changing shells to ZSH"
chsh -s /bin/zsh

echo "Operating System setup complete."
echo "Reloading session"
exec zsh
fi

)
15 changes: 15 additions & 0 deletions update-zsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash

# Brian Cain 2014
# Update oh-my-zsh

OMZDIR=~/.dotfiles/oh-my-zsh

if [ -d "$OMZDIR" ] ; then
echo 'Updating oh-my-zsh to latest version'
cd ~/.dotfiles/oh-my-zsh
git pull origin master
cd -
fi

echo 'Complete Update!'
95 changes: 95 additions & 0 deletions vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"-----------------------------------------------------------------------------
" Vim Starter Configuration (Dotfiles)
"
"-----------------------------------------------------------------------------

set nocompatible
let &t_Co=256
syntax enable
filetype plugin indent on

"-----------------------------------------------------------------------------
" Vundle Config
"-----------------------------------------------------------------------------

" Setting up Vundle
" Found here: http://www.erikzaadi.com/2012/03/19/auto-installing-vundle-from-your-vimrc/
let has_vundle=1
let vundle_readme=expand('~/.dotfiles/vim/bundle/vundle/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle..."
echo ""
silent !mkdir -p ~/.dotfiles/vim/bundle
silent !git clone https://github.com/gmarik/vundle ~/.dotfiles/vim/bundle/vundle
let has_vundle=0
endif

" Vundle setup config
set rtp+=~/.dotfiles/vim/bundle/vundle/
call vundle#rc()

" Required Bundle
Bundle 'gmarik/vundle'
" Additional Bundles go here"
"
" Installing plugins the first time
" If exists, skip
if has_vundle == 0
echo "Installing Bundles, please ignore key map error messages"
echo ""
:BundleInstall
endif

"-----------------------------------------------------------------------------
" Encoding and general usability
"-----------------------------------------------------------------------------

" http://stevelosh.com/blog/2010/09/coming-home-to-vim/#important-vimrc-lines
set encoding=utf-8
set visualbell

" Line numbering
set number

" If a file has been changed outside of Vim, reload it inside of Vim
set autoread

" Show tabs and trailing whitespace visually
if (&termencoding == "utf-8") || has("gui_running")
if v:version >= 700
set list listchars=tab:»·,trail:·,extends:…,nbsp:‗
else
set list listchars=tab:»·,trail:·,extends:
endif
else
if v:version >= 700
set list listchars=tab:>-,trail:.,extends:>,nbsp:_
else
set list listchars=tab:>-,trail:.,extends:>
endif
endif

"-----------------------------------------------------------------------------
" Search, highlight, spelling, etc.
"-----------------------------------------------------------------------------

" Improved searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase

set incsearch

" Enable syntax highlighting, if one exists
if has("syntax")
syntax on
endif

"-----------------------------------------------------------------------------
" Spacing
"-----------------------------------------------------------------------------

set autoindent
set smartindent
set tabstop=2 shiftwidth=2 expandtab
80 changes: 80 additions & 0 deletions zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

export PATH=$HOME/bin:/usr/local/bin:$PATH
# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

0 comments on commit 2ac6e51

Please sign in to comment.