`sudo vi` runs vi as root, which means 1) it won't have your users configurations, and 2) it's probably way the hell over-privileged for what you are trying to do.
`sudoedit` (and equivalently `sudo -e`) makes a copy of the file that you can edit and then copies it back as root iff it's changed.
`sudoedit` (and equivalently `sudo -e`) makes a copy of the file that you can edit and then copies it back as root iff it's changed.