Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
shell function for choosing from vi(m) background jobs the preferred job or start a new vim process
function vi() {
local job_id
job_id=$(jobs|sed -rn "s/\[([0-9])\] *([-+]?) *([Ss]topped|[Ss]uspended).*vim?.*/\1 \2/p"|awk "{if(\$2==\"+\"){id=\$1;exit}else if(\$2==\"-\"){id=\$1;m=\$2}else if(m!=\"-\"){id=\$1}}END{print id}")
if [ ${job_id} ]; then
fg %${job_id}
else
vim
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.