From 897db4672f96a1ccaa309cad3ede05c6f1664b28 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 30 Dec 2014 19:37:44 -0600 Subject: [PATCH] Initial files --- .aliases | 55 +++++ .aprc | 7 + .bash_completion | 6 + .bash_profile | 13 ++ .bashrc | 104 +++++++++ .functions | 98 +++++++++ .gemrc | 2 + .gitconfig | 35 ++++ .gitignore | 30 +++ .gitignore.global | 17 ++ .gitmodules | 66 ++++++ .irbrc | 18 ++ .osx | 19 ++ .profile | 14 ++ .tmux.conf | 32 +++ .vim/autoload/pathogen.vim | 347 +++++++++++++++++++++++++++++++ .vim/bundle/ctrlp | 1 + .vim/bundle/delimitMate | 1 + .vim/bundle/molokai | 1 + .vim/bundle/nerdcommenter | 1 + .vim/bundle/nerdtree | 1 + .vim/bundle/supertab | 1 + .vim/bundle/syntastic | 1 + .vim/bundle/tabular | 1 + .vim/bundle/ultisnips | 1 + .vim/bundle/vim-airline | 1 + .vim/bundle/vim-colors-solarized | 1 + .vim/bundle/vim-fugitive | 1 + .vim/bundle/vim-nerdtree-tabs | 1 + .vim/bundle/vim-puppet | 1 + .vim/bundle/vim-rails | 1 + .vim/bundle/vim-repeat | 1 + .vim/bundle/vim-ruby | 1 + .vim/bundle/vim-rvm | 1 + .vim/bundle/vim-snippets | 1 + .vim/bundle/vim-statline | 1 + .vim/bundle/vim-surround | 1 + .vim/bundle/vim-template | 1 + .vimrc | 227 ++++++++++++++++++++ LICENSE | 13 ++ bin/updt | 85 ++++++++ install | 37 ++++ 42 files changed, 1247 insertions(+) create mode 100644 .aliases create mode 100644 .aprc create mode 100644 .bash_completion create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .functions create mode 100644 .gemrc create mode 100644 .gitconfig create mode 100644 .gitignore create mode 100644 .gitignore.global create mode 100644 .gitmodules create mode 100644 .irbrc create mode 100644 .osx create mode 100644 .profile create mode 100644 .tmux.conf create mode 100644 .vim/autoload/pathogen.vim create mode 160000 .vim/bundle/ctrlp create mode 160000 .vim/bundle/delimitMate create mode 160000 .vim/bundle/molokai create mode 160000 .vim/bundle/nerdcommenter create mode 160000 .vim/bundle/nerdtree create mode 160000 .vim/bundle/supertab create mode 160000 .vim/bundle/syntastic create mode 160000 .vim/bundle/tabular create mode 160000 .vim/bundle/ultisnips create mode 160000 .vim/bundle/vim-airline create mode 160000 .vim/bundle/vim-colors-solarized create mode 160000 .vim/bundle/vim-fugitive create mode 160000 .vim/bundle/vim-nerdtree-tabs create mode 160000 .vim/bundle/vim-puppet create mode 160000 .vim/bundle/vim-rails create mode 160000 .vim/bundle/vim-repeat create mode 160000 .vim/bundle/vim-ruby create mode 160000 .vim/bundle/vim-rvm create mode 160000 .vim/bundle/vim-snippets create mode 160000 .vim/bundle/vim-statline create mode 160000 .vim/bundle/vim-surround create mode 160000 .vim/bundle/vim-template create mode 100644 .vimrc create mode 100644 LICENSE create mode 100755 bin/updt create mode 100755 install diff --git a/.aliases b/.aliases new file mode 100644 index 0000000..b89b042 --- /dev/null +++ b/.aliases @@ -0,0 +1,55 @@ +# Aliases ###################################################################### + +# List +alias ll='ls -lahpF' # Ubuntu & Mac compatible + +# Reload the shell (i.e. invoke as a login shell) +alias reload="exec $SHELL -l" + +# Network +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias flush="dscacheutil -flushcache" # Flush Directory Service cache + +# Git +alias cola='(~/git-cola/bin/git-cola &)' +alias dag='(~/git-cola/bin/git-dag &)' + +# Vim +alias gvim="gvim 2>/dev/null" + +# Temp Dir +alias tmp="cd `mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`" +alias tmpf="vim `mktemp 2>/dev/null || mktemp -t 'mytmpfile'`" + +# Tmux +alias ta="tmux attach-session -t" +alias tc="tmux new-session -s" +alias tl="tmux list-sessions" + +# Screen +alias sc="screen -S" # Create +alias sl="screen -ls" # List +alias sr="screen -r" # Resume + +# DOCKER ####################################################################### + +# Aliases +alias dl='docker ps -lq' +alias dlc='docker ps -a' +alias dli='docker images -a' + +# Kill all running containers. +alias docker_killall='docker kill $(docker ps -q)' + +# Delete all stopped containers. +alias docker_cleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps --no-trunc -aq)' + +# Delete all untagged images. +alias docker_cleani='printf "\n>>> Deleting untagged images\n\n" && docker images -q --filter "dangling=true" | xargs docker rmi' + +# Delete all stopped containers and untagged images. +alias docker_clean='docker_cleanc || true && docker_cleani' + +################################################################################ + +# vim: ft=sh \ No newline at end of file diff --git a/.aprc b/.aprc new file mode 100644 index 0000000..7b8be5d --- /dev/null +++ b/.aprc @@ -0,0 +1,7 @@ +AwesomePrint.defaults = { + :indent => -2, + :color => { + :hash => :pale, + :class => :white + } +} diff --git a/.bash_completion b/.bash_completion new file mode 100644 index 0000000..8f83419 --- /dev/null +++ b/.bash_completion @@ -0,0 +1,6 @@ +# Bash Auto Complete ########################################################## + +# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards +[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; + +# vim: ft=sh diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..63d0592 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,13 @@ +# Load environment variables +[[ -s $HOME/.vlad ]] && source $HOME/.vlad + +# System functions and aliases +[[ -s $HOME/.functions ]] && source $HOME/.functions +[[ -s $HOME/.aliases ]] && source $HOME/.aliases +[[ -s $HOME/.osx ]] && source $HOME/.osx + +# Load bash +[[ -s $HOME/.profile ]] && source $HOME/.profile +[[ -s $HOME/.bashrc ]] && source $HOME/.bashrc + +# vim: ft=sh diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..88e878d --- /dev/null +++ b/.bashrc @@ -0,0 +1,104 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 +HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"; + +# Prefer US English and use UTF-8 +export LANG="en_US.UTF-8"; +export LC_ALL="en_US.UTF-8"; + +# Don’t clear the screen after quitting a manual page +export MANPAGER="less -X"; + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# Case-insensitive globbing (used in pathname expansion) +shopt -s nocaseglob; + +# Autocorrect typos in path names when using `cd` +shopt -s cdspell; + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# Highlight section titles in manual pages +export LESS_TERMCAP_md="${yellow}"; + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm) [ "$COLORTERM" == "gnome-terminal" ] && color_prompt=yes;; # Ubuntu + xterm-256color) color_prompt=yes;; +esac + +# check for color support +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + color_prompt=yes +else + color_prompt=no +fi + +if [ "$color_prompt" = yes ]; then + PS1="\[$(tput bold)$(tput setaf 2)\]\u\[$(tput setaf 7)\]@\[$(tput setaf 4)\]\h:\[$(tput setaf 6)\]\w $ \[$(tput sgr0)\]" +else + PS1='\u@\h:\w\$ ' +fi +unset color_prompt + +# enable color support of ls and also add handy aliases +export CLICOLOR=1 +export LSCOLORS=GxFxCxDxBxegedabagaced +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# Grep colors +export GREP_OPTIONS='--color=auto' + +# Alias definitions. +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# Add tab completion for many Bash commands +if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then + source "$(brew --prefix)/etc/bash_completion"; +elif [ -f /etc/bash_completion ]; then + source /etc/bash_completion; +fi + +# GNU Core utilities +if which brew > /dev/null && [ -d "$(brew --prefix coreutils)/libexec/gnubin" ]; then + export PATH="$PATH:$(brew --prefix coreutils)/libexec/gnubin" + export MANPATH="$MANPATH:$(brew --prefix coreutils)/libexec/gnubin" +fi + +# RVM +[[ -s "${HOME}/.rvm/scripts/rvm" ]] && source "${HOME}/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* +[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting (needs to be last) diff --git a/.functions b/.functions new file mode 100644 index 0000000..774501b --- /dev/null +++ b/.functions @@ -0,0 +1,98 @@ +### Functions ################################################################# + +## Logging stuff. +function e_header() { echo -e "\n\033[1m$@\033[0m"; } +function e_ok() { echo -e " \033[1;32m✔\033[0m $@"; } +function e_error() { echo -e " \033[1;31m✖\033[0m $@"; } +function e_warn() { echo -e " \033[1;33m $@\033[0m"; } +function e_arrow() { echo -e " \033[0;34m➜\033[0m $@"; } +function e_footer() { echo -e "\n\033[1m$@\033[0m\n"; } + +# $1 => error message, $2 => exit code +function e_abort() { e_error $1; exit $2; } + +## OS detection +is_osx() { [[ $(uname) == Darwin ]] || return 1; } +is_linux() { [[ $(uname) == Linux ]] || return 1; } +is_ubuntu() { [[ "$(cat /etc/issue 2> /dev/null)" =~ Ubuntu ]] || return 1; } + +# Start an HTTP server from a directory, optionally specifying the port +server() { + local port="${1:-8000}"; + sleep 1 && open "http://localhost:${port}/" & + # Set the default Content-Type to `text/plain` instead of `application/octet-stream` + # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) + python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"; +} + +#Extract most know archives with one command +extract () { + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar e $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via extract()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +# Make a directory and jump directly into it +mkd() { mkdir -p "$1" && cd "$1" ;} + +## VMware +vmware_install() { + ( + cd `mktemp -d` + sudo apt-get --quiet --yes install build-essential linux-headers-$(uname -r) + tar zxvf /media/$(whoami)/"VMware Tools"/VMwareTools-*.tar.gz + sudo ./vmware-tools-distrib/vmware-install.pl -d + ) +} +vmware_refresh() { sudo vmware-config-tools.pl -d ;} + +# DOTFILES +# Create links for dotfiles +link_dotfiles(){ + [[ -n $@ ]] || return 1 + + e_header 'Symlinks' + bakdir="$HOME/dotfiles.bak/$(date "+%Y_%m_%d-%H_%M_%S")" + mkdir -p $bakdir && e_ok "Backups will be saved in '$bakdir'\n" + + ( + cd $HOME + for dotfile in $@; do + dot=$(basename $dotfile) + old=${HOME}/${dot} + + if [[ -s $old ]]; then # IF old file exists + if [[ -L $old ]]; then # Replace if old file is a symlink + rm $old && \ + ln -sfn $dotfile $old && \ + e_ok "Replaced link for $old to $dotfile" + else # Backup old file if it's not a symlink + mv $old $bakdir && \ + e_ok "$old saved at $bakdir" + ln -s $dotfile $old && \ + e_ok "Linked $old to $dotfile" + fi + else # Create symlink if the oldfile doesn't exist + ln -sfn $dotfile $old && \ + e_ok "Linked $old to $dotfile" + fi + done + ) +} + +# vim: ft=sh diff --git a/.gemrc b/.gemrc new file mode 100644 index 0000000..ef73538 --- /dev/null +++ b/.gemrc @@ -0,0 +1,2 @@ +gem: --no-ri --no-rdoc + diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..c02f3bf --- /dev/null +++ b/.gitconfig @@ -0,0 +1,35 @@ +[alias] + st = !git fetch && git status + co = checkout + ci = commit + br = branch + mg = merge --no-ff + lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all --decorate + smup = !"git fetch && git pull origin master && git submodule foreach --recursive git fetch && git submodule foreach --recursive git pull origin master && git commit -a -m 'Submodule updates' && git push" + cm = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -v" + cmm = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -m" + wip = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -m \"WIP\"" + unwip = !"git log -n 1 | grep -q -c WIP && git reset HEAD~1" + +[core] + autocrlf = false + excludesfile = ~/.gitignore.global + +[color] + ui = auto + diff = auto + status = auto + branch = auto + interactive = auto + grep = auto + +[push] + default = tracking + +[include] + path = ~/.gitconfig.private + +[filter "media"] + required = true + clean = git media clean %f + smudge = git media smudge %f diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2dea5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Private +.vlad +.ssh +.keys +.gem +.dockercfg +.gitconfig.private + +# Ignore any file with '.local' in the name +*.local* + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes + +# Vim +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist +*~ diff --git a/.gitignore.global b/.gitignore.global new file mode 100644 index 0000000..2e5579a --- /dev/null +++ b/.gitignore.global @@ -0,0 +1,17 @@ +syntax: glob +.#* +[#]*# +*~ +.*.sw? +.sw? +Session.vim +tags +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.AppleDouble +scratch.* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e6d3b18 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,66 @@ +[submodule ".vim/bundle/nerdtree"] + path = .vim/bundle/nerdtree + url = git@github.com:scrooloose/nerdtree.git +[submodule ".vim/bundle/supertab"] + path = .vim/bundle/supertab + url = git@github.com:ervandew/supertab.git +[submodule ".vim/bundle/vim-fugitive"] + path = .vim/bundle/vim-fugitive + url = git@github.com:tpope/vim-fugitive.git +[submodule ".vim/bundle/vim-nerdtree-tabs"] + path = .vim/bundle/vim-nerdtree-tabs + url = git@github.com:jistr/vim-nerdtree-tabs.git +[submodule ".vim/bundle/vim-rails"] + path = .vim/bundle/vim-rails + url = git@github.com:tpope/vim-rails.git +[submodule ".vim/bundle/vim-ruby"] + path = .vim/bundle/vim-ruby + url = git@github.com:vim-ruby/vim-ruby.git +[submodule ".vim/bundle/vim-template"] + path = .vim/bundle/vim-template + url = git@github.com:thinca/vim-template.git +[submodule ".vim/bundle/delimitMate"] + path = .vim/bundle/delimitMate + url = git@github.com:Raimondi/delimitMate.git +[submodule ".vim/bundle/nerdcommenter"] + path = .vim/bundle/nerdcommenter + url = git@github.com:scrooloose/nerdcommenter.git +[submodule ".vim/bundle/tabular"] + path = .vim/bundle/tabular + url = git@github.com:godlygeek/tabular.git +[submodule ".vim/bundle/vim-statline"] + path = .vim/bundle/vim-statline + url = git@github.com:millermedeiros/vim-statline.git +[submodule ".vim/bundle/syntastic"] + path = .vim/bundle/syntastic + url = git@github.com:scrooloose/syntastic.git +[submodule ".vim/bundle/vim-puppet"] + path = .vim/bundle/vim-puppet + url = git@github.com:rodjek/vim-puppet.git +[submodule ".vim/bundle/vim-surround"] + path = .vim/bundle/vim-surround + url = git@github.com:tpope/vim-surround.git +[submodule ".vim/bundle/vim-repeat"] + path = .vim/bundle/vim-repeat + url = git@github.com:tpope/vim-repeat.git +[submodule ".vim/bundle/vim-colors-solarized"] + path = .vim/bundle/vim-colors-solarized + url = git@github.com:altercation/vim-colors-solarized.git +[submodule ".vim/bundle/ultisnips"] + path = .vim/bundle/ultisnips + url = git@github.com:SirVer/ultisnips.git +[submodule ".vim/bundle/vim-rvm"] + path = .vim/bundle/vim-rvm + url = git@github.com:tpope/vim-rvm.git +[submodule ".vim/bundle/vim-snippets"] + path = .vim/bundle/vim-snippets + url = git@github.com:honza/vim-snippets.git +[submodule ".vim/bundle/molokai"] + path = .vim/bundle/molokai + url = git@github.com:tomasr/molokai.git +[submodule ".vim/bundle/vim-airline"] + path = .vim/bundle/vim-airline + url = git@github.com:bling/vim-airline.git +[submodule ".vim/bundle/ctrlp"] + path = .vim/bundle/ctrlp + url = git@github.com:kien/ctrlp.vim.git diff --git a/.irbrc b/.irbrc new file mode 100644 index 0000000..5c7e58b --- /dev/null +++ b/.irbrc @@ -0,0 +1,18 @@ +require 'irb/completion' +require 'irb/ext/save-history' + +begin + require "awesome_print" + AwesomePrint.irb! +rescue LoadError +end + +IRB.conf[:SAVE_HISTORY] = 999 +IRB.conf[:EVAL_HISTORY] = 999 +IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history" +IRB.conf[:AUTO_INDENT] = true +IRB.conf[:USE_READLINE] = true +IRB.conf[:PROMPT_MODE] = :SIMPLE +IRB.conf[:LOAD_MODULES] |= %w(irb/completion stringio enumerator ostruct) + +$: << '.' diff --git a/.osx b/.osx new file mode 100644 index 0000000..4b747e3 --- /dev/null +++ b/.osx @@ -0,0 +1,19 @@ +# MAC SPECIFIC +is_osx || return 1 + +# Load Boot2Docker variables +b2d() { + $(boot2docker shellinit 2>/dev/null) || boot2docker start && \ + $(boot2docker shellinit 2>/dev/null) +} + +# ALIASES + +# Suspend +alias away='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend' + +# Show/hide hidden files in Finder +alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" + +# vim: ft=sh diff --git a/.profile b/.profile new file mode 100644 index 0000000..5931bfa --- /dev/null +++ b/.profile @@ -0,0 +1,14 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..15bb3eb --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,32 @@ +# 256color mode +set -g default-terminal "xterm-256color" + +# Watch for activity in background windows +setw -g monitor-activity on +set -g visual-activity on + +# Misc +set -g history-limit 9999999 + +# set first window to index 1 (not 0) to map more to the keyboard layout... +set -g base-index 1 +setw -g pane-base-index 1 + +# remap prefix to Control + a +set -g prefix C-a +# bind 'C-a C-a' to type 'C-a' +bind C-a send-prefix +unbind C-b + +# Reload config +unbind r +bind r source-file ~/.tmux.conf + +# Xterm +setw -g xterm-keys on + +# Mouse +set -g mode-mouse on +set -g mouse-resize-pane on +set -g mouse-select-pane on +set -g mouse-select-window on diff --git a/.vim/autoload/pathogen.vim b/.vim/autoload/pathogen.vim new file mode 100644 index 0000000..a13ae08 --- /dev/null +++ b/.vim/autoload/pathogen.vim @@ -0,0 +1,347 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.3 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). Curly braces are expanded with pathogen#expand(): +" "bundle/{}" finds all subdirectories inside "bundle" inside all directories +" in the runtime path. +function! pathogen#infect(...) abort + for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] + if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + call pathogen#surround(path) + elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + elseif path =~# '[{}*]' + call pathogen#interpose(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#interpose(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + if pathogen#is_disabled($MYVIMRC) + return 'finish' + endif + return '' +endfunction + +" Split a path into a list. +function! pathogen#split(path) abort + if type(a:path) == type([]) | return a:path | endif + if empty(a:path) | return [] | endif + let split = split(a:path,'\\\@]','\\&','') + endif +endfunction + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort "{{{1 + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction + +" Section: Deprecated + +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) abort + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#slash() . '{}') +endfunction + +function! pathogen#incubate(...) abort + let name = a:0 ? a:1 : 'bundle/{}' + call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') + return pathogen#interpose(name) +endfunction + +" Deprecated alias for pathogen#interpose(). +function! pathogen#runtime_append_all_bundles(...) abort + if a:0 + call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') + else + call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') + endif + return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') +endfunction + +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction + +function! s:Findcomplete(A,L,P) + let sep = pathogen#slash() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/.vim/bundle/ctrlp b/.vim/bundle/ctrlp new file mode 160000 index 0000000..b5d3fe6 --- /dev/null +++ b/.vim/bundle/ctrlp @@ -0,0 +1 @@ +Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f diff --git a/.vim/bundle/delimitMate b/.vim/bundle/delimitMate new file mode 160000 index 0000000..fe1983c --- /dev/null +++ b/.vim/bundle/delimitMate @@ -0,0 +1 @@ +Subproject commit fe1983cfa1cf0924ac9b2b8576255daffd36afbf diff --git a/.vim/bundle/molokai b/.vim/bundle/molokai new file mode 160000 index 0000000..db8ce13 --- /dev/null +++ b/.vim/bundle/molokai @@ -0,0 +1 @@ +Subproject commit db8ce13b3737d3ddea8368498183d7c204a762eb diff --git a/.vim/bundle/nerdcommenter b/.vim/bundle/nerdcommenter new file mode 160000 index 0000000..6549cfd --- /dev/null +++ b/.vim/bundle/nerdcommenter @@ -0,0 +1 @@ +Subproject commit 6549cfde45339bd4f711504196ff3e8b766ef5e6 diff --git a/.vim/bundle/nerdtree b/.vim/bundle/nerdtree new file mode 160000 index 0000000..3b98a7f --- /dev/null +++ b/.vim/bundle/nerdtree @@ -0,0 +1 @@ +Subproject commit 3b98a7fcae8f9fff356907171f0406ff8cd28921 diff --git a/.vim/bundle/supertab b/.vim/bundle/supertab new file mode 160000 index 0000000..b0ca47f --- /dev/null +++ b/.vim/bundle/supertab @@ -0,0 +1 @@ +Subproject commit b0ca47f4570385043f270f9278ba6d50d1d2fa00 diff --git a/.vim/bundle/syntastic b/.vim/bundle/syntastic new file mode 160000 index 0000000..b340672 --- /dev/null +++ b/.vim/bundle/syntastic @@ -0,0 +1 @@ +Subproject commit b340672bd03d877ede83f95ccec6a98bbd536d42 diff --git a/.vim/bundle/tabular b/.vim/bundle/tabular new file mode 160000 index 0000000..60f2564 --- /dev/null +++ b/.vim/bundle/tabular @@ -0,0 +1 @@ +Subproject commit 60f25648814f0695eeb6c1040d97adca93c4e0bb diff --git a/.vim/bundle/ultisnips b/.vim/bundle/ultisnips new file mode 160000 index 0000000..7df82bb --- /dev/null +++ b/.vim/bundle/ultisnips @@ -0,0 +1 @@ +Subproject commit 7df82bbe5357e42c7539299726e9cccfe6323e85 diff --git a/.vim/bundle/vim-airline b/.vim/bundle/vim-airline new file mode 160000 index 0000000..6387268 --- /dev/null +++ b/.vim/bundle/vim-airline @@ -0,0 +1 @@ +Subproject commit 6387268f13c513d8afeb98d0621bd3da8219dfc6 diff --git a/.vim/bundle/vim-colors-solarized b/.vim/bundle/vim-colors-solarized new file mode 160000 index 0000000..528a59f --- /dev/null +++ b/.vim/bundle/vim-colors-solarized @@ -0,0 +1 @@ +Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21 diff --git a/.vim/bundle/vim-fugitive b/.vim/bundle/vim-fugitive new file mode 160000 index 0000000..2c8461d --- /dev/null +++ b/.vim/bundle/vim-fugitive @@ -0,0 +1 @@ +Subproject commit 2c8461db084d205903a792a23163faa546f143c9 diff --git a/.vim/bundle/vim-nerdtree-tabs b/.vim/bundle/vim-nerdtree-tabs new file mode 160000 index 0000000..0decec1 --- /dev/null +++ b/.vim/bundle/vim-nerdtree-tabs @@ -0,0 +1 @@ +Subproject commit 0decec122e9bb3e9328b01fa20a9650e79cc6ca7 diff --git a/.vim/bundle/vim-puppet b/.vim/bundle/vim-puppet new file mode 160000 index 0000000..d881b93 --- /dev/null +++ b/.vim/bundle/vim-puppet @@ -0,0 +1 @@ +Subproject commit d881b93dc4a8ed1374ad44439aeeb47808a6b91a diff --git a/.vim/bundle/vim-rails b/.vim/bundle/vim-rails new file mode 160000 index 0000000..18b5806 --- /dev/null +++ b/.vim/bundle/vim-rails @@ -0,0 +1 @@ +Subproject commit 18b5806910df63d65206593cd2001807d01cd083 diff --git a/.vim/bundle/vim-repeat b/.vim/bundle/vim-repeat new file mode 160000 index 0000000..5eba0f1 --- /dev/null +++ b/.vim/bundle/vim-repeat @@ -0,0 +1 @@ +Subproject commit 5eba0f19c87402643eb8a7e7d20d9d5338fd6d71 diff --git a/.vim/bundle/vim-ruby b/.vim/bundle/vim-ruby new file mode 160000 index 0000000..4661bf7 --- /dev/null +++ b/.vim/bundle/vim-ruby @@ -0,0 +1 @@ +Subproject commit 4661bf70f428c0436ea60d9ba515b4b8dca73f0d diff --git a/.vim/bundle/vim-rvm b/.vim/bundle/vim-rvm new file mode 160000 index 0000000..06bc52c --- /dev/null +++ b/.vim/bundle/vim-rvm @@ -0,0 +1 @@ +Subproject commit 06bc52c308c27b6e4eb41c744494ffc6dbb30f49 diff --git a/.vim/bundle/vim-snippets b/.vim/bundle/vim-snippets new file mode 160000 index 0000000..42f8ee2 --- /dev/null +++ b/.vim/bundle/vim-snippets @@ -0,0 +1 @@ +Subproject commit 42f8ee269c88e67ccb4a9694b7b7e2b9cdb6c1c3 diff --git a/.vim/bundle/vim-statline b/.vim/bundle/vim-statline new file mode 160000 index 0000000..45d369e --- /dev/null +++ b/.vim/bundle/vim-statline @@ -0,0 +1 @@ +Subproject commit 45d369eff6e2c5441ba21918825a8c215a44a951 diff --git a/.vim/bundle/vim-surround b/.vim/bundle/vim-surround new file mode 160000 index 0000000..fa433e0 --- /dev/null +++ b/.vim/bundle/vim-surround @@ -0,0 +1 @@ +Subproject commit fa433e0b7330753688f715f3be5d10dc480f20e5 diff --git a/.vim/bundle/vim-template b/.vim/bundle/vim-template new file mode 160000 index 0000000..24687c1 --- /dev/null +++ b/.vim/bundle/vim-template @@ -0,0 +1 @@ +Subproject commit 24687c1a59cb2828be4aec21ec75103d22a1c71e diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..d8d5df1 --- /dev/null +++ b/.vimrc @@ -0,0 +1,227 @@ +"Use Vim settings, rather then Vi settings (much better!). +"This must be first, because it changes other options as a side effect. +set nocompatible + +"activate pathogen +execute pathogen#infect() +syntax on +filetype plugin indent on + +" SETTINGS -------------------------------------------------------------------- + +" Theme +colorscheme molokai +set background=dark + +" Change key key +let mapleader="," + +" Misc +set backspace=indent,eol,start "allow backspacing over everything in insert mode +set history=1000 "store lots of :cmdline history +set showcmd "show incomplete cmds down the bottom +set showmode "show current mode down the bottom +set number "show line numbers +set incsearch "find the next match as we type the search +set hlsearch "highlight searches by default +set wrap "dont wrap lines +set linebreak "wrap lines at convenient points +set wildmode=list:longest,full "make cmdline tab completion similar to bash +set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches +set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing +set t_Co=256 " Tell the term has 256 colors +set hidden " Hide buffers when not displayed +set noeb vb t_vb= "disable beep +set visualbell "flash screen on beep +set cursorline " Highlight the current line +set colorcolumn=80 " Lines longer than 80 chars +set shellcmdflag=-lc " set the ! shell to be a login shell to get at functions and aliases +set showmatch " Show matching braces. +set ttyfast " Fast terminal connection +set virtualedit=block + +"default indent settings +set shiftwidth=2 +set softtabstop=2 +set tabstop=2 +set expandtab +set autoindent +set smarttab + +"folding settings +set foldmethod=indent "fold based on indent +set foldnestmax=3 "deepest fold is 3 levels +set nofoldenable "dont fold by default + +"some stuff to get the mouse going in term +set mouse=a +set ttymouse=xterm2 + +" Unix +set encoding=utf8 +set fileencoding=utf8 +set fileformat=unix " file format Unix dammit +set fileformats=unix,dos " file format Unix dammit + +" Spell check +set spell spelllang=en_us +map sn :setlocal nospell " disable it + +" Swap files +set directory=/tmp + +" Line wrapping on by default +set wrap +"set linebreak + +" Search options +set incsearch " incremental searching on +set hlsearch " highlight all matches +set ignorecase " Ignore case when searching +set magic " Set magic on, for regular expressions +set smartcase + +" Visual highlight +hi Visual term=reverse cterm=reverse guibg=Grey + +" Listchars +set list +if (&termencoding ==# 'utf-8' || &encoding ==# 'utf-8') && version >= 700 + let &listchars = "tab:\u21e5\u00b7,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u26ad" + let &fillchars = "vert:\u259a,fold:\u00b7" +else + set listchars=tab:>\ ,trail:-,extends:>,precedes:< +endif + +" END SETTINGS ---------------------------------------------------------------- + +" MAPPINGS -------------------------------------------------------------------- + +" Remove highlighted search +"nnoremap :noh +"nnoremap [ [ + +" Will allow you to use :w!! to write to a file using sudo if you forgot to sudo +" vim file (it will prompt for sudo password when writing) +cmap w!! %!sudo tee > /dev/null % + +" Cut Copy Paste +if has('unnamedplus') + set clipboard=unnamedplus +else + set clipboard=unnamed +endif +vnoremap p "0p " Replace without yanking + +" Select all text +nmap ggVG + +" Moves line up or down +nmap :.m+ +nmap :-m.k + +" Search for the word under cursor in current dir +map :execute "vimgrep /" . expand("") . "/gj **" cw + +" Mappings to access buffers +" ,. : list buffers +" ,b ,n ,g: go back/forward/last used buffer +" ,1 ,2: go to buffer 1/2 etc +nnoremap . :ls +nnoremap b :bprevious +nnoremap n :bnext +nnoremap g :e# +nnoremap 1 :1b +nnoremap 2 :2b +nnoremap 3 :3b +nnoremap 4 :4b +nnoremap 5 :5b +nnoremap 6 :6b +nnoremap 7 :7b +nnoremap 8 :8b +nnoremap 9 :9b +nnoremap 0 :10b + +" END MAPPINGS ---------------------------------------------------------------- + +" PLUGINS --------------------------------------------------------------------- +" UltiSnips +let g:UltiSnipsSnippetDirectories=["vim-snippets/snippets"] + +" Airline +let g:airline#extensions#tabline#enabled = 1 +let g:airline_powerline_fonts=1 + +" Ruby +imap end-cc +let g:rubycomplete_buffer_loading = 1 +let g:rubycomplete_classes_in_global = 1 +let g:rubycomplete_rails = 1 + +" NERDTree { +"map l :NERDTreeFindw +noremap :NERDTree +noremap :NERDTreeClose +let g:NERDTreeShowBookmarks = 1 +let g:NERDTreeShowHidden = 1 +let g:NERDTreeMouseMode = 2 +let g:NERDTreeChDirMode = 2 +let g:nerdtree_tabs_open_on_gui_startup = 0 +let g:nerdtree_tabs_open_on_console_startup = 0 +let g:nerdtree_tabs_smart_startup_focus = 1 +let g:nerdtree_tabs_synchronize_view = 1 +let g:nerdtree_tabs_meaningful_tab_names = 1 +"} + +" Tasklist { +let g:tlWindowPosition = 1 " Open window at the bottom (use 0 for top) +" } + +" ACK +"let g:ackprg="ack-grep -H --nocolor --nogroup --column" + +" Minibuffer Explorer Settings +let g:miniBufExplMapWindowNavVim = 0 +let g:miniBufExplMapWindowNavArrows = 0 +let g:miniBufExplMapCTabSwitchBufs = 1 +let g:miniBufExplMapCTabSwitchWindows = 1 +let g:miniBufExplUseSingleClick = 1 +let g:miniBufExplModSelTarget = 1 + +" END PLUGINS ----------------------------------------------------------------- + +" COMMANDS -------------------------------------------------------------------- + +command Todo noautocmd vimgrep /TODO\|FIXME/j ** | cw "Look for notes +command Spaces autocmd BufWritePre * :%s/\s\+$//e " Delete all trailing whitespace + +" END COMMANDS ---------------------------------------------------------------- + +" OS SPECIFIC ---------------------------------------------------------------- + +if has('mac') + set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12 +elseif has('win32') || has('win64') + set guifont=Consolas:h9 + set lines=35 columns=150 " Window height & width + set dir=$TEMP +else + set guifont=Monospace\ 9 + set lines=45 columns=150 " Window height & width +end + +" Tab Navigation +nmap :tabprevious +nmap :tabnext +map :tabprevious +map :tabnext +imap :tabpreviousi +imap :tabnexti +nmap :tabnew +imap :tabnew + +" END OS SPECIFIC ---------------------------------------------------------------- + +" FUNCTIONS ------------------------------------------------------------------- + +" END FUNCTIONS --------------------------------------------------------------- diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..04d393d --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (C) 2015 Vlad Ghinea + +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. diff --git a/bin/updt b/bin/updt new file mode 100755 index 0000000..927e399 --- /dev/null +++ b/bin/updt @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +## Update + +COMMAND=$1 +AVAILABLE=' + all + ubuntu + brew + vim + aws + ruby + cola + docker_images +' + +. ~/.functions + +updt_ubuntu() { + is_ubuntu || return + sudo apt-get --quiet --yes update + sudo apt-get --quiet --yes upgrade +} + +updt_brew() { + is_osx || return + brew doctor + brew update + brew upgrade + brew cleanup +} + +updt_vim() { + ( + [[ -d ${HOME}/.vim ]] && cd ${HOME}/.vim || return + curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim + # TODO Parallel git submodule foreach "(git fetch && git reset --hard origin/master) &" + git submodule foreach --recursive "git fetch && git reset --hard origin/master" + ) +} + +updt_ruby() { + env | grep -q ^rvm_version= || return + rvm get stable + gem update --system + gem update +} + +updt_cola() { + is_linux || return + ( + COLADIR="${HOME}/git-cola" + if [ -d $COLADIR ]; then + cd $COLADIR && git remote update + if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]; then + git reset --hard origin/master + fi + else + cd $HOME && git clone git://github.com/git-cola/git-cola.git + fi + ) +} + +updt_docker_images() { + which docker > /dev/null || return + for img in $(docker images 2>/dev/null | awk '$0 !~ // {print $1":"$2}' | tail -n +2 | sort -u); do + docker pull $img + done +} + +updt_aws() { + sudo pip install --upgrade awscli +} + +updt_all() { + for cmd in $AVAILABLE; do + [[ "$cmd" != 'all' ]] && updt_$cmd + done +} + +if [[ "$AVAILABLE" =~ "$COMMAND" ]]; then + updt_$COMMAND +else + e_abort "$COMMAND is not valid. Available commands are: $AVAILABLE" +fi diff --git a/install b/install new file mode 100755 index 0000000..83588e4 --- /dev/null +++ b/install @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +############################################################################### +# This script installs the dotfiles +# @author Vlad Ghinea +############################################################################### + +# Exit immediately if a command exits with a non-zero status +set -e + +# Read dotfiles directory +DOTFILES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load system functions +if [[ -s $DOTFILES/.functions ]]; then + source $DOTFILES/.functions && \ + e_header 'Set-up System' && \ + e_ok 'Loaded system functions' +else + echo " [FATAL] '.functions' file was not found"; exit 1 +fi + +# Link dotfiles (excluding unnecessary files and including some nondot) +link_dotfiles $(find $DOTFILES -maxdepth 1 -name '.*' \ + ! -path '*/.git' \ + ! -path '*/.gitignore' \ + ! -path '*/.gitmodules' \ + ! -path '*/.DS_Store' \ + -o -name 'bin') + +e_header 'Permissions' +find ~/bin/ -type f -exec chmod 755 {} \; && \ + e_ok '~/bin/* is set to 755' +find ~/.ssh/ -type f -name 'id_*' -exec chmod 600 {} \; && \ + e_ok '~/.ssh/id* is set to 600' + +e_footer 'Done' && exit 0