Set up vim

This commit is contained in:
flyingscorpio@arch-desktop 2020-04-08 16:31:12 +02:00
parent 5a3ec6aeec
commit 594d26b80a
2 changed files with 27 additions and 40 deletions

View file

@ -1,5 +1,11 @@
#!/bin/bash
if [ -z "$BASE_DIR" ]; then
echo "BASE_DIR wasn't set."
exit 1
fi
echo "$BASE_DIR"
# HANDLE ARGS {{{
overwrite='false'
@ -18,7 +24,7 @@ if [ "$1" = '-ou' ] || [ "$1" = '-uo' ]; then
update_plugins='true'
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
#}}}
@ -28,8 +34,8 @@ echo "Updating .vimrc..."
echo
if [ ! -L ~/.vimrc ]; then
if [ $overwrite = 'true' ]; then
rm ~/.vimrc
ln -rs ~/SetupCockpit/dotfiles/vimrc ~/.vimrc
rm ~/.vimrc 2> /dev/null
ln -rs "$BASE_DIR"/dotfiles/vimrc ~/.vimrc
echo "${ORANGE}.vimrc symlink created.${NC}"
else
echo "No .vimrc symlink found but the overwrite option was not set."
@ -40,7 +46,7 @@ else
echo "Nothing changed.${NC}"
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -50,12 +56,12 @@ echo "Updating colors..."
echo
mkdir -p ~/.vim/colors
color_files=$(ls ~/SetupCockpit/dotfiles/vim_colors)
color_files=$(ls "$BASE_DIR"/dotfiles/vim_colors)
for color_file in $color_files; do
ln -rs ~/SetupCockpit/dotfiles/vim_colors/"$color_file" ~/.vim/colors/ 2> /dev/null
ln -rs "$BASE_DIR"/dotfiles/vim_colors/"$color_file" ~/.vim/colors/ 2> /dev/null
done
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -81,7 +87,7 @@ else
fi
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -105,7 +111,7 @@ if [ $update_plugins = 'true' ]; then
fi
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -123,7 +129,7 @@ if [ -e ~/.vim/bundle/python-mode ]; then
fi
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -148,7 +154,7 @@ elif [ "$OS" = 'arch' ]; then
echo "${GREEN}Successfully downloaded and extracted shellcheck.${NC}"
echo "Copying executable to /usr/bin/ ..."
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/ && shellcheck --version
if rm -r ~/Downloads/shellcheck-stable; then
if rm -r ~/Downloads/shellcheck-${scversion}; then
echo "${GREEN}Removed shellcheck installation folder${NC}"
else
echo "${RED}Was unable to remove shellcheck installation folder${NC}"
@ -163,7 +169,7 @@ else
exit 1
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -193,7 +199,7 @@ else
echo "YouCompleteMe is already installed, skipping..."
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
@ -201,30 +207,11 @@ fi
echo "Updating YouCompleteMe extra_conf files..."
echo
if [ $overwrite = 'true' ]; then
copy_command=$(cp -uv "$base_dir/ycm_extra_conf.py" ~/.ycm_extra_conf.py)
else
copy_command=$(cp -ui "$base_dir/ycm_extra_conf.py" ~/.ycm_extra_conf.py)
fi
if $copy_command; then
echo "${GREEN}Successfully updated .ycm_extra_conf.py${NC}"
else
echo "${RED}There was a problem while updating .ycm_extra_conf.py${NC}"
exit 1
fi
if [ $overwrite = 'true' ]; then
copy_command=$(cp -uv "$base_dir/global_extra_conf.py" ~/.global_extra_conf.py)
else
copy_command=$(cp -ui "$base_dir/global_extra_conf.py" ~/.global_extra_conf.py)
fi
if $copy_command; then
echo "${GREEN}Successfully updated .global_extra_conf.py${NC}"
else
echo "${RED}There was a problem while updating .global_extra_conf.py${NC}"
exit 1
fi
/bin/bash ~/SetupCockpit/installation_scripts/additional/separator.sh
ln -rs "$BASE_DIR"/dotfiles/ycm_extra_conf.py ~/.ycm_extra_conf.py 2> /dev/null
ln -rs "$BASE_DIR"/dotfiles/global_extra_conf.py ~/.global_extra_conf.py 2> /dev/null
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}

View file

@ -17,9 +17,6 @@ BASE_DIR="$PWD"
echo "$BASE_DIR"
export BASE_DIR
exit
# Define OS {{{
OS='none'
@ -54,10 +51,13 @@ case ${os_release,,} in
esac
export OS
/bin/bash ~/SetupCockpit/separator.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}}
/bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh --overwrite
exit
# Install scripts {{{
echo "Installing scripts..."