update
This commit is contained in:
parent
5ff3b41f4f
commit
2f9e15b016
1 changed files with 15 additions and 11 deletions
26
nvim_remote
26
nvim_remote
|
|
@ -1,16 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
line=$(cut -d " " -f 1 <<< $@)
|
||||||
path=$(cut -d " " -f 2 <<< $@)
|
path=$(cut -d " " -f 2 <<< $@)
|
||||||
dir=$(dirname $path)
|
|
||||||
cd $dir
|
|
||||||
args=$@
|
|
||||||
|
|
||||||
repo_path=$(git rev-parse --show-toplevel 2>/dev/null)
|
main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
||||||
cd $repo_path
|
|
||||||
if [ -n "$repo_path" ]; then
|
main_module_relative_file_path=$main_module_repo_path/$path
|
||||||
servername=/tmp/nvr$(echo $repo_path | tr "/" "_")
|
repo_relative_file_path=$(git rev-parse --show-toplevel 2>/dev/null)/$path
|
||||||
nvr -s --servername $servername "$@"
|
relative_file_path=$path
|
||||||
else
|
|
||||||
nvim "$@"
|
servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_")
|
||||||
|
|
||||||
|
if [ -n "$relative_path" ]; then
|
||||||
|
nvr -s --servername $servername $line "$relative_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
|
||||||
|
nvr -s --servername $servername $line "$main_module_relative_file_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue