Honestly I am not sure, I have borrowed this code from Time Pope's dotfiles a while back.
Refer - https://github.com/tpope/tpope/blob/master/.vimrc#L232-L241
I trust his code :)