From 883549eba6716b0ad82cf1515667e17676b09e12 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Thu, 30 May 2024 21:16:11 +0200 Subject: [PATCH] update --- .zshrc | 11 ++++++++--- nvim_remote | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.zshrc b/.zshrc index b405c85..7a5eb03 100644 --- a/.zshrc +++ b/.zshrc @@ -22,9 +22,14 @@ compinit # nvr_git () { - local repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) - if [ -n "$repo_path" ]; then - local servername=/tmp/nvr$(echo $repo_path | tr "/" "_") + local main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) + local repo_path=$(git rev-parse --show-toplevel 2>/dev/null) + if [[ -z "$main_module_repo_path" ]]; then + main_module_repo_path=$repo_path + fi + + if [ -n "$main_module_repo_path" ]; then + local servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") nvr -s --servername $servername "$@" else /usr/bin/nvim "$@" diff --git a/nvim_remote b/nvim_remote index fa22482..6ea2f82 100755 --- a/nvim_remote +++ b/nvim_remote @@ -4,15 +4,19 @@ line=$(cut -d " " -f 1 <<< $@) path=$(cut -d " " -f 2 <<< $@) main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) +repo_path=$(git rev-parse --show-toplevel 2>/dev/null) +if [[ -z "$main_module_repo_path" ]]; then + main_module_repo_path=$repo_path +fi main_module_relative_file_path=$main_module_repo_path/$path -repo_relative_file_path=$(git rev-parse --show-toplevel 2>/dev/null)/$path +repo_relative_file_path=/$path relative_file_path=$path servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") -if [ -n "$relative_path" ]; then - nvr -s --servername $servername $line "$relative_path" +if [ -n "$relative_file_path" ]; then + nvr -s --servername $servername $line "$relative_file_path" elif [ -n "$repo_relative_file_path" ]; then nvr -s --servername $servername $line "$repo_relative_file_path" elif [ -n "$main_module_relative_file_path" ]; then