Try to configure neovim right

This commit is contained in:
Thomas Forgione 2019-04-26 15:52:31 +02:00
parent 5ecb9d9cb0
commit ba064727a8
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 41 additions and 1 deletions

View File

@ -69,6 +69,38 @@ install() {
error "distribution not recognized, can't install $1." error "distribution not recognized, can't install $1."
} }
install_python3() {
test_command apt
if [ $? -eq 0 ]; then
sudo apt install python3 python3-pip
return
fi
test_command pacman
if [ $? -eq 0 ]; then
sudo pacman -S python python-pip
return
fi
error "distribution not recognized, can't install python3."
}
install_python_neovim() {
test_command pip3
if [ $? -eq 0 ]; then
sudo pip3 install neovim
return
fi
test_command pip
if [ $? -eq 0 ]; then
sudo pip install neovim
return
fi
error "couldn't find pip, can't install python-neovim."
}
install_neovim() { install_neovim() {
test_command apt test_command apt
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@ -216,13 +248,21 @@ configure_neovim() {
install_neovim install_neovim
fi fi
# Try and install python3 and python-neovim
test_command python3
if [ $? -ne 0 ]; then
install_python3
fi
install_python_neovim
# Create config files an directories # Create config files an directories
mkdir -p $HOME/.config/nvim $HOME/.nvim/backups $HOME/.nvim/swp $HOME/.nvim/undo mkdir -p $HOME/.config/nvim $HOME/.nvim/backups $HOME/.nvim/swp $HOME/.nvim/undo
rm -f $HOME/.config/nvim/init.vim rm -f $HOME/.config/nvim/init.vim
ln -s $HOME/.config/dotfiles/init.vim $HOME/.config/nvim/init.vim ln -s $HOME/.config/dotfiles/init.vim $HOME/.config/nvim/init.vim
# Install vim plug # Install vim plug
curl -fLo ~/.nvim/autoload/plug.vim --create-dirs \ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Install plugins # Install plugins