[Feature]: Termux Support (#1206)

This commit is contained in:
rayane866 2021-08-02 17:04:26 +01:00 committed by GitHub
parent 6d14d7b5da
commit c2ef6f43e2
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
2 changed files with 34 additions and 4 deletions

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
#Set Variable to master is not set differently #Set Variable to master is not set differently
LVBRANCH="${LVBRANCH:-master}" LVBRANCH="${LVBRANCH:-master}"
USER_BIN_DIR="/usr/local/bin"
set -o nounset # error when referencing undefined variable set -o nounset # error when referencing undefined variable
set -o errexit # exit when command fails set -o errexit # exit when command fails
@ -15,6 +16,10 @@ installnodeubuntu() {
sudo apt install npm sudo apt install npm
} }
installnodetermux() {
apt install nodejs
}
moveoldlvim() { moveoldlvim() {
echo "Not installing LunarVim" echo "Not installing LunarVim"
echo "Please move your ~/.local/share/lunarvim folder before installing" echo "Please move your ~/.local/share/lunarvim folder before installing"
@ -49,6 +54,7 @@ installnode() {
[ -f "/etc/artix-release" ] && installnodearch [ -f "/etc/artix-release" ] && installnodearch
[ -f "/etc/fedora-release" ] && installnodefedora [ -f "/etc/fedora-release" ] && installnodefedora
[ -f "/etc/gentoo-release" ] && installnodegentoo [ -f "/etc/gentoo-release" ] && installnodegentoo
[ -d "/data/data/com.termux" ] && installnodetermux
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
sudo npm i -g neovim sudo npm i -g neovim
} }
@ -63,6 +69,10 @@ installpiponubuntu() {
sudo apt install python3-pip >/dev/null sudo apt install python3-pip >/dev/null
} }
installpipontermux() {
apt install python
}
installpiponarch() { installpiponarch() {
sudo pacman -S python-pip sudo pacman -S python-pip
} }
@ -82,6 +92,7 @@ installpip() {
[ -f "/etc/arch-release" ] && installpiponarch [ -f "/etc/arch-release" ] && installpiponarch
[ -f "/etc/fedora-release" ] && installpiponfedora [ -f "/etc/fedora-release" ] && installpiponfedora
[ -f "/etc/gentoo-release" ] && installpipongentoo [ -f "/etc/gentoo-release" ] && installpipongentoo
[ -d "/data/data/com.termux" ] && installpipontermux
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
} }
@ -100,6 +111,12 @@ installpacker() {
} }
cloneconfig() { cloneconfig() {
if [ -d "/data/data/com.termux" ]; then
sudo() {
eval "$@"
}
USER_BIN_DIR="$HOME/../usr/bin"
fi
echo "Cloning LunarVim configuration" echo "Cloning LunarVim configuration"
mkdir -p ~/.local/share/lunarvim mkdir -p ~/.local/share/lunarvim
case "$@" in case "$@" in
@ -112,8 +129,8 @@ cloneconfig() {
;; ;;
esac esac
mkdir -p "$HOME/.config/lvim" mkdir -p "$HOME/.config/lvim"
sudo cp "$HOME/.local/share/lunarvim/lvim/utils/bin/lvim" "/usr/local/bin" sudo cp "$HOME/.local/share/lunarvim/lvim/utils/bin/lvim" "$USER_BIN_DIR"
sudo chmod a+rx /usr/local/bin/lvim sudo chmod a+rx "$USER_BIN_DIR"/lvim
cp "$HOME/.local/share/lunarvim/lvim/utils/installer/config.example-no-ts.lua" "$HOME/.config/lvim/config.lua" cp "$HOME/.local/share/lunarvim/lvim/utils/installer/config.example-no-ts.lua" "$HOME/.config/lvim/config.lua"
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \ nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \
@ -162,6 +179,12 @@ installonubuntu() {
npm install -g tree-sitter-cli npm install -g tree-sitter-cli
} }
installtermux() {
apt install ripgrep fzf
pip install neovim-remote
npm install -g tree-sitter-cli
}
installonarch() { installonarch() {
sudo pacman -S ripgrep fzf sudo pacman -S ripgrep fzf
pip3 install neovim-remote pip3 install neovim-remote
@ -185,6 +208,7 @@ installextrapackages() {
[ -f "/etc/artix-release" ] && installonarch [ -f "/etc/artix-release" ] && installonarch
[ -f "/etc/fedora-release" ] && installonfedora [ -f "/etc/fedora-release" ] && installonfedora
[ -f "/etc/gentoo-release" ] && installongentoo [ -f "/etc/gentoo-release" ] && installongentoo
[ -d "/data/data/com.termux" ] && installtermux
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
} }

View file

@ -1,5 +1,11 @@
#!/bin/sh #!/bin/sh
USER_BIN_DIR="/usr/local/bin"
if [ -d "/data/data/com.termux" ]; then
sudo() {
eval "$@"
}
USER_BIN_DIR="$HOME/../usr/bin"
fi
rm -rf ~/.local/share/lunarvim rm -rf ~/.local/share/lunarvim
sudo rm /usr/local/bin/lvim sudo rm "$USER_BIN_DIR"/lvim
rm -rf ~/.local/share/applications/lvim.desktop rm -rf ~/.local/share/applications/lvim.desktop