Created
August 19, 2016 00:00
-
-
Save yrgoldteeth/46914bf93d2f989d9ad5eab9593a362b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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.before file | |
function vimrcbefore() | |
{ | |
cat<<EOF | |
call janus#disable_plugin('nerdtree') | |
call janus#disable_plugin('nerdcommentor') | |
call janus#disable_plugin('ack') | |
call janus#disable_plugin('unimpaired') | |
call janus#disable_plugin('snipmate') | |
EOF | |
} | |
# 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> | |
" open control p files in new tab auto | |
let g:ctrlp_prompt_mappings = { | |
\ 'AcceptSelection("e")': [], | |
\ 'AcceptSelection("t")': ['<cr>', '<c-m>'], | |
\ } | |
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=Source\ Code\ Pro\ Medium:h16 | |
set antialias | |
set vb | |
colorscheme Mustang | |
EOF | |
} | |
# curl down the janus bash install file and send it to the pager. | |
# run bash on install file if confirmed, rm install file | |
function handle_install() | |
{ | |
JANUS_FILE=$HOME/janus_install | |
curl -Lo- https://bit.ly/janus-bootstrap > $JANUS_FILE || { echo "Failed to curl file"; exit 1; } | |
$PAGER $JANUS_FILE || { echo "Pager quit with error code"; exit 1; } | |
echo "Do you wish to install this program?" | |
select yn in "Yes" "No"; do | |
case $yn in | |
Yes ) bash $JANUS_FILE; rm $JANUS_FILE; break;; | |
No ) rm $JANUS_FILE; break;; | |
esac | |
done | |
} | |
# Download and install Janus | |
if [ ! -d $HOME/.vim/janus ] | |
then | |
echo "Installing Janus" | |
handle_install | |
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" | |
vimrcbefore > $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