This commit is contained in:
Jaroslaw Konik 2024-05-30 21:16:11 +02:00
parent 43046edb90
commit 883549eba6
2 changed files with 15 additions and 6 deletions

11
.zshrc
View file

@ -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 "$@"

View file

@ -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