mirror of
https://github.com/NvChad/NvChad.git
synced 2024-11-08 13:10:25 +00:00
[4/4] Refactor: install.sh: Don't handle packer
use +":lua require 'pluginList' vim.cmd('PackerSync')" only for update as PackerSync should trigger on fresh install automatically
This commit is contained in:
parent
643d1bd7d8
commit
d1f23d1bc3
53
install.sh
53
install.sh
@ -33,36 +33,6 @@ _check_nvim_version() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_setup_packer() {
|
|
||||||
_clone_packer() {
|
|
||||||
[ -d "${_PACKER_PATH}" ] && rm -rf "${_PACKER_PATH}"
|
|
||||||
|
|
||||||
printf "\n%s\n" "=> Cloning packer.."
|
|
||||||
if "${_GIT}" clone "${_PACKER_REPO_URL}" \
|
|
||||||
"${_PACKER_PATH}" --depth 20; then
|
|
||||||
printf "%s\n" "=> Packer Installed!"
|
|
||||||
else
|
|
||||||
printf "Error: Couldn't clone packer\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "${_UPDATE}" = "true" ]; then
|
|
||||||
printf "%s\n" "Updating packer"
|
|
||||||
{ [ -d "${_PACKER_PATH}" ] \
|
|
||||||
&& "${_GIT}" -C "${_PACKER_PATH}" pull "${_PACKER_REPO_URL}"; } || _clone_packer
|
|
||||||
else
|
|
||||||
printf "%s\n" "Installing packer"
|
|
||||||
if [ -d ~/.local/share/nvim/site/pack/packer ]; then
|
|
||||||
printf "%s\n" "Clearing previous packer installs"
|
|
||||||
rm -rf ~/.local/share/nvim/site/pack
|
|
||||||
fi
|
|
||||||
_clone_packer
|
|
||||||
fi
|
|
||||||
printf "\n"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_copy_config() {
|
_copy_config() {
|
||||||
printf "%s\n" "Linking config"
|
printf "%s\n" "Linking config"
|
||||||
printf "%s\n" "Old nvim config will be changed to nvim.bak if exists! :0"
|
printf "%s\n" "Old nvim config will be changed to nvim.bak if exists! :0"
|
||||||
@ -124,8 +94,6 @@ _setup_terminal_shell() {
|
|||||||
|
|
||||||
_setup_arguments() {
|
_setup_arguments() {
|
||||||
# default variables to be used
|
# default variables to be used
|
||||||
_PACKER_PATH="${HOME}/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
|
||||||
_PACKER_REPO_URL="https://github.com/wbthomason/packer.nvim"
|
|
||||||
_CONFIG_PATH="${HOME}/.config/nvim"
|
_CONFIG_PATH="${HOME}/.config/nvim"
|
||||||
_UPDATE=""
|
_UPDATE=""
|
||||||
_BACKUP_PATH="${_CONFIG_PATH}.bak"
|
_BACKUP_PATH="${_CONFIG_PATH}.bak"
|
||||||
@ -133,9 +101,9 @@ _setup_arguments() {
|
|||||||
_CURRENT_SHELL="${SHELL##*/}"
|
_CURRENT_SHELL="${SHELL##*/}"
|
||||||
|
|
||||||
_check_longoptions() {
|
_check_longoptions() {
|
||||||
[ -z "${2}" ] \
|
[ -z "${2}" ] &&
|
||||||
&& printf '%s: %s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "${1}" "${0##*/}" \
|
printf '%s: %s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "${1}" "${0##*/}" &&
|
||||||
&& exit 1
|
exit 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,22 +146,23 @@ main() {
|
|||||||
_check_install_dependencies
|
_check_install_dependencies
|
||||||
|
|
||||||
_setup_arguments "${@}"
|
_setup_arguments "${@}"
|
||||||
_setup_packer
|
|
||||||
_copy_config
|
_copy_config
|
||||||
_setup_terminal_shell
|
_setup_terminal_shell
|
||||||
|
|
||||||
# install all plugins + compile them
|
# install all plugins + compile them
|
||||||
if _NVIM="$(command -v nvim)"; then
|
if _NVIM="$(command -v nvim)"; then
|
||||||
if _check_nvim_version; then
|
if _check_nvim_version; then
|
||||||
printf "\n%s\n" "=> Neovim will open with some errors, just press enter" && sleep 1
|
printf "\n%s\n" "=> Neovim will now open." && sleep 1
|
||||||
"${_NVIM}" +PackerSync
|
if [ "${_UPDATE}" = "false" ]; then
|
||||||
|
"${_NVIM}" +":lua require 'pluginList' vim.cmd('PackerSync')"
|
||||||
else
|
else
|
||||||
printf "Error: Neovim is installed, but version is lower than 0.5.x, install Neovim >= 5.x and then run the below command.\n"
|
"${_NVIM}"
|
||||||
printf " nvim +PackerSync\n"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf "Error: Neovim is not installed, install Neovim >= 5.x and then run the below command\n"
|
printf "Error: Neovim is installed, but version is lower than 0.5.x, install Neovim >= 5.x and then run nvim & do :PackerSync\n."
|
||||||
printf " nvim +PackerSync\n"
|
fi
|
||||||
|
else
|
||||||
|
printf "Error: Neovim is not installed, install Neovim >= 5.x and then run neovim & do :PackerSync.\n"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user