dotfiles/nvr_git
2025-04-15 20:06:02 +02:00

21 lines
533 B
Bash
Executable file

#!/bin/bash
nvr_git () {
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
if test -f /usr/bin/nvim; then
/usr/bin/nvim "$@"
else
/usr/local/bin/nvim "$@"
fi
fi
}
nvr_git $@