commit 702a59819e8716e4fd56d5fe1379ceca1191ea4a (patch) parent 41e6e31a7aa0026f7aa0d98d2ce5a1203b151795 Author: Alexander Karle <akarle@umass.edu> Date: Mon, 9 Apr 2018 23:02:31 -0400 install.sh gets functional! Diffstat:
M | install.sh | | | 54 | +++++++++++++++++++++++++++++++----------------------- |
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/install.sh b/install.sh @@ -1,32 +1,40 @@ -# After cloning dotfiles into ~/git/dotfiles -# this file sets up vimrc and tmux.conf +#!/bin/bash +# This script sets up the dotfiles -# Set up vimrc -VIMHOME=~/.vim -GITVIM=~/git/dotfiles/vim -if [ ! -d $VIMHOME ]; then - echo "Making ~/.vim" - mkdir $VIMHOME -fi +# Helper functions +try_mkdir() { + if [ ! -d $1 ]; then + echo "Making directory $1" + mkdir $1 + fi +} -ln -s $GITVIM/vimrc ~/.vimrc -ln -s $GITVIM/theme.vim $VIMHOME/theme.vim -ln -s $GITVIM/plugins.vim $VIMHOME/plugins.vim -ln -s $GITVIM/pluginsettings.vim $VIMHOME/pluginsettings.vim -ln -s $GITVIM/keys.vim $VIMHOME/keys.vim -ln -s $GITVIM/functions.vim $VIMHOME/functions.vim +try_ln() { + if [ ! -f $1 ]; then + echo "Creating soft symlink from $2 to $1" + ln -s $2 $1 + fi +} -# filetype plugins +# Set up vimrc +VIMHOME=$HOME/.vim +GITVIM=$HOME/git/dotfiles/vim FTPLUGDIR=$VIMHOME/ftplugin -if [ ! -d $FTPLUGDIR ]; then - mkdir $FTPLUGDIR -fi -ln -s $GITVIM/ftplugin/tex.vim $FTPLUGDIR/tex.vim -ln -s $GITVIM/ftplugin/python.vim $FTPLUGDIR/python.vim +try_mkdir $VIMHOME +try_mkdir $FTPLUGDIR + +try_ln $GITVIM/vimrc $HOME/.vimrc +try_ln $GITVIM/theme.vim $VIMHOME/theme.vim +try_ln $GITVIM/plugins.vim $VIMHOME/plugins.vim +try_ln $GITVIM/pluginsettings.vim $VIMHOME/pluginsettings.vim +try_ln $GITVIM/keys.vim $VIMHOME/keys.vim +try_ln $GITVIM/functions.vim $VIMHOME/functions.vim +try_ln $GITVIM/ftplugin/tex.vim $FTPLUGDIR/tex.vim +try_ln $GITVIM/ftplugin/python.vim $FTPLUGDIR/python.vim # Link tmux conf -ln -s ~/git/dotfiles/tmux.conf ~/.tmux.conf +try_ln $HOME/git/dotfiles/tmux.conf $HOME/.tmux.conf # Link zshrc -ln -s ~/git/dotfiles/zshrc ~/.zshrc +try_ln $HOME/git/dotfiles/zshrc $HOME/.zshrc