begin rebuild of config to separate files
This commit is contained in:
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# Reports what this machine has and what the config will do with it. Changes nothing.
|
||||
# Usage: scripts/doctor.sh
|
||||
|
||||
have() { command -v "$1" >/dev/null 2>&1; }
|
||||
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; }
|
||||
warn() { printf ' \033[33m!\033[0m %s\n' "$1"; }
|
||||
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; }
|
||||
|
||||
echo "Neovim"
|
||||
if have nvim; then
|
||||
version="$(nvim --version | head -1)"
|
||||
read -r major minor < <(echo "$version" | sed -E 's/^NVIM v([0-9]+)\.([0-9]+).*/\1 \2/')
|
||||
if [ "$major" -gt 0 ] || [ "$minor" -ge 11 ]; then
|
||||
ok "$version"
|
||||
else
|
||||
bad "$version is too old, need >= 0.11 (run scripts/install-nvim.sh)"
|
||||
fi
|
||||
else
|
||||
bad "nvim not found (run scripts/install-nvim.sh)"
|
||||
fi
|
||||
|
||||
echo "Required"
|
||||
have git && ok git || bad "git (plugins are cloned with it)"
|
||||
{ have curl || have wget; } && ok "curl/wget" || bad "curl or wget (mason, blink.cmp and treesitter download with it)"
|
||||
{ have cc || have gcc || have clang; } && ok "C compiler" || bad "C compiler (treesitter parsers are built locally): apt install build-essential"
|
||||
have unzip && ok unzip || warn "unzip (mason needs it for some packages)"
|
||||
have tar && have gzip && ok "tar/gzip" || bad "tar and gzip (mason)"
|
||||
have rg && ok ripgrep || warn "ripgrep (telescope live grep): apt install ripgrep"
|
||||
|
||||
echo "Optional (the config skips what it can't use)"
|
||||
have make && ok "make (telescope-fzf-native)" || warn "make: telescope falls back to its slower Lua sorter"
|
||||
have fd && ok fd || warn "fd: telescope find_files falls back to find/ripgrep"
|
||||
have java && ok "java (jdtls enabled)" || warn "java: Java LSP stays off"
|
||||
have python3 && ok "python3 (basedpyright, ruff, clang-format enabled)" || warn "python3: Python LSP and clang-format stay off"
|
||||
have npm && ok "npm (bash-language-server enabled)" || warn "npm: bash LSP stays off"
|
||||
have latexmk && ok "latexmk (vimtex enabled)" || warn "latexmk: vimtex stays off"
|
||||
have tree-sitter && ok "tree-sitter CLI" || warn "tree-sitter CLI: mason installs it on first launch"
|
||||
|
||||
echo "Session"
|
||||
if [ -n "${SSH_TTY:-}${SSH_CONNECTION:-}" ]; then
|
||||
ok "SSH session: clipboard copies via OSC 52 (tmux needs: set -g set-clipboard on)"
|
||||
elif have pbcopy || have wl-copy || have xclip || have xsel || have win32yank.exe; then
|
||||
ok "native clipboard tool found"
|
||||
else
|
||||
warn "no clipboard tool: clipboard falls back to OSC 52"
|
||||
fi
|
||||
[ -n "${NVIM_MINIMAL:-}" ] && warn "NVIM_MINIMAL set: no auto-installs"
|
||||
[ -n "${NVIM_NO_NERD_FONT:-}" ] && warn "NVIM_NO_NERD_FONT set: plain-text icons"
|
||||
exit 0
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install a current Neovim release under ~/.local (no root needed).
|
||||
# Linux x86_64/arm64 and macOS. Usage: scripts/install-nvim.sh [version] (default: stable, e.g. v0.11.4)
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="${1:-stable}"
|
||||
PREFIX="${NVIM_PREFIX:-$HOME/.local}"
|
||||
|
||||
case "$(uname -s)-$(uname -m)" in
|
||||
Linux-x86_64) asset=nvim-linux-x86_64 ;;
|
||||
Linux-aarch64 | Linux-arm64) asset=nvim-linux-arm64 ;;
|
||||
Darwin-arm64) asset=nvim-macos-arm64 ;;
|
||||
Darwin-x86_64) asset=nvim-macos-x86_64 ;;
|
||||
*)
|
||||
echo "Unsupported platform: $(uname -s) $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
url="https://github.com/neovim/neovim/releases/download/${VERSION}/${asset}.tar.gz"
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
echo "Downloading $url"
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL "$url" -o "$tmp/nvim.tar.gz"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -qO "$tmp/nvim.tar.gz" "$url"
|
||||
else
|
||||
echo "Need curl or wget." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -C "$tmp" -xzf "$tmp/nvim.tar.gz"
|
||||
mkdir -p "$PREFIX/opt" "$PREFIX/bin"
|
||||
rm -rf "$PREFIX/opt/nvim"
|
||||
mv "$tmp/$asset" "$PREFIX/opt/nvim"
|
||||
ln -sf "$PREFIX/opt/nvim/bin/nvim" "$PREFIX/bin/nvim"
|
||||
|
||||
if ! "$PREFIX/bin/nvim" --version | head -1; then
|
||||
echo "nvim won't start here (very old glibc?). Try the AppImage from the release page instead." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case ":$PATH:" in
|
||||
*":$PREFIX/bin:"*) ;;
|
||||
*) echo "Add $PREFIX/bin to your PATH: export PATH=\"$PREFIX/bin:\$PATH\"" ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user