Created
September 6, 2024 06:40
-
-
Save S1M0N38/0abb1fc43a41af5c3b1882006212c8c8 to your computer and use it in GitHub Desktop.
Molten issues 232 setup script
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
#!/bin/bash | |
NVIM_APPNAME=test-nvim | |
XDG_DATA_HOME="$HOME/.local/share" | |
echo "--------------------------------------------------------------------------------" | |
echo "0. Remove file from previous tests" | |
rm -rf ~/.config/$NVIM_APPNAME | |
rm -rf ~/.local/share/$NVIM_APPNAME | |
rm -rf ~/.local/state/$NVIM_APPNAME | |
rm -rf ~/.cache/$NVIM_APPNAME | |
rm -rf $XDG_DATA_HOME/venvs/$NVIM_APPNAME | |
read -p "Press Enter to continue..." | |
echo "--------------------------------------------------------------------------------" | |
echo "1. Create python environment and test installation" | |
echo "Default python" | |
which python | |
python -VV | |
read -p "Press Enter to continue..." | |
python -m venv "$XDG_DATA_HOME/venvs/$NVIM_APPNAME" | |
source "$XDG_DATA_HOME/venvs/$NVIM_APPNAME/bin/activate" | |
pip install pynvim jupyter_client --no-cache-dir | |
python -c "import neovim, jupyter_client" | |
read -p "Press Enter to continue..." | |
echo "$NVIM_APPNAME python" | |
which python | |
python -VV | |
read -p "Press Enter to continue..." | |
echo "--------------------------------------------------------------------------------" | |
echo "2. Create new dir for testing, minimal.lua and hello-world.py" | |
mkdir molten-issue-232 | |
cd molten-issue-232 | |
PYTHON_PATH="$XDG_DATA_HOME/venvs/$NVIM_APPNAME/bin/python3" | |
cat <<EOF >minimal.lua | |
vim.g.python3_host_prog = vim.fn.expand("$PYTHON_PATH") | |
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
if not (vim.uv or vim.loop).fs_stat(lazypath) then | |
local lazyrepo = "https://github.com/folke/lazy.nvim.git" | |
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) | |
if vim.v.shell_error ~= 0 then | |
vim.api.nvim_echo({ | |
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" }, | |
{ out, "WarningMsg" }, | |
{ "\nPress any key to exit..." }, | |
}, true, {}) | |
vim.fn.getchar() | |
os.exit(1) | |
end | |
end | |
vim.opt.rtp:prepend(lazypath) | |
vim.g.mapleader = " " | |
require("lazy").setup({ | |
spec = { | |
{ | |
"benlubas/molten-nvim", | |
version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes | |
build = ":UpdateRemotePlugins", | |
init = function() | |
vim.g.molten_output_win_max_height = 12 | |
end, | |
}, | |
}, | |
checker = { enabled = true }, | |
}) | |
EOF | |
cat <<EOF >hello-world.py | |
print("hello world!") | |
EOF | |
echo "list created files" | |
ls -l | |
read -p "Press Enter to continue..." | |
echo "--------------------------------------------------------------------------------" | |
echo "3. Run Neovim: install lazy, install molten" | |
echo "Neovim version" | |
which nvim | |
nvim -v | |
read -p "Press Enter to continue..." | |
NVIM_APPNAME=test-nvim nvim --clean -u minimal.lua | |
read -p "Press Enter to continue..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment