Type :w!! in command mode to reopen current file with sudo permissions.