Skip to content

Instantly share code, notes, and snippets.

@StuMinch
Forked from jaimegago/shell_vim_prov
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StuMinch/645800617c709bb9609a to your computer and use it in GitHub Desktop.
Save StuMinch/645800617c709bb9609a to your computer and use it in GitHub Desktop.
#!/bin/bash
function cinfo() {
COLOR='\033[01;33m' # bold yellow
RESET='\033[00;00m' # normal white
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
}
##
cinfo "Local Provisioning detected"
#A couple of tools that are not on my base box
#yum install vim wget git lynx tig puppet-lint bash-completion -y
apt-get install vim wget git lynx tig bash-completion -y
#Bash profile
cat <<'BASH_PROF' > ${HOME}/.bash_profile # some folks will scream ".bashrc" meh.
# git CLI autocompletion
if [ -f ${HOME}/.git-completion.sh ]; then
source ${HOME}/.git-completion.sh
fi
# git prompt config (detects when you're in a git repo and does lotz of _very_ useful stuff like showing the current branch).
# A must for git users
if [ -f ${HOME}/.git-prompt.sh ];then
source ${HOME}/.git-prompt.sh
fi
alias ls='ls -G'
alias ll='ls -lhG --color'
set -o vi
PS1='\[\e[1m\]________________________________________________________________________________\n\[\[\e[37;30m\]| \w @ \h (\u) $(__git_ps1 "\e[0;34m\]git {%s}") \n| => \[\e[0m\]'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
export HISTCONTROL=erasedups
export HISTSIZE=10000
export HISTTIMEFORMAT="%F %T "
export TERM='xterm-256color'
shopt -s histappend
alias vi='vim'
# I use this with iterm2 to show the host in the window title
export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME%%.*}: ${PWD/#$HOME/${HOME}}\007"'
# get some git colors
git config --global color.ui auto
git config --global color.diff auto
BASH_PROF
#git autocomplete and prompt scripts
if [ ! -f ${HOME}/.git-prompt.sh ]; then
wget -O ${HOME}/.git-prompt.sh https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh
fi
if [ ! -f ${HOME}/.git-completion.sh ]; then
wget -O ${HOME}/.git-completion.sh https://raw.github.com/git/git/master/contrib/completion/git-completion.bash
fi
#Vim stuff (vimrc and plugins)
cat << 'VIMRC' >${HOME}/.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
colorscheme default
let g:indent_guides_enable_on_vim_startup = 1
set ts=2 sw=2 et
let g:Powerline_symbols = 'fancy'
let g:indent_guides_auto_colors=0
let g:indent_guides_guide_size=1
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=grey
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=red ctermbg=black
set laststatus=2
map <F4> :NERDTreeToggle<CR>
map <F5> :NERDTreeFind<CR>
nnoremap <F6> :set nonumber!<CR>
nnoremap <F7> :GundoToggle<CR>
nnoremap <F8> :set nocursorcolumn!<CR>
set cursorline
set number
let &colorcolumn=join(range(81,999),",")
highlight ColorColumn ctermbg=black
" highlighting
" show trailing spaces as errors
:autocmd Syntax * syn match Error /\s\+$\| \+\ze\t/ containedin=ALL display
" show tabs as errors
:autocmd Syntax * syn match Error /\t/ containedin=ALL display
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1
"Undo tree
set undofile " Save undo's after file closes
set undodir=$HOME/.vim/undo " where to save undo histories
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
VIMRC
#vim pathogen https://github.com/tpope/vim-pathogen
if [ ! -d ${HOME}/.vim/autoload ];then
mkdir -p ${HOME}/.vim/autoload ${HOME}/.vim/bundle
cd ${HOME}/.vim/autoload/
wget --no-check-certificate https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
fi
#vim powerline
if [ ! -d ${HOME}/.vim/bundle/vim-powerline ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/Lokaltog/vim-powerline
fi
#NERDTree
if [ ! -d ${HOME}/.vim/bundle/nerdtree ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
fi
#Vim Json syntax
if [ ! -d ${HOME}/.vim/bundle/vim-json ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/elzr/vim-json.git
fi
#vim indent guides
if [ ! -d ${HOME}/.vim/bundle/vim-indent-guides ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/nathanaelkane/vim-indent-guides.git
fi
#Vim-puppet
if [ ! -d ${HOME}/.vim/bundle/vim-puppet ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/rodjek/vim-puppet.git
fi
#Vim-fugitive
if [ ! -d ${HOME}/.vim/bundle/vim-fugitive ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git
fi
#Vim Syntastic
if [ ! -d ${HOME}/.vim/bundle/syntastic ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
fi
#Vim Asible
if [ ! -d ${HOME}/.vim/bundle/vim-ansible-yaml ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/chase/vim-ansible-yaml.git
fi
# Gundo
if [ ! -d ${HOME}/.vim/bundle/gundo ];then
cd ${HOME}/.vim/bundle
git clone https://github.com/sjl/gundo.vim.git
fi
# Persistent undo
if [ ! -d ${HOME}/.vim/undo ]; then
mkdir -p $HOME/.vim/undo
fi
chown -R `whoami`:`id -gn` ${HOME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment