Last active
September 11, 2023 07:00
-
-
Save lpimem/a83aa0b736d95a53beb049cc07511705 to your computer and use it in GitHub Desktop.
Install neovim for linux/macos and set up for Python according to https://medium.com/@hanspinckaers/setting-up-vim-as-an-ide-for-python-773722142d1d
This file contains 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
#!/usr/bin/env bash | |
# Installation directory | |
DIR=$HOME/app | |
NVIM_URL_LINUX="https://github.com/neovim/neovim/releases/download/stable/nvim.appimage" | |
NVIM_URL_MACOS="https://github.com/neovim/neovim/releases/download/stable/nvim-macos.tar.gz" | |
mkdir -p ${DIR} | |
cd ${DIR} | |
# Install Neovim | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
mkdir nvim | |
cd nvim | |
curl -L $NVIM_URL_LINUX --output nvim.appimage | |
chmod +x nvim.appimage | |
./nvim.appimage +qall | |
ret=$? | |
if [ $ret -ne 0 ]; then | |
echo "Cannot run nvim as appimage" | |
# TODO: try to extract appimage and run | |
exit 1 | |
else | |
# Update .bashrc | |
echo "alias vim=${DIR}/nvim/nvim.appimage" >> $HOME/.bashrc | |
echo "alias nvim=${DIR}/nvim/nvim.appimage" >> $HOME/.bashrc | |
alias vim=${DIR}/nvim/nvim.appimage | |
fi | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
curl -L $NVIM_URL_MACOS --output nvim.tar.gz | |
tar xf nvim.tar.gz | |
mv nvim-osx64 nvim | |
cd nvim | |
chmod +x bin/nvim | |
./bin/nvim +qall | |
ret=$? | |
if [ $ret -ne 0 ]; then | |
echo "Cannot run nvim" | |
exit 1 | |
fi | |
echo "export PATH=${DIR}/nvim/bin:"'$PATH' >> $HOME/.bash_profile | |
echo "alias vim=nvim" >> $HOME/.bash_profile | |
export PATH=${DIR}/nvim/bin:$PATH | |
alias vim=nvim | |
else | |
echo "OS $OSTYPE not supported" | |
exit 1 | |
fi | |
# Init neovim config | |
mkdir -p $HOME/.config/nvim | |
git clone https://gist.github.com/a5d4bf1bc5e85d668852d713f1b3eb8e.git nvimrc | |
cat nvimrc/.vimrc > $HOME/.config/nvim/init.vim | |
# Install python neovim package | |
pip install neovim | |
ret=$? | |
if [ $ret -ne 0 ]; then | |
echo "Cannot install python neovim package" | |
exit 1 | |
fi | |
# Install vim-plug | |
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ | |
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
# Install vim plug-ins | |
vim +PlugInstall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment