Created
April 9, 2026 23:50
-
-
Save mmansoor/e20cdce40129932470f90fe81db36419 to your computer and use it in GitHub Desktop.
Install latest version of NeoVim on Raspberry PI
This file contains hidden or 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 | |
| set -e | |
| echo "=== Neovim Installer / Upgrader for Raspberry Pi ===" | |
| # Detect architecture | |
| ARCH=$(uname -m) | |
| echo "Detected architecture: $ARCH" | |
| INSTALL_DIR="/opt/nvim" | |
| BIN_LINK="/usr/local/bin/nvim" | |
| # Remove old install if exists | |
| if command -v nvim >/dev/null 2>&1; then | |
| echo "Existing Neovim found. Removing old version..." | |
| sudo rm -rf "$INSTALL_DIR" | |
| sudo rm -f "$BIN_LINK" | |
| fi | |
| # Create install directory | |
| sudo mkdir -p "$INSTALL_DIR" | |
| cd /tmp | |
| # Install dependencies | |
| echo "Installing dependencies..." | |
| sudo apt update | |
| sudo apt install -y curl git build-essential ninja-build gettext cmake unzip | |
| # Function to install from source (fallback) | |
| install_from_source() { | |
| echo "Building Neovim from source (this may take a while)..." | |
| git clone https://github.com/neovim/neovim.git | |
| cd neovim | |
| git checkout stable | |
| make CMAKE_BUILD_TYPE=Release | |
| sudo make install | |
| } | |
| # Install based on architecture | |
| if [[ "$ARCH" == "aarch64" ]]; then | |
| echo "Installing Neovim via AppImage (ARM64)..." | |
| curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-arm64.appimage | |
| chmod u+x nvim-linux-arm64.appimage | |
| ./nvim-linux-arm64.appimage --appimage-extract | |
| sudo mv squashfs-root/* "$INSTALL_DIR" | |
| sudo ln -sf "$INSTALL_DIR/AppRun" "$BIN_LINK" | |
| elif [[ "$ARCH" == "armv7l" ]]; then | |
| echo "ARMv7 detected → building from source..." | |
| install_from_source | |
| else | |
| echo "Unknown architecture → attempting source build..." | |
| install_from_source | |
| fi | |
| # Verify installation | |
| echo "Verifying Neovim installation..." | |
| nvim --version | head -n 1 | |
| echo "=== Neovim installation/upgrade complete ===" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment