Created
May 10, 2018 07:58
-
-
Save russellvt/083d7146c252bdacb54e388756ff5818 to your computer and use it in GitHub Desktop.
Help manage vim plugins from git repositories, including pathogen, syntastic and pylint (among others)
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # Install and maintain vim plugins | |
| # | |
| # Russell M. Van Tassell | |
| # russell@geekoncall.net | |
| # | |
| # Path to Git | |
| GIT=/usr/bin/git | |
| # Generic location of Vim Configuration Directory per-user | |
| VIM_DIR="${HOME}/.vim" | |
| # List repositories of desired plugins, here... | |
| read -r -d '' PLUGINS <<-'EOF' | |
| https://github.com/vim-syntastic/syntastic.git | |
| https://github.com/vim-airline/vim-airline.git | |
| https://github.com/tpope/vim-surround.git | |
| EOF | |
| # | |
| # You should not need to edit anything past this line... | |
| #----------------------------------------------------------------------- | |
| # Identify proper package manager by system type... | |
| PKG_MGR="" | |
| # OpenSUSE | |
| if [ -x /usr/bin/zypper ]; then | |
| PKG_MGR=/usr/bin/zypper | |
| fi | |
| # Debian/Ubuntu/Mint | |
| if [ -x /usr/bin/lsb_release ]; then | |
| PKG_MGR=/usr/bin/apt-get | |
| fi | |
| # RHEL/CentOS | |
| if [ -f /etc/redhat-release ]; then | |
| PKG_MGR=/usr/bin/yum | |
| fi | |
| #----------------------------------------------------------------------- | |
| # Install Pylint | |
| if [ ! -z "$PKG_MGR" ]; then | |
| # Install Pylint | |
| sudo $PKG_MGR install pylint | |
| echo "" | |
| else | |
| echo "ERROR: Unknown O/S or Package Manager" | |
| exit 1 | |
| fi | |
| # | |
| # General Home Dir Setup | |
| mkdir -p ${VIM_DIR}/autoload ${VIM_DIR}/bundle | |
| # Install Pathogen in the Autoloader | |
| cd ${VIM_DIR}/autoload | |
| if [ ! -f ./vim-pathogen.git/.git/config ]; then | |
| echo "Cloning VIM Pathogen in to Autoload Directory" | |
| $GIT clone https://github.com/tpope/vim-pathogen.git vim-pathogen.git | |
| else | |
| echo "Updating VIM Pathogen in Autoload Directory" | |
| cd vim-pathogen.git | |
| $GIT pull | |
| cd .. | |
| fi | |
| cd ${VIM_DIR}/autoload | |
| if [ ! -L "pathogen.vim" ]; then | |
| echo " - Adding symlink for VIM Pathogen in Autoload Directory" | |
| ln -s vim-pathogen.git/autoload/pathogen.vim . | |
| echo " - NOTE: You should make sure pathogen is configured in your vimrc" | |
| echo " - REF: https://github.com/tpope/vim-pathogen" | |
| fi | |
| echo "" | |
| # Install VIM Plugins, used by Pathogen | |
| cd ${VIM_DIR}/bundle | |
| # Clone or Update Plugins | |
| for plugin in $PLUGINS; do | |
| plugin_dir=$(/usr/bin/basename $plugin .git) | |
| if [ -d "$plugin_dir" ]; then | |
| echo "Updating Plugin: $plugin_dir" | |
| echo " - $plugin_dir: $plugin" | |
| cd $plugin_dir | |
| $GIT pull | |
| cd .. | |
| else | |
| echo "Cloning Plugin: $plugin_dir" | |
| $GIT clone $plugin | |
| fi | |
| echo "" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment