1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Modernise and improve vim-setup script

This commit is contained in:
Joe Groocock 2017-12-18 16:53:43 +00:00
parent bd549b6424
commit 3351a95a0a
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
2 changed files with 19 additions and 7 deletions

View File

@ -9,7 +9,8 @@ export PATH="${PATH}:$DOTFILES/scripts"
export XDG_CURRENT_DESKTOP="GNOME" # Fixes xdg-open
# Allow Vim to load from ~/.config/vim
export MYVIMRC="$CONFIG_DIR/vim/vimrc"
export VIMDIR="$CONFIG_DIR/vim"
export MYVIMRC="$VIMDIR/vimrc"
export VIMINIT=":so $MYVIMRC"
export EDITOR="vim"

View File

@ -1,18 +1,29 @@
YCM=~/.vim/bundle/YouCompleteMe
#!/bin/sh
set -e
sudo pacman -Sy python cmake clang --needed --noconfirm
############################
## Check for dependencies ##
############################
error() { >&2 printf "Error: %s" "$1"; exit 1; }
which cmake >/dev/null 2>&1 || error 'cmake is not installed'
which clang >/dev/null 2>&1 || error 'clang is not installed'
which python >/dev/null 2>&1 || error 'python is not installed'
[ -z "$VIMDIR" ] && error '$VIMDIR is not set'
#######################
## Initialise Vundle ##
#######################
mkdir -p ~/.vim/{bundle,swapfiles}
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
mkdir -p "$VIMDIR/bundle" "$VIMDIR/swapfiles"
if [ ! -d "$VIMDIR/bundle/Vundle.vim" ]; then
git clone https://github.com/VundleVim/Vundle.vim.git "$VIMDIR/bundle/Vundle.vim"
fi
vim +PluginUpdate +qall
#########################
## Setup YouCompleteMe ##
#########################
cd "$YCM"
cd "$VIMDIR/bundle/YouCompleteMe"
git submodule update --init --recursive
./install.py --system-libclang --clang-completer