aboutsummaryrefslogtreecommitdiff
path: root/bootstrap-nvim-python.sh
blob: a8bea3eab696c4e3c11005f9c3a4a420dff8b8f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
set -eu

case "$(uname)" in
FreeBSD)
  echo "FreeBSD detected – using system Python + pkg pynvim"
  ;;
Darwin)
  VENV="$HOME/.local/venv/nvim"
  PYTHON="${PYTHON:-python3}"

  # Python vorhanden?
  if ! command -v "$PYTHON" >/dev/null 2>&1; then
    echo "ERROR: python3 not found"
    exit 1
  fi

  # venv anlegen (falls nicht vorhanden)
  if [ ! -x "$VENV/bin/python" ]; then
    echo "Creating Neovim Python venv at $VENV"
    "$PYTHON" -m venv "$VENV"
  fi

  # pip sicherstellen
  "$VENV/bin/python" -m ensurepip --upgrade >/dev/null 2>&1 || true

  # pynvim installieren / aktualisieren
  "$VENV/bin/python" -m pip install --upgrade pip pynvim

  echo "Neovim Python provider ready:"
  "$VENV/bin/python" -c 'import pynvim; print("pynvim:", pynvim.__version__)'
  ;;
esac