+if [[ -n "${VIM_TERMINAL}" ]]; then
+    function vim() {
+        if (( ${#@} == 0 )); then
+            echo "Running in Vim's terminal, at least one file must be given!" >&2
+            return 22
+        fi
+        for f in "$@"; do
+            if [[ "${f:0:1}" == "-" ]]; then
+                echo "Running in Vim's terminal, not accepting options!" >&2
+                return 1
+            fi
+        done
+        for f in "$@"; do
+            # drop the file onto the running vim instance
+            # see :h terminal-communication
+            local abspath=$(realpath $f)
+            echo -e "\e]51;[\"drop\", \"$abspath\"]\a"
+        done
+    }
+fi
+alias vi=nvim