Use este / usr / local / bin / vi:
#!/bin/sh
VIM_PPID=$(ps -Af | grep " vim $1\$" | head -n 1 | awk '{print $3}')
if [ -n "$VIM_PPID" ] ; then
_WINDOW=$(tr '#!/bin/sh
VIM_PPID=$(ps -Af | grep " vim $1\$" | head -n 1 | awk '{print $3}')
if [ -n "$VIM_PPID" ] ; then
_WINDOW=$(tr '%pre%' '\n' < /proc/$VIM_PPID/environ | grep ^WINDOW= | cut -f 2 -d '=')
VIMSHELL_PPID=$(ps -Af | awk '/^[^ ]+ +'$VIM_PPID' +/{print $3}')
MYSHELL_PPID=$(ps -Af | awk '/^[^ ]+ +'$PPID' +/{print $3}')
if [ "$MYSHELL_PPID" = "$VIMSHELL_PPID" ] ; then
screen -X select $_WINDOW
exit
fi
fi
exec /usr/bin/vim $@
' '\n' < /proc/$VIM_PPID/environ | grep ^WINDOW= | cut -f 2 -d '=')
VIMSHELL_PPID=$(ps -Af | awk '/^[^ ]+ +'$VIM_PPID' +/{print $3}')
MYSHELL_PPID=$(ps -Af | awk '/^[^ ]+ +'$PPID' +/{print $3}')
if [ "$MYSHELL_PPID" = "$VIMSHELL_PPID" ] ; then
screen -X select $_WINDOW
exit
fi
fi
exec /usr/bin/vim $@
Graças a this responder