source rc files at the end of install

This commit is contained in:
Haak Saxberg 2014-05-30 08:49:59 +00:00
parent edd15f452a
commit aefbc265f0

View file

@ -6,13 +6,19 @@ main() {
# sore the calling directory to return later # sore the calling directory to return later
CALLING_DIR=$PWD CALLING_DIR=$PWD
cd $DIR cd $DIR
if [[ $1 == "--ycm" ]]; then if [[ $1 == "--ycm" ]]; then
rm .youcompletemesetup local vim_version=`vim --version | head -1 | cut -d " " -f 5`
vim +BundleInstall +qall if [[ $(echo "$vim_version >= 7.4" | bc) = 1 ]]; then
setup_youcompleteme rm .youcompletemesetup
exit 0 vim +BundleInstall +qall
setup_youcompleteme
else
echo "YCM requires vim 7.4 and up; you have ${vim_version}."
fi
else else
install_everything install_everything
fi fi
cd $CALLING_DIR cd $CALLING_DIR
} }
@ -44,6 +50,9 @@ install_everything() {
create_local_bin create_local_bin
setup_local_symlinks setup_local_symlinks
echo "sourcing rc files..."
source_rc_files
} }
setup_gitmodules() { setup_gitmodules() {
@ -53,8 +62,8 @@ setup_gitmodules() {
} }
symlink_files() { symlink_files() {
source_dir=$1 local source_dir=$1
filenames=${@:2} local filenames=${@:2}
for filename in $filenames for filename in $filenames
do do
@ -90,7 +99,7 @@ setup_local_symlinks() {
} }
setup_vim_symlink() { setup_vim_symlink() {
vim_version=`vim --version | head -1 | cut -d " " -f 5` local vim_version=`vim --version | head -1 | cut -d " " -f 5`
if [[ $(echo "$vim_version >= 7.4" | bc) = 1 ]]; then if [[ $(echo "$vim_version >= 7.4" | bc) = 1 ]]; then
ln -s `which vim` ~/local/bin/vim ln -s `which vim` ~/local/bin/vim
else else
@ -103,4 +112,13 @@ setup_vim_symlink() {
fi fi
} }
source_rc_files() {
local current_shell=$(ps -p $$ | grep `echo $$` | awk '{print $4}')
if [[ "$current_shell" == "zsh" ]]; then
source ~/.zshrc
elif [[ "$current_shell" == "bash" ]]; then
source ~/.bashrc
fi
}
main $@ main $@