-
-
Save darcyparker/153124662b05c679c417 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
#Build and install neovim for Debian | |
#See: https://neovim.io/ | |
#See: https://github.com/neovim/neovim/wiki/Building-Neovim#quick-start | |
#See: https://gist.github.com/darcyparker/153124662b05c679c417 | |
#Save current dir | |
pushd . >/dev/null || exit | |
#Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y \ | |
autoconf \ | |
automake \ | |
cmake \ | |
g++ \ | |
gettext \ | |
libncurses5-dev \ | |
libtool \ | |
libtool-bin \ | |
libunibilium-dev \ | |
libunibilium4 \ | |
lua5.1 \ | |
lua5.4 \ | |
luarocks \ | |
liblua5.1-0-dev \ | |
ninja-build \ | |
pkg-config \ | |
python3-pip \ | |
software-properties-common \ | |
unzip | |
# Enable use of python plugins | |
# Note: python neovim module was renamed to pynvim | |
VENV_DIR="$HOME/.config/nvim/pynvim-venv" | |
if [ ! -d "$VENV_DIR" ]; then | |
python3 -m venv "$VENV_DIR" &>/dev/null | |
fi | |
# "$VENV_DIR/bin/pip" install --upgrade setuptools | |
"$VENV_DIR/bin/pip" install --upgrade pynvim | |
# In nvim/lua configs: | |
# -- Define the path to your Neovim virtual environment's bin directory | |
# local venv_bin_path = vim.fn.expand("~/.config/nvim/pynvim-venv/bin") | |
# | |
# -- Prepend the venv bin directory to Neovim's PATH environment variable. | |
# -- This allows Neovim and its plugins to find executables like 'ueberzugpp'. | |
# vim.env.PATH = venv_bin_path .. ":" .. vim.env.PATH | |
# | |
# vim.g.python3_host_prog = venv_bin_path .. "/python" | |
unset VENV_DIR | |
gem install neovim | |
npm install -g neovim | |
#Get or update neovim github repo | |
mkdir -p ~/src | |
cd ~/src || exit | |
if [ ! -e ~/src/neovim ]; then | |
git clone https://github.com/neovim/neovim | |
else | |
cd neovim || exit | |
git pull origin | |
fi | |
cd ~/src/neovim || exit | |
git checkout master | |
#Remove old build dir and .deps dir | |
rm -rf build/ | |
rm -rf .deps/ | |
make distclean | |
# Build and install neovim | |
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr/local/" | |
make install | |
# Enable use of ruby plugins | |
# sudo gem install neovim | |
#Restore dir | |
popd >/dev/null || exit | |
echo "nvim command: $(command -v nvim)" | |
echo "nvim command: $(ls -al "$(command -v nvim)")" |
@darcyparker Oh, got it. Thanks!!
In line 65 , it is better change
make install
to
sudo make install
@marcuslannister - I disagree... See comment https://gist.github.com/darcyparker/153124662b05c679c417?permalink_comment_id=3080477#gistcomment-3080477 above. If you want to live dangerously and do sudo make install
with MAKE_INSTALL_PREFIX=/usr/local/"
, go ahead... but I never sudo make install
to /usr/local
.
@marcuslannister - I disagree... See comment https://gist.github.com/darcyparker/153124662b05c679c417?permalink_comment_id=3080477#gistcomment-3080477 above. If you want to live dangerously and do
sudo make install
withMAKE_INSTALL_PREFIX=/usr/local/"
, go ahead... but I neversudo make install
to/usr/local
.
Ok, I got it. Thanks.
As of march 2023, neovim (0.9.0 pre-release) needs ibvterm-dev from experimental (0.3.1-1). Fortunately, this is available in experimental. Also, we use ninja as the build back end. So the above method of making Debian package is not current.
Of course, you can probably build it using upstream source combined with debian/* files in the latest Debian package. But I am making deb package using CMAKE (CPACK). under Debian testing (bookworm).
See https://osamuaoki.github.io/en/2023/03/05/vim-learn-7/#get-latest-neovim
Just a big thank you @osamuaoki !
@SaffronSlumber - I did not write a script to uninstall. And as you mentioned the
nvim
dev team did not write a makeuninstall
rule. This is just a script to help build neovim and run itsmake install
to install it to/usr/local
. If you want to remove it, observe the files instdout
that were copied to/user/local/nvim
duringmake install
. For example:There may be a few other files... Its the usual process for removing a program you'd build from source and install to
/usr/local
If you want a clean way to install/remove without building from source, you probably want to use a distribution like https://manjaro.org/