Skip to content

Instantly share code, notes, and snippets.

@yrgoldteeth
Created August 7, 2013 18:43
Show Gist options
  • Save yrgoldteeth/6177139 to your computer and use it in GitHub Desktop.
Save yrgoldteeth/6177139 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This is my setup for Vim. This will install the janus set of plugins
# as well as create my specific vim customizations
# Ensure required packages are installed.
REQUIRED_PACKAGES="bash vim git curl"
for package in $REQUIRED_PACKAGES
do
command -v $package >/dev/null && continue || { echo "Package: $package is required, please install it"; exit 1; }
done
# Cat the text of my .vimrc.after file
function vimrcafter()
{
cat<<EOF
" control-j to tab next, control-k to tab previous
map <C-J> :tabn<CR>
map <C-K> :tabp<CR>
" make j/k work on wrapped lines.
nnoremap j gj
nnoremap k gk
" KILL ALL TRAILING WHITESPACE WITH FIRE
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
EOF
}
# Cat the text of my .gvimrc.after file
function gvimrcafter()
{
cat<<EOF
set guioptions-=T
set guioptions-=m
set guioptions-=r
set guioptions-=e
set guifont=Inconsolata:h14
set vb
colorscheme Mustang
EOF
}
# Download Janus Installer
# Pipe Janus Installer To Pager?
# Confirm Install or Exit
# Cleanup Installer
# Download and install Janus in the horrible insecure way.
# Seriously, I do not love the idea of piping the output
# of a bitly link directly into bash.
# TODO: make this not awful
if [ ! -d $HOME/.vim/janus ]
then
echo "Installing Janus"
curl -Lo- https://bit.ly/janus-bootstrap | bash
fi
# Create .vimrc.after
if [ ! -f $HOME/.vimrc.after ]
then
echo "Creating $HOME/.vimrc.after"
vimrcafter > $HOME/.vimrc.after
fi
# Create .vimrc.before
if [ ! -f $HOME/.vimrc.before ]
then
echo "Creating $HOME/.vimrc.before"
echo "call janus#disable_plugin('nerdtree')" > $HOME/.vimrc.before
fi
# Create .gvimrc.after
if [ ! -f $HOME/.gvimrc.after ]
then
echo "Creating $HOME/.gvimrc.after"
gvimrcafter > $HOME/.gvimrc.after
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment