port from sublime-git