From d8a3e18fdf9ab6c9990751ea9b0942f86c945e3b Mon Sep 17 00:00:00 2001 From: pika Date: Thu, 22 Aug 2024 17:17:00 +0000 Subject: [PATCH] removed bad function to check nvim version --- .zshrc | 52 ++++++++++------------------------------------------ 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/.zshrc b/.zshrc index c11dd68..055f7e2 100644 --- a/.zshrc +++ b/.zshrc @@ -244,50 +244,18 @@ _coding_() { export EDITOR="codium" fi # ─< 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 - # Get the current Neovim version - 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' - else - if [ -n "$neovide_path" ]; then - alias nvim="$neovide_path --fork" - else - neovide_path=$(find "$HOME/" -name "*neovide*.appimage" 2>/dev/null) - if [ -n "$neovide_path" ]; then - alias nvim="$neovide_path --fork" - else - echo "Neovide not found. Please install Neovide or set neovide_path." - fi - fi - fi - else - # Neovim version is below 0.10.0, use default nvim - alias nvim='nvim' - fi + if [ -d "$HOME/.local/share/neovide/" ]; then + if command_exists neovide; then + alias nvim='neovide --fork' else - # Neovide directory does not exist - echo "Neovide directory not found. Skipping Neovide alias setup." + if [ -n "$neovide_path" ]; then + alias nvim="$neovide_path --fork" + else + neovide_path=$(find "$HOME/" -name "*neovide*.appimage" 2>/dev/null) + alias nvim="$neovide_path --fork" + fi fi -} - -# Ensure to call the function to apply the alias setup -setup_nvim_alias - + fi # Function to get the IP address get_ip() { ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1