Instantly share code, notes, and snippets.

What would you like to do?
A script I use for local provisioning of my bash profile in vagrant, does a bunch of stuff for the prompt and for vim
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}/ ]; then
source ${HOME}/
# 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}/ ];then
source ${HOME}/
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 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
#git autocomplete and prompt scripts
if [ ! -f ${HOME}/ ]; then
wget -O ${HOME}/
if [ ! -f ${HOME}/ ]; then
wget -O ${HOME}/
#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
autocmd FileType python setlocal shiftwidth=2 tabstop=2
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
autocmd FileType python setlocal shiftwidth=2 tabstop=2
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>
nnoremap <F8> :set nohlsearch!<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
"Save files when loosing focus (leave window)
:au FocusLost * silent! wa
"Unbind arrows
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
"No escape!
:imap jj <Esc>
" No esc delay
set timeoutlen=1000
set ttimeoutlen=0
#vim pathogen
if [ ! -d ${HOME}/.vim/autoload ];then
mkdir -p ${HOME}/.vim/autoload ${HOME}/.vim/bundle
cd ${HOME}/.vim/autoload/
wget --no-check-certificate
#vim powerline
if [ ! -d ${HOME}/.vim/bundle/vim-powerline ];then
cd ${HOME}/.vim/bundle
git clone
if [ ! -d ${HOME}/.vim/bundle/nerdtree ];then
cd ${HOME}/.vim/bundle
git clone
#Vim Json syntax
if [ ! -d ${HOME}/.vim/bundle/vim-json ];then
cd ${HOME}/.vim/bundle
git clone
#vim indent guides
if [ ! -d ${HOME}/.vim/bundle/vim-indent-guides ];then
cd ${HOME}/.vim/bundle
git clone
if [ ! -d ${HOME}/.vim/bundle/vim-fugitive ];then
cd ${HOME}/.vim/bundle
git clone
#Vim Syntastic
if [ ! -d ${HOME}/.vim/bundle/syntastic ];then
cd ${HOME}/.vim/bundle
git clone
#Vim Ansible
if [ ! -d ${HOME}/.vim/bundle/vim-ansible-yaml ];then
cd ${HOME}/.vim/bundle
git clone
# Gundo
if [ ! -d ${HOME}/.vim/bundle/gundo ];then
cd ${HOME}/.vim/bundle
git clone
# Persistent undo
if [ ! -d ${HOME}/.vim/undo ]; then
mkdir -p $HOME/.vim/undo
chown -R `whoami`:`id -gn` ${HOME}

This comment has been minimized.

Copy link

jaimegago commented May 29, 2014

For VIM powerline fancy icons to work a patched font need to be used by the application, I'm using this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment