Update vim setup script to use Pathogen, code-completion with clang_complete, and install of supertab vim plugin.
This commit is contained in:
parent
9e231bcdee
commit
4cb5cad229
|
@ -1,3 +1,5 @@
|
||||||
|
" Single-quote is a comment written to be read
|
||||||
|
" Double-quotes ("") are commented out code and can be removed or added
|
||||||
|
|
||||||
" Set tabwidth=2, adjust Vim shiftwidth to the same
|
" Set tabwidth=2, adjust Vim shiftwidth to the same
|
||||||
set tabstop=2 shiftwidth=2
|
set tabstop=2 shiftwidth=2
|
||||||
|
@ -18,9 +20,3 @@ syntax on
|
||||||
execute pathogen#infect()
|
execute pathogen#infect()
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
" Enable clang_complete plugin for vim
|
|
||||||
" https://github.com/xavierd/clang_complete
|
|
||||||
" Requires clang to be installed
|
|
||||||
" Path to library may change
|
|
||||||
let g:clang_library_path='/usr/lib64/libclang.so.8'
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
Packages Installed / Updated:
|
||||||
|
- vim, git, clang
|
||||||
|
|
||||||
|
Vimrc Settings:
|
||||||
|
- tabwidth is 2, and set to insert SPACE characters instead of TAB symbols with expandtab
|
||||||
|
- shiftwidth is 2 so we can compensate for the conflict with default tab settings
|
||||||
|
- autoindent is on, when moving to a newline vim will indent to the current depth
|
||||||
|
- syntax highlighting is on
|
||||||
|
- mouse interaction is enabled when supported by connecting systems
|
||||||
|
-- https://github.com/shaunrd0/klips/tree/master/configs
|
||||||
|
|
||||||
|
Plugin Settings:
|
||||||
|
- Pathogen vim plugin manager has been installed and .vimrc configured for its use.
|
||||||
|
-- Install new vim plugins by cloning their repositories into ~/.vim/bundle/
|
||||||
|
-- https://github.com/tpope/vim-pathogen
|
||||||
|
|
||||||
|
- Clang_complete vim plugin has been installed and .vimrc configured for its use.
|
||||||
|
- Code-completion is enabled with default clang_complete settings
|
||||||
|
-- https://github.com/xavierd/clang_complete
|
||||||
|
|
||||||
|
- Supertab vim plugin has been installed and .vimrc configured for its use.
|
||||||
|
- Allows the use of TAB to enable code-completion context menu
|
||||||
|
-- https://github.com/ervandew/supertab
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
|
||||||
## A custom bash script for building cmake projects. ##
|
|
||||||
## Intended to be ran in root directory of the project alongside CMakeLists ##
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
printf "\nEnter 1 to configure, 2 to revert configuration."
|
|
||||||
printf "\nAny other value will exit."
|
|
||||||
printf "\nConfiguring Vim will overwrite your current ~/.vimrc!\n"
|
|
||||||
|
|
||||||
read cChoice
|
|
||||||
|
|
||||||
if [ $cChoice -eq 1 ] ; then
|
|
||||||
|
|
||||||
# Clone klips repository -
|
|
||||||
git clone https://github.com/shaunrd0/klips temp/
|
|
||||||
|
|
||||||
# Clean up files we don't need from the repo
|
|
||||||
mkdir config-vim
|
|
||||||
mv temp/README.md config-vim/ && mv temp/configs/ config-vim/
|
|
||||||
rm -R temp/
|
|
||||||
|
|
||||||
# Replace our .vimrc in the home directory
|
|
||||||
mkdir config-vim/backup/
|
|
||||||
mv -f ~/.vimrc config-vim/backup/.vimrc.bak
|
|
||||||
cp config-vim/configs/.vimrc ~/
|
|
||||||
|
|
||||||
# Reinstall Pathogen plugin manager for vim
|
|
||||||
# https://github.com/tpope/vim-pathogen
|
|
||||||
|
|
||||||
# Remove Pathogen
|
|
||||||
rm ~/.vim/autoload/pathogen.vim
|
|
||||||
|
|
||||||
# Install Pathogen
|
|
||||||
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
|
|
||||||
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
|
||||||
|
|
||||||
# Remove all plugins / repositories added by config tool
|
|
||||||
rm -R ~/.vim/bundles/supertab/
|
|
||||||
|
|
||||||
# clone all repos into pathogen plugin directory
|
|
||||||
(cd ~/.vim/bundles/ && \
|
|
||||||
git clone https://github.com/ervandew/supertab)
|
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
printf "\nExiting..\n"
|
|
||||||
fi
|
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
#!/bin/bash
|
||||||
|
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
||||||
|
## A custom bash script to configure vim with my preferred settings ##
|
||||||
|
## Run as user with sudo within directory to store / stash .vimrc configs ##
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# For easy colorization of printf
|
||||||
|
GREEN=$(tput setaf 2)
|
||||||
|
RED=$(tput setaf 1)
|
||||||
|
UNDERLINE=$(tput smul)
|
||||||
|
NORMAL=$(tput sgr0)
|
||||||
|
|
||||||
|
printf "\nEnter 1 to configure vim with the Klips repository, any other value to exit."
|
||||||
|
printf "\nThe up-to-date .vimrc config can be found here: https://github.com/shaunrd0/klips/tree/master/configs"
|
||||||
|
printf "\n${RED}Configuring Vim with this tool will update / upgrade your packages${NORMAL}\n\n"
|
||||||
|
read cChoice
|
||||||
|
|
||||||
|
if [ $cChoice -eq 1 ] ; then
|
||||||
|
|
||||||
|
printf "\nUpdating, upgrading required packages...\n"
|
||||||
|
sudo apt -y update && sudo apt -y upgrade
|
||||||
|
sudo apt install vim git
|
||||||
|
|
||||||
|
# Clone klips repository in a temp directory
|
||||||
|
git clone https://github.com/shaunrd0/klips temp/
|
||||||
|
# Relocate the files we need and remove the temp directory
|
||||||
|
mkdir -pv config-vim
|
||||||
|
mv -fuv temp/README.md config-vim/ && mv temp/configs/ config-vim/
|
||||||
|
rm -Rf temp/
|
||||||
|
printf "\n${GREEN}Klips config files updated"\
|
||||||
|
"\nSee $PWD/config-vim/README.md for more information.${NORMAL}\n\n"
|
||||||
|
|
||||||
|
# Create backup dir for .vimrc
|
||||||
|
mkdir -pv config-vim/backup/
|
||||||
|
printf "\n${GREEN}Backup directory created - $PWD/config-vim/backup/${NORMAL}\n"
|
||||||
|
|
||||||
|
# Stash the current .vimrc
|
||||||
|
mv -bv ~/.vimrc config-vim/backup/
|
||||||
|
printf "${RED}Your local .vimrc has been stashed in $PWD/config-vim/backup/${NORMAL}\n\n"
|
||||||
|
|
||||||
|
# Copy our cloned config into the user home directory
|
||||||
|
cp config-vim/configs/.vimrc ~/
|
||||||
|
printf "${GREEN}New ~/.vimrc configuration installed.${NORMAL}\n"
|
||||||
|
|
||||||
|
# Reinstall Pathogen plugin manager for vim
|
||||||
|
# https://github.com/tpope/vim-pathogen
|
||||||
|
printf "\n${RED}Removing any previous installations of Pathogen...${NORMAL}\n"
|
||||||
|
sudo rm -f ~/.vim/autoload/pathogen.vim
|
||||||
|
|
||||||
|
# Install Pathogen
|
||||||
|
printf "\n${GREEN}Installing Pathogen plugin manager for Vim....\n"\
|
||||||
|
"\nIf they don't exist, we will create the following directories:\n"\
|
||||||
|
"~/.vim/autoload/ ~/.vim/bundle/${NORMAL}"
|
||||||
|
# Sudo is required for curl below
|
||||||
|
mkdir -pv ~/.vim/autoload ~/.vim/bundle && \
|
||||||
|
sudo curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
||||||
|
printf "\n${GREEN}Pathogen has been installed! Plugins plugins can now be easily installed.\n"\
|
||||||
|
"Clone any plugin repositories into ~/.vim/bundles${NORMAL}\n"
|
||||||
|
|
||||||
|
# Remove any plugins managed by this config tool (Klips)
|
||||||
|
printf "\n${RED}Removing plugins installed by this tool...${NORMAL}\n"
|
||||||
|
sudo rm -R ~/.vim/bundle/*
|
||||||
|
|
||||||
|
# Clone plugin repos into pathogen plugin directory
|
||||||
|
printf "\n${GREEN}Installing updated plugins...${NORMAL}\n"
|
||||||
|
(cd ~/.vim/bundle/ && \
|
||||||
|
sudo git clone https://github.com/ervandew/supertab && \
|
||||||
|
printf "\n${GREEN}Supertab plugin has been installed${NORMAL}\n\n" && \
|
||||||
|
sudo git clone https://github.com/xavierd/clang_complete && \
|
||||||
|
printf "\n${GREEN}Clang Completion plugin has been installed${NORMAL}\n\n")
|
||||||
|
|
||||||
|
printf "\n${UNDERLINE}Vim has been configured with the Klips repository.${NORMAL}"
|
||||||
|
printf "\n\nConfiguration Changes: \n"
|
||||||
|
cat config-vim/configs/.vimrc-README
|
||||||
|
|
||||||
|
else
|
||||||
|
printf "\nExiting..\n"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue