feat(installer): allow customizing NVIM_APPNAME (#3896)

This commit is contained in:
kylo252 2023-04-12 18:46:29 +02:00 committed by GitHub
parent 1e1e7bb4f5
commit a0b2a0e9bf
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 23 deletions

View file

@ -1,9 +1,11 @@
#!/usr/bin/env bash
export NVIM_APPNAME="${NVIM_APPNAME:-NVIM_APPNAME_VAR}"
export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-RUNTIME_DIR_VAR}"
export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-CONFIG_DIR_VAR}"
export LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-CACHE_DIR_VAR}"
export LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-BASE_DIR_VAR}"
exec -a lvim nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@"
exec -a "$NVIM_APPNAME" nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@"

View file

@ -12,10 +12,12 @@ declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
declare -xr XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}"
declare -xr XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
declare -xr NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}"
declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}"
declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}"
declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}"
declare -xr LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}"
@ -164,7 +166,7 @@ function main() {
msg "$ADDITIONAL_WARNINGS"
msg "Thank you for installing LunarVim!!"
echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
echo "You can start it by running: $INSTALL_PREFIX/bin/$NVIM_APPNAME"
echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
}
@ -435,7 +437,7 @@ function setup_lvim() {
echo "Preparing Lazy setup"
"$INSTALL_PREFIX/bin/lvim" --headless -c 'quitall'
"$INSTALL_PREFIX/bin/$NVIM_APPNAME" --headless -c 'quitall'
echo "Lazy setup complete"

View file

@ -7,15 +7,16 @@ XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}"
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
NVIM_APPNAME="${NVIM_APPNAME:-lvim}"
LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}"
LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}"
LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}"
function setup_shim() {
local src="$LUNARVIM_BASE_DIR/utils/bin/lvim.template"
local dst="$INSTALL_PREFIX/bin/lvim"
local dst="$INSTALL_PREFIX/bin/$NVIM_APPNAME"
[ ! -d "$INSTALL_PREFIX/bin" ] && mkdir -p "$INSTALL_PREFIX/bin"
@ -24,7 +25,8 @@ function setup_shim() {
cp "$src" "$dst"
sed -e s"#RUNTIME_DIR_VAR#\"${LUNARVIM_RUNTIME_DIR}\"#"g \
sed -e s"#NVIM_APPNAME_VAR#\"${NVIM_APPNAME}\"#"g \
-e s"#RUNTIME_DIR_VAR#\"${LUNARVIM_RUNTIME_DIR}\"#"g \
-e s"#CONFIG_DIR_VAR#\"${LUNARVIM_CONFIG_DIR}\"#"g \
-e s"#CACHE_DIR_VAR#\"${LUNARVIM_CACHE_DIR}\"#"g \
-e s"#BASE_DIR_VAR#\"${LUNARVIM_BASE_DIR}\"#"g "$src" \
@ -35,4 +37,4 @@ function setup_shim() {
setup_shim "$@"
echo "You can start LunarVim by running: $INSTALL_PREFIX/bin/lvim"
echo "You can start LunarVim by running: $INSTALL_PREFIX/bin/$NVIM_APPNAME"

View file

@ -8,9 +8,12 @@ declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}"
declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
declare -xr NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}"
declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}"
declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}"
declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}"
declare -a __lvim_dirs=(
"$LUNARVIM_RUNTIME_DIR"
@ -59,13 +62,7 @@ function remove_lvim_dirs() {
}
function remove_lvim_bin() {
local legacy_bin="/usr/local/bin/lvim "
if [ -x "$legacy_bin" ]; then
echo "Error! Unable to remove $legacy_bin without elevation. Please remove manually."
exit 1
fi
lvim_bin="$(command -v lvim 2>/dev/null)"
lvim_bin="$(command -v "$NVIM_APPNAME" 2>/dev/null)"
rm -f "$lvim_bin"
}