removed bad function to check nvim version
This commit is contained in:
parent
bc5acd9ecf
commit
d8a3e18fdf
1 changed files with 10 additions and 42 deletions
34
.zshrc
34
.zshrc
|
@ -244,50 +244,18 @@ _coding_() {
|
||||||
export EDITOR="codium"
|
export EDITOR="codium"
|
||||||
fi
|
fi
|
||||||
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
|
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
|
||||||
# Function to check Neovim version and set up Neovide alias accordingly
|
|
||||||
setup_nvim_alias() {
|
|
||||||
# Check if Neovide directory exists
|
|
||||||
if [ -d "$HOME/.local/share/neovide/" ]; then
|
if [ -d "$HOME/.local/share/neovide/" ]; then
|
||||||
# Get the current Neovim version
|
if command_exists neovide; then
|
||||||
version=$(nvim --version | head -n 1 | awk '{print $2}')
|
|
||||||
|
|
||||||
# Define the required version
|
|
||||||
required_version="0.10.0"
|
|
||||||
|
|
||||||
# Use awk to compare versions
|
|
||||||
if awk -v v1="$version" -v v2="$required_version" 'BEGIN {
|
|
||||||
split(v1, a, "."); split(v2, b, ".");
|
|
||||||
if (a[1] > b[1] || (a[1] == b[1] && a[2] > b[2]) || (a[1] == b[1] && a[2] == b[2] && a[3] >= b[3])) exit(0);
|
|
||||||
exit(1);
|
|
||||||
}'; then
|
|
||||||
# Neovim version is 0.10.0 or higher, use Neovide
|
|
||||||
if command -v neovide > /dev/null; then
|
|
||||||
alias nvim='neovide --fork'
|
alias nvim='neovide --fork'
|
||||||
else
|
else
|
||||||
if [ -n "$neovide_path" ]; then
|
if [ -n "$neovide_path" ]; then
|
||||||
alias nvim="$neovide_path --fork"
|
alias nvim="$neovide_path --fork"
|
||||||
else
|
else
|
||||||
neovide_path=$(find "$HOME/" -name "*neovide*.appimage" 2>/dev/null)
|
neovide_path=$(find "$HOME/" -name "*neovide*.appimage" 2>/dev/null)
|
||||||
if [ -n "$neovide_path" ]; then
|
|
||||||
alias nvim="$neovide_path --fork"
|
alias nvim="$neovide_path --fork"
|
||||||
else
|
|
||||||
echo "Neovide not found. Please install Neovide or set neovide_path."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# Neovim version is below 0.10.0, use default nvim
|
|
||||||
alias nvim='nvim'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Neovide directory does not exist
|
|
||||||
echo "Neovide directory not found. Skipping Neovide alias setup."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure to call the function to apply the alias setup
|
|
||||||
setup_nvim_alias
|
|
||||||
|
|
||||||
# Function to get the IP address
|
# Function to get the IP address
|
||||||
get_ip() {
|
get_ip() {
|
||||||
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue